Skip to content

Tests

Tests #172

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "0 4 * * *"
# Hack to work with bump version
# We are forced to trigger tests on human review as we are creating the PR from a workflow
# See: https://github.com/cli/cli/discussions/6575#discussioncomment-4077706
pull_request_review:
types: [ submitted ]
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_test_sessions:
# See pull_request_review
if: (github.event_name != 'pull_request_review' || github.event.review.state == 'approved')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/actions/install_dependencies
- name: list all test sessions
id: test_sessions
run: echo "matrix=$(poetry run python commands/list_nox_manifest.py --sessions tests --json)" >> $GITHUB_OUTPUT
outputs:
test_sessions: ${{ steps.test_sessions.outputs.matrix }}
run_all_tests:
needs: list_nox_test_sessions
strategy:
fail-fast: false
matrix:
include:
${{ fromJson(needs.list_nox_test_sessions.outputs.test_sessions) }}
name: Run tests session ${{ matrix.session }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/actions/install_dependencies
- uses: ./.github/workflows/actions/run_nox_session
id: run-nox-session
with:
python_version: ${{ matrix.python }}
nox_session: ${{ matrix.session }}
- uses: ./.github/workflows/actions/normalize_string
id: escape-streamlit-version
with:
string_to_escape: ${{ matrix.call_spec.streamlit_version }}
- uses: codecov/codecov-action@v3
with:
files: ./codecov.xml
flags: pytest,python-${{ matrix.python }},st-${{ steps.escape-streamlit-version.outputs.escaped }}
list_nox_format_sessions:
# See pull_request_review
if: (github.event_name != 'pull_request_review' || github.event.review.state == 'approved')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/actions/install_dependencies
- name: list all format sessions
id: format_sessions
run: echo "matrix=$(poetry run python commands/list_nox_manifest.py --sessions black isort lint --json)" >> $GITHUB_OUTPUT
outputs:
format_sessions: ${{ steps.format_sessions.outputs.matrix }}
format:
needs: list_nox_format_sessions
strategy:
fail-fast: false
matrix:
include:
${{ fromJson(needs.list_nox_format_sessions.outputs.format_sessions) }}
name: Run format session ${{ matrix.session }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/actions/install_dependencies
- uses: ./.github/workflows/actions/run_nox_session
with:
python_version: ${{ matrix.python }}
nox_session: ${{ matrix.session }}
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"