-
Notifications
You must be signed in to change notification settings - Fork 7
63 lines (55 loc) · 2.14 KB
/
test-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test Azimuth deployment
on:
pull_request:
types:
- opened
- synchronize
- ready_for_review
- reopened
branches:
- main
# Use the head ref for workflow concurrency, with cancellation
# This should mean that any previous workflows for a PR get cancelled when a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
# This job exists so that PRs from outside the main repo are rejected
fail_on_remote:
runs-on: ubuntu-latest
steps:
- name: PR must be from a branch in the stackhpc/ansible-collection-azimuth-ops repo
run: exit ${{ github.repository == 'stackhpc/ansible-collection-azimuth-ops' && '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]
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:
# Check out the configuration repository
- name: Set up Azimuth environment
uses: stackhpc/azimuth-config/.github/actions/setup@main
with:
os-clouds: ${{ secrets.OS_CLOUDS }}
environment-prefix: ops-ci
azimuth-ops-version: ${{ github.event.pull_request.head.sha }}
# Provision Azimuth using the azimuth-ops version under test
- name: Provision Azimuth
uses: stackhpc/azimuth-config/.github/actions/provision@main
# # Run the tests
- name: Run Azimuth tests
uses: stackhpc/azimuth-config/.github/actions/test@main
# Tear down the environment
- name: Destroy Azimuth
uses: stackhpc/azimuth-config/.github/actions/destroy@main
if: ${{ always() }}