From e11b6b3bc7513ebdc6896337c3710d5562a660a0 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Thu, 6 Jun 2024 08:07:31 -0400 Subject: [PATCH] GitHub provided runner fallback. Use GitHub provided runners when jetstream2 is not available. --- .github/workflows/build_and_test.yaml | 6 +++++- .github/workflows/tests_new.yaml | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index a3eda9d27d..9a3e071c6a 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -9,6 +9,10 @@ on: container_prefix: type: string required: true + build_runner: + type: string + required: true + default: ubuntu-latest test_runner: type: string required: true @@ -39,7 +43,7 @@ env: jobs: build: - runs-on: [self-hosted,jetstream2,CPU] + runs-on: ${{ fromJson(inputs.build_runner) }} container: image: glotzerlab/ci:2024.06.04-${{ inputs.container_prefix }} diff --git a/.github/workflows/tests_new.yaml b/.github/workflows/tests_new.yaml index 78c4be65e4..2cc39b6438 100644 --- a/.github/workflows/tests_new.yaml +++ b/.github/workflows/tests_new.yaml @@ -16,8 +16,8 @@ on: jobs: start_action_runners: - name: Start action runners - uses: glotzerlab/jetstream2-admin/.github/workflows/start.yaml@c5d1d59b0b3e069b611f4002bbba4d5ff8e01c60 + name: Start + uses: glotzerlab/jetstream2-admin/.github/workflows/start.yaml@a862161adac42e4173f3d142ebd4ddfcde54779b secrets: inherit typical: @@ -27,6 +27,8 @@ jobs: with: config: ${{ join(matrix.config, '_') }} container_prefix: ${{ matrix.config[0] }} + # Use self-hosted runners or fall back to GitHub hosted runners when self-hosted are offline + build_runner: ${{ needs.start_action_runners.outputs.active == '0' && 'ubuntu-latest') || '["self-hosted","jetstream2","CPU"]' }} # Default to ubuntu-latest when unset test_runner: ${{ matrix.test_runner == '' && 'ubuntu-latest' || toJson(matrix.test_runner) }} test_docker_options: ${{ matrix.test_docker_options }} @@ -73,16 +75,14 @@ jobs: with: config: ${{ join(matrix.config, '_') }} container_prefix: ${{ matrix.config[0] }} + # Use self-hosted runners or fall back to GitHub hosted runners when self-hosted are offline + build_runner: ${{ needs.start_action_runners.outputs.active == '0' && 'ubuntu-latest') || '["self-hosted","jetstream2","CPU"]' }} # Default to ubuntu-latest when unset test_runner: ${{ matrix.test_runner == '' && 'ubuntu-latest' || toJson(matrix.test_runner) }} test_docker_options: ${{ matrix.test_docker_options }} # Default to false when unset validate: ${{ matrix.validate == '' && 'false' || matrix.validate }} - # TODO: possible to implelemtn fallback to `ubuntu-latest` when actions runners are offline? - - # runs-on: ${{ needs.start_workflow.outputs.exit_code == 3 && 'ubuntu-20.04' || 'ubuntu-24.04' }} - strategy: fail-fast: false matrix: