Skip to content

Commit

Permalink
Split tests into scheduled and triggered, to avoid disabling PR tests.
Browse files Browse the repository at this point in the history
Github disables workflows with a cron schedule if the repo goes too long
without any changes. It appears to disable all triggers, not just the
schedule trigger. As a result, PRs never get tested and sit there in limbo
forever. This is a) a test to see if that is really what is causing our
PR tests to never run, and b) a fix for the issue.

The fix is to split testing into two separate actions, one for scheduled
tests and one for all other tests. Both call the run-tests workflow.
  • Loading branch information
darrylmelander committed Jan 2, 2024
1 parent 31ac9f5 commit ef95e18
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
name: GitHub CI
name: Run Tests

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
# nightly tests at 8:00 UTC
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
types: run-test
workflow_call:

defaults:
run:
Expand Down Expand Up @@ -91,3 +79,4 @@ jobs:
- name: Run Prescient Simulator Tests
run: |
pytest -v prescient/simulator/tests/test_simulator.py
18 changes: 18 additions & 0 deletions .github/workflows/test-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test Changes

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
# Allow it to be manually triggered as well
workflow_dispatch:

jobs:
call-run-tests:
uses: ./.github/workflows/run-tests.yml

10 changes: 10 additions & 0 deletions .github/workflows/weekly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Weekly Tests

on:
schedule:
- cron: 58 7 * * 0

jobs:
call-run-tests:
uses: ./.github/workflows/run-tests.yml

0 comments on commit ef95e18

Please sign in to comment.