Update workflow to create issues if tests fail #1
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: Nightly dependencies at develop | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 23 * * 1" | |
pull_request: | |
concurrency: | |
# github.workflow: name of the workflow, so that we don't cancel other workflows | |
# github.run_id || github.event_name: either the unique identifier for the job or the event that triggered it | |
group: ${{ github.workflow }}-${{ github.run_id || github.event_name }} | |
# Cancel in-progress runs when a new workflow with the same group name is triggered | |
cancel-in-progress: true | |
jobs: | |
nightly_tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-14] | |
python-version: ["3.12"] | |
suite: ["unit", "integration", "examples"] | |
name: Test-${{ matrix.os }}-py-${{ matrix.python-version }}-${{ matrix.suite }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -e ".[all,dev]" | |
python -m pip install "pybamm[all] @ git+https://github.com/pybamm-team/PyBaMM@develop" --force-reinstall | |
pip install pytest-reportlog | |
- name: Run ${{ matrix.suite }} tests | |
id: test-suite | |
run: | | |
if [[ "${{ matrix.suite }}" == "unit" ]]; then | |
python -m pytest --unit --report-log=pytest-log-unit.jsonl | |
elif [[ "${{ matrix.suite }}" == "integration" ]]; then | |
python -m pytest --integration --report-log=pytest-log-integration.jsonl | |
elif [[ "${{ matrix.suite }}" == "examples" ]]; then | |
python -m pytest --nbmake --examples --report-log=pytest-log-examples.jsonl | |
fi | |
- name: Create issue(s) if tests fail | |
# github.repository == 'pybop-team/PyBOP' | |
if: >- | |
failure() && | |
steps.test-suite.outcome == 'failure' | |
uses: xarray-contrib/issue-from-pytest-log@v1.2.8 | |
with: | |
# Ensure that different matrix jobs don't overwrite each other's issues | |
# and that a unique issue is created. This is because the action does not | |
# allow adding a comment to an existing issue | |
issue-title: "Nightly tests: ${{ matrix.os }}-${{ matrix.suite }} tests failed" | |
issue-label: "nightly tests" | |
log-path: pytest-log-${{ matrix.suite }}.jsonl |