Restructure CI to support multiple clouds #45
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: Single node test | |
on: | |
# Allow manual execution on any branch | |
workflow_dispatch: | |
inputs: | |
target-cloud: | |
description: >- | |
The cloud to target for the run. | |
Leave blank to use the default cloud. | |
type: choice | |
options: | |
- "" | |
- arcus | |
- leafcloud | |
# Execute by default on pull requests to the devel branch | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- ready_for_review | |
- reopened | |
branches: | |
- devel | |
paths-ignore: | |
- 'docs/**' | |
jobs: | |
# This job exists so that PRs from outside the main repo are rejected | |
fail_on_remote: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Code under test must be from a branch in the azimuth-config repo | |
run: exit ${{ github.repository == 'stackhpc/azimuth-config' && '0' || '1' }} | |
# We want jobs to wait in a queue for a slot to run, so as not to overload the test infra | |
# GitHub concurrency _almost_ does this, except the queue length is one :-( | |
# There is a feature request for what we need https://github.com/orgs/community/discussions/12835 | |
# Until that is implemented, the only other viable option is a busy wait | |
wait_in_queue: | |
needs: [fail_on_remote] | |
if: ${{ github.event_name == 'workflow_dispatch' || !github.event.pull_request.draft }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Wait for an available slot | |
uses: stackhpc/github-actions/workflow-concurrency@master | |
with: | |
max-concurrency: 1 | |
run_azimuth_tests: | |
needs: [wait_in_queue] | |
runs-on: ubuntu-latest | |
steps: | |
# We need to check out the code under test first in order to use local actions | |
- name: Checkout code under test | |
uses: actions/checkout@v3 | |
- name: Set up Azimuth environment | |
uses: ./.github/actions/setup | |
with: | |
os-clouds: ${{ secrets.OS_CLOUDS }} | |
repository: ${{ github.repository }} | |
ref: ${{ github.ref }} | |
target-cloud: ${{ inputs.target-cloud || env.TARGET_CLOUD }} | |
- name: Provision Azimuth | |
uses: ./.github/actions/provision | |
- name: Run Azimuth tests | |
uses: ./.github/actions/test | |
- name: Destroy Azimuth | |
uses: ./.github/actions/destroy | |
if: ${{ always() }} |