Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to test PyBaMM develop branch nightly #291

Merged
merged 14 commits into from
Apr 18, 2024
Merged
76 changes: 76 additions & 0 deletions .github/workflows/nightly_dependency_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Nightly dependencies@develop

on:
workflow_dispatch:
schedule:
- cron: "0 23 * * *"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A daily schedule should be alright for now, but when we implement the nightlies on the PyBaMM side, I will suggest matching that (which will most likely be weekly) to run a few hours after PyBaMM's wheels will have been uploaded

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will most likely be weekly or fortnightly, and I will further recommend adding a job that needs this job and creates an issue for you. Here's how xarray started doing it, which is a bit complicated: pydata/xarray#4583 but it seems to work well: pydata/xarray#8844

We can use a similar workflow based on this, or implement a simpler job that doesn't need to parse the logs and so on. and use existing third-party GitHub Actions that can do the same task (opening an issue, adding the workflow URL in the contents, etc.)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since I saw the cross-link: we've since moved on to using xarray-contrib/issue-from-pytest-log, which abstracts away a lot of the complex code and in general is a lot more robust.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks wonderful – thanks a lot, @keewis!


concurrency:
# github.workflow: name of the workflow, so that we don't cancel other workflows
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Cancel in-progress runs when a new workflow with the same group name is triggered
# This avoids workflow runs on both pushes and PRs
cancel-in-progress: true
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved

jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Check formatting with pre-commit
run: |
python -m pip install pre-commit
pre-commit run ruff

Tests:
needs: style
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
# Include MacOS M-series Runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved

name: Test Suite (${{ matrix.os }} / Python ${{ matrix.python-version }})
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved

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 uninstall -y pybamm
python -m pip install git+https://github.com/pybamm-team/PyBaMM.git@develop
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved
python -m pip install pybtex
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved

- name: Run unit tests
if: ${{ ! cancelled() }}
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved
run: |
python -m pytest --unit
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved

- name: Run integration tests
if: ${{ ! cancelled() }}
run: |
python -m pytest --integration

BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved
- name: Run examples tests
if: ${{ ! cancelled() }}
run: |
python -m pytest --nbmake --examples
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PyBOP
name: Pull Request

on:
workflow_dispatch:
Expand Down
Loading