Bump minimum Python version to 3.8 #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test & Release | |
on: | |
- push | |
- pull_request | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
lint: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Configure cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-lint-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: ${{ runner.os }}}-lint- | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
pip install -e ".[lint]" | |
- name: Run lints with pylint | |
if: always() | |
run: | | |
pylint content_hash/* | |
pylint example.py | |
- name: Run lints with black | |
if: always() | |
run: | | |
black --check content_hash/* | |
black --check example.py | |
test: | |
name: Testing | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Configure cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ matrix.python }}-test-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: ${{ runner.os }}}-${{ matrix.python }}-test- | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: | | |
pip install '.[test]' | |
pip install scrutinizer-ocular | |
- name: Run tests | |
run: pytest --cov=content_hash | |
- name: Upload coverage | |
if: matrix.python == '3.12' | |
run: | | |
touch .coveragerc | |
ocular | |
release: | |
name: Releasing | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
environment: release | |
needs: | |
- lint | |
- test | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Configure cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-release-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: ${{ runner.os }}}-release- | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 |