-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (92 loc) · 3.07 KB
/
test_spawn_terminate.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Test action to spawn/terminate backend instance
name: Test Spawn-Terminate
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
action-start:
name: GitHub Actions Test (spawn)
runs-on: ubuntu-latest
strategy:
matrix:
provider: [ aws, hyperstack ]
fail-fast: false
outputs:
runner-aws: ${{ steps.gen-output.outputs.runner_aws }}
runner-hyperstack: ${{ steps.gen-output.outputs.runner_hyperstack }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
- name: Test start instance
id: test-start
uses: ./
with:
mode: start
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }}
job-secret: ${{ secrets.JOB_SECRET }}
backend: ${{ matrix.provider }}
profile: ci-test
- name: Generate output
id: gen-output
run: |
echo "runner_${{ matrix.provider }}=${{ steps.test-start.outputs.label }}" >> "${GITHUB_OUTPUT}"
test-runner-alive-aws:
name: Test runner is alive (AWS)
needs: [ action-start ]
uses: ./.github/workflows/registered_runner.yml
with:
runner-name: ${{ needs.action-start.outputs.runner-aws }}
test-runner-alive-hyperstack:
name: Test runner is alive (Hyperstack)
needs: [ action-start ]
uses: ./.github/workflows/registered_runner.yml
with:
runner-name: ${{ needs.action-start.outputs.runner-hyperstack }}
action-stop:
name: GitHub Actions Test (terminate)
runs-on: ubuntu-latest
needs: [ action-start, test-runner-alive-aws, test-runner-alive-hyperstack ]
if: ${{ always() && needs.action-start.result != 'skipped' }}
strategy:
matrix:
runner: [ "${{ needs.action-start.outputs.runner-aws }}",
"${{ needs.action-start.outputs.runner-hyperstack }}" ]
fail-fast: false
steps:
- name: Checkout
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
- name: Test stop instance
id: test-stop
uses: ./
with:
mode: stop
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }}
job-secret: ${{ secrets.JOB_SECRET }}
label: ${{ matrix.runner }}
test-runner-removed-aws:
name: Test runner is removed (AWS)
needs: [ action-start, action-stop ]
uses: ./.github/workflows/removed_runner.yml
with:
runner-name: ${{ needs.action-start.outputs.runner-aws }}
must-exist: false
secrets:
READ_REPO_TOKEN: ${{ secrets.SLAB_ACTION_TOKEN }}
test-runner-removed-hyperstack:
name: Test runner is removed (Hyperstack)
needs: [ action-start, action-stop ]
uses: ./.github/workflows/removed_runner.yml
with:
runner-name: ${{ needs.action-start.outputs.runner-hyperstack }}
must-exist: false
secrets:
READ_REPO_TOKEN: ${{ secrets.SLAB_ACTION_TOKEN }}