chore(ci): add demo app and AppTest test #1296
Workflow file for this run
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: Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: "0 4 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
list_nox_sessions_groups: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache sessions results | |
id: sessions-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
format-sessions | |
test-sessions | |
key: sessions-${{ hashFiles('noxfile.py') }} | |
- uses: ./.github/workflows/actions/install_dependencies | |
if: steps.sessions-cache.outputs.cache-hit != 'true' | |
- name: List all format sessions | |
if: steps.sessions-cache.outputs.cache-hit != 'true' | |
run: echo "matrix=$(poetry run python commands/list_nox_manifest.py --sessions black isort lint coverage test_demo_app --json)" >> format-sessions | |
- name: List all test sessions | |
if: steps.sessions-cache.outputs.cache-hit != 'true' | |
run: echo "matrix=$(poetry run python commands/list_nox_manifest.py --sessions tests --json)" >> test-sessions | |
- name: Export format sessions | |
id: export-format-sessions | |
run: cat format-sessions >> $GITHUB_OUTPUT | |
- name: Export test sessions | |
id: export-test-sessions | |
run: cat test-sessions >> $GITHUB_OUTPUT | |
outputs: | |
format_sessions: ${{ steps.export-format-sessions.outputs.matrix }} | |
test_sessions: ${{ steps.export-test-sessions.outputs.matrix }} | |
run_all_tests: | |
needs: list_nox_sessions_groups | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
${{ fromJson(needs.list_nox_sessions_groups.outputs.test_sessions) }} | |
name: Run tests session ${{ matrix.session }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/actions/install_dependencies | |
with: | |
python_version: | | |
${{ matrix.python }} | |
3.12 | |
- uses: ./.github/workflows/actions/run_nox_session | |
with: | |
nox_session: ${{ matrix.session }} | |
format: | |
needs: list_nox_sessions_groups | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
${{ fromJson(needs.list_nox_sessions_groups.outputs.format_sessions) }} | |
name: Run format session ${{ matrix.session }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/actions/install_dependencies | |
with: | |
python_version: | | |
${{ matrix.python }} | |
3.12 | |
- uses: ./.github/workflows/actions/run_nox_session | |
with: | |
nox_session: ${{ matrix.session }} | |
- if: ${{ startsWith(matrix.session, 'coverage') }} | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./codecov.xml | |
flags: pytest | |
all_test_passed: | |
# Used to easy force requirements checks in GitHub | |
needs: | |
- format | |
- run_all_tests | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "All test passed" |