Setup (#10) #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: CI | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
workflow_dispatch: | |
jobs: | |
lint: | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ['3.12'] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
- name: Install Project | |
run: pip install '.[test]' | |
- name: Look for style errors | |
run: flake8 app --ignore=F401,F821,E501 | |
- name: Checking for importing style | |
run: isort --profile=black --check --diff app | |
- name: Look for auto format errors | |
run: black --check --diff app | |
tests: | |
needs: lint | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.10', '3.12'] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
- name: Install Project | |
run: pip install '.[test]' | |
- name: Run tests | |
run: pytest -v --junitxml=test-result.xml | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2.16.1 | |
if: always() | |
with: | |
files: test-result.xml | |
check_name: Test Result (Python ${{ matrix.python-version }}) | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |