diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..1ca74c073 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,24 @@ +name: Test pull request + +on: + pull_request: + branches: + - main + - future + +jobs: + test_main: + if: github.base_ref == 'main' + uses: ./.github/workflows/test.yml + with: + source_ref: ${{ github.ref }} + firedrake_docker_version: dev-release + secrets: inherit + + test_future: + if: github.base_ref == 'future' + uses: ./.github/workflows/test.yml + with: + source_ref: ${{ github.ref }} + firedrake_docker_version: dev-main + secrets: inherit diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 000000000..70acf2552 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,24 @@ +name: Test push + +on: + push: + branches: + - main + - future + +jobs: + test_main: + if: github.ref_name == 'main' + uses: ./.github/workflows/test.yml + with: + source_ref: main + firedrake_docker_version: dev-release + secrets: inherit + + test_future: + if: github.ref_name == 'future' + uses: ./.github/workflows/test.yml + with: + source_ref: future + firedrake_docker_version: dev-main + secrets: inherit diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml new file mode 100644 index 000000000..cbec279a5 --- /dev/null +++ b/.github/workflows/schedule.yml @@ -0,0 +1,21 @@ +name: Weekly tests + +on: + schedule: + # Scheduled for 0330 UTC on Monday mornings to detect bitrot + - cron: '30 3 * * 1' + +jobs: + test_main: + uses: ./.github/workflows/test.yml + with: + source_ref: main + firedrake_docker_version: dev-release + secrets: inherit + + test_future: + uses: ./.github/workflows/test.yml + with: + source_ref: future + firedrake_docker_version: dev-main + secrets: inherit diff --git a/.github/workflows/build.yml b/.github/workflows/test.yml similarity index 89% rename from .github/workflows/build.yml rename to .github/workflows/test.yml index e7d5a153b..988f06b4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/test.yml @@ -1,31 +1,28 @@ -name: Build Gusto - on: - # Push to main or PR - push: - branches: - - main - pull_request: - schedule: - # * is a special character in YAML so you have to quote this string - # Scheduled build at 0330 UTC on Monday mornings to detect bitrot. - - cron: '30 3 * * 1' - + workflow_call: + inputs: + source_ref: + description: The Git ref to checkout + type: string + required: true + firedrake_docker_version: + description: The Firedrake Docker version to use ('dev-main' or 'dev-release') + type: string + required: true + +# Cancel jobs running if new commits are pushed concurrency: - # Cancels jobs running if new commits are pushed group: > ${{ github.workflow }}- ${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - build: - name: "Build Gusto" - # The type of runner that the job will run on + test: + name: Test Gusto runs-on: [self-hosted, Linux] - # The docker container to use. container: - image: firedrakeproject/firedrake-vanilla-default:latest + image: firedrakeproject/firedrake-vanilla-default:${{ inputs.firedrake_docker_version }} env: # Make Gusto output logging information, this will *not* be printed to # the terminal because pytest will capture it. Instead it is written to @@ -48,11 +45,12 @@ jobs: find . -delete firedrake-clean - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: # Download Gusto into a subdirectory not called 'gusto' to make sure # that the package installs correctly. Otherwise 'import gusto' may # work even if the installation failed because it is a subdirectory. + ref: ${{ inputs.source_ref }} path: gusto-repo - name: Create virtual environment