@@ -13,10 +13,36 @@ jobs:
13
13
with :
14
14
label : run-build-and-test-differential
15
15
16
- build-and-test-differential :
16
+ start-runner :
17
+ name : Start self-hosted EC2 runner
17
18
needs : prevent-no-label-execution
18
19
if : ${{ needs.prevent-no-label-execution.outputs.run == 'true' }}
19
- runs-on : [self-hosted, linux, X64]
20
+ runs-on : ubuntu-latest
21
+ outputs :
22
+ label : ${{ steps.start-ec2-runner.outputs.label }}
23
+ ec2-instance-id : ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
24
+ steps :
25
+ - name : Configure AWS credentials
26
+ uses : aws-actions/configure-aws-credentials@v2
27
+ with :
28
+ aws-access-key-id : ${{ secrets.EC2_ON_DEMAND_AWS_ACCESS_KEY_ID_COMMON }}
29
+ aws-secret-access-key : ${{ secrets.EC2_ON_DEMAND_AWS_SECRET_ACCESS_KEY_COMMON }}
30
+ aws-region : ${{ secrets.EC2_ON_DEMAND_AWS_REGION_COMMON }}
31
+ - name : Start EC2 runner
32
+ id : start-ec2-runner
33
+ uses : machulav/ec2-github-runner@v2
34
+ with :
35
+ mode : start
36
+ github-token : ${{ secrets.GH_PERSONAL_ACCESS_TOKEN_MFC }}
37
+ ec2-image-id : ami-092a175a6ad1aad7a
38
+ ec2-instance-type : c6a.xlarge
39
+ subnet-id : subnet-070b3d46464230127
40
+ security-group-id : sg-0cca5762919221f16
41
+ runner-home-dir : /home/ubuntu/actions-runner
42
+
43
+ build-and-test-differential :
44
+ needs : start-runner
45
+ runs-on : ${{ needs.start-runner.outputs.label }}
20
46
container : ${{ matrix.container }}${{ matrix.container-suffix }}
21
47
strategy :
22
48
fail-fast : false
70
96
flags : differential
71
97
72
98
clang-tidy-differential :
73
- runs-on : [self-hosted, linux, X64]
74
- container : ghcr.io/autowarefoundation/autoware-universe:humble-latest-cuda
75
99
needs : build-and-test-differential
100
+ runs-on : ${{ needs.start-runner.outputs.label }}
101
+ container : ghcr.io/autowarefoundation/autoware-universe:humble-latest-cuda
76
102
steps :
77
103
- name : Check out repository
78
104
uses : actions/checkout@v3
@@ -103,3 +129,25 @@ jobs:
103
129
target-files : ${{ steps.get-modified-files.outputs.all_changed_files }}
104
130
clang-tidy-config-url : https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
105
131
build-depends-repos : build_depends.repos
132
+
133
+ stop-runner :
134
+ name : Stop self-hosted EC2 runner
135
+ needs :
136
+ - start-runner
137
+ - clang-tidy-differential
138
+ runs-on : ubuntu-latest
139
+ if : ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
140
+ steps :
141
+ - name : Configure AWS credentials
142
+ uses : aws-actions/configure-aws-credentials@v2
143
+ with :
144
+ aws-access-key-id : ${{ secrets.EC2_ON_DEMAND_AWS_ACCESS_KEY_ID_COMMON }}
145
+ aws-secret-access-key : ${{ secrets.EC2_ON_DEMAND_AWS_SECRET_ACCESS_KEY_COMMON }}
146
+ aws-region : ${{ secrets.EC2_ON_DEMAND_AWS_REGION_COMMON }}
147
+ - name : Stop EC2 runner
148
+ uses : machulav/ec2-github-runner@v2
149
+ with :
150
+ mode : stop
151
+ github-token : ${{ secrets.GH_PERSONAL_ACCESS_TOKEN_MFC }}
152
+ label : ${{ needs.start-runner.outputs.label }}
153
+ ec2-instance-id : ${{ needs.start-runner.outputs.ec2-instance-id }}
0 commit comments