Skip to content

Refactor test matrix: most logic at top level, call reusable workflow #1270

Refactor test matrix: most logic at top level, call reusable workflow

Refactor test matrix: most logic at top level, call reusable workflow #1270

Workflow file for this run

name: run-tests
on:
push:
branches:
- '**master**'
- '**_run_ci**'
- '**release**'
pull_request:
types: [opened, reopened, labeled, synchronize]
workflow_dispatch:
jobs:
test:
if: |
github.event_name != 'pull_request' ||
(github.event.action == 'labeled' && github.event.label.name == 'run_ci') ||
(github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no_ci'))
strategy:
matrix:
config:
- os: ubuntu-latest
if: always()
python-versions: ${{((github.event_name == 'workflow_dispatch') && ['3.10', '3.11', '3.12'] || ['3.10', '3.12'])}}
tox-skip-env: ${{((github.event_name == 'workflow_dispatch') && '' || '.*?(py311).*?')}}
coverage: true
- os: windows-latest
if: always()
python-versions: ${{((github.event_name == 'workflow_dispatch') && ['3.10', '3.11', '3.12'] || ['3.10', '3.12'])}}
tox-skip-env: ${{((github.event_name == 'workflow_dispatch') && '' || '.*?(py311).*?')}}
coverage: false
- os: macos-latest
if: always()
python-versions: ${{((github.event_name == 'workflow_dispatch') && ['3.10', '3.11', '3.12'] || ['3.10', '3.12'])}}
tox-skip-env: ${{((github.event_name == 'workflow_dispatch') && '' || '.*?(py311).*?')}}
coverage: false
- os: macos-13
if: ${{((github.event_name == 'workflow_dispatch')
python-versions: ['3.10', '3.11', '3.12']
tox-skip-env: ''
coverage: false
fail-fast: false
uses: ./.github/workflows/test_checkout_one_os.yml

Check failure on line 44 in .github/workflows/run_tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/run_tests.yml

Invalid workflow file

error parsing called workflow ".github/workflows/run_tests.yml" -> "./.github/workflows/test_checkout_one_os.yml" : Invalid type for `on`
with:
if: ${{ matrix.config.if }}
os: ${{ matrix.config.os }}
python-versions: ${{ matrix.config.python-versions }}
tox-skip-env: ${{ matrix.config.tox-skip-env }}
coverage: ${{ matrix.config.converage }}
test-docs:
runs-on: ubuntu-latest
if: success() || failure()
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Update pip and install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install -r tests_and_analysis/ci_requirements.txt
python -m pip install -r doc/requirements.txt
python -m pip install .[matplotlib,phonopy-reader,brille]
- name: Run Sphinx doctests
working-directory: ./doc
shell: bash -l {0}
run: sphinx-build -c source -b doctest source .
- name: Upload docstest results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Doctest results
path: doc/output.txt
publish-test-results:
needs: test
runs-on: ubuntu-latest
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: artifacts/**/junit_report*.xml