11# shellcheck disable=SC1000-SC9999
2- name : Continuous Integration
2+ name : Continuous Integration Entry
33
44on :
55 pull_request :
@@ -12,115 +12,53 @@ permissions:
1212
1313jobs :
1414 test-docker :
15- name : Docker Tests
16- runs-on : ubuntu-latest
17-
18- # Run a local registry to push to
19- services :
20- registry :
21- image : registry:2
22- ports :
23- - 5001:5000
24-
25- env :
26- TEST_TAG : localhost:5001/sustainable_computing_io/aws_ec2_self_hosted_runner:latest
27-
28- steps :
29- - name : Checkout
30- id : checkout
31- uses : actions/checkout@v4
32-
33- - name : Setup Docker BuildX
34- id : setup-buildx
35- uses : docker/setup-buildx-action@v3
36- with :
37- install : true
38- driver-opts : network=host
39-
40- - name : Build the Container
41- id : build
42- uses : docker/build-push-action@v5
43- with :
44- context : .
45- push : true
46- tags : ${{ env.TEST_TAG }}
47-
48-
49- setup-runner :
50- name : GitHub Actions Test create instance
51- runs-on : ubuntu-latest
52- outputs :
53- instance_id : ${{ steps.create-runner.outputs.instance_id }}
54- runner_name : ${{ steps.create-runner.outputs.runner_name }}
55- steps :
56- - name : Checkout
57- id : checkout
58- uses : actions/checkout@v4
59-
60- - name : Test Local Action
61- id : create-runner
62- uses : ./
63- with :
64- action : " create"
65- aws_region : ${{ secrets.AWS_REGION }}
66- github_token : ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }}
67- aws_access_key_id : ${{ secrets.AWS_ACCESS_KEY_ID }}
68- aws_secret_access_key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
69- security_group_id : ${{ secrets.AWS_SECURITY_GROUP_ID }}
70- github_repo : ${{ github.repository }}
71- ami_id : " ami-0e4d0bb9670ea8db0"
72- instance_type : " t2.micro"
73- create_s3_bucket : " false"
74- spot_instance_only : " true"
75-
76- - name : Print Output
77- id : output
78- run : |
79- echo "instance_id ${{ steps.create-runner.outputs.instance_id }}"
80- echo "instance_ip ${{ steps.create-runner.outputs.instance_ip }}"
81- echo "runner_name ${{ steps.create-runner.outputs.runner_name }}"
82- echo "bucket_name ${{ steps.create-runner.outputs.bucket_name }}"
83-
84- test-runner :
85- needs : setup-runner
86- runs-on : [self-hosted, linux, x64]
87- steps :
88- - name : Checkout
89- uses : actions/checkout@v4
90-
91- - name : Run Tests
92- run : |
93- export INSTANCE_ID="${{ needs.setup-runner.outputs.instance_id }}"
94- echo "Running tests on self-hosted runner with instance ${INSTANCE_ID}"
95- uname -a # or any other command
96- cat /etc/os-release
97- cat /proc/cpuinfo
98-
99- destroy-runner :
100- if : always()
101- name : GitHub Actions Test destroy instance
102- needs : [setup-runner, test-runner]
103- runs-on : ubuntu-latest
104- steps :
105- - name : Checkout
106- id : checkout
107- uses : actions/checkout@v4
108-
109- - name : unregister runner
110- id : unregister
111- uses : ./
112- with :
113- action : " unregister"
114- runner_name : ${{ needs.setup-runner.outputs.runner_name }}
115- github_token : ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }}
116- github_repo : ${{ github.repository }}
117-
118- - name : terminate instance
119- id : terminate
120- uses : ./
121- with :
122- action : " terminate"
123- aws_access_key_id : ${{ secrets.AWS_ACCESS_KEY_ID }}
124- aws_secret_access_key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
125- instance_id : ${{ needs.setup-runner.outputs.instance_id }}
126-
15+ name : Docker Tests
16+ runs-on : ubuntu-latest
17+
18+ # Run a local registry to push to
19+ services :
20+ registry :
21+ image : registry:2
22+ ports :
23+ - 5001:5000
24+
25+ env :
26+ TEST_TAG : localhost:5001/sustainable_computing_io/aws_ec2_self_hosted_runner:latest
27+
28+ steps :
29+ - name : Checkout
30+ id : checkout
31+ uses : actions/checkout@v4
32+
33+ - name : Setup Docker BuildX
34+ id : setup-buildx
35+ uses : docker/setup-buildx-action@v3
36+ with :
37+ install : true
38+ driver-opts : network=host
39+
40+ - name : Build the Container
41+ id : build
42+ uses : docker/build-push-action@v5
43+ with :
44+ context : .
45+ push : true
46+ tags : ${{ env.TEST_TAG }}
47+
48+ unitpreOS :
49+ strategy :
50+ matrix :
51+ # us-east-2
52+ # Ubuntu 20.04 AMI is ami-0e4d0bb9670ea8db0
53+ # ubuntu 22.04 AMI is ami-05fb0b8c1424f266b
54+ # RHEL 9 AMI is ami-078cbc4c2d057c244
55+ AMI_ID : [ami-0e4d0bb9670ea8db0,ami-05fb0b8c1424f266b,ami-078cbc4c2d057c244]
56+ uses : ./.github/workflows/ci_unit.yml
57+ secrets :
58+ AWS_REGION : ${{ secrets.AWS_REGION }}
59+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
60+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
61+ GH_SELF_HOSTED_RUNNER_TOKEN : ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }}
62+ AWS_SECURITY_GROUP_ID : ${{ secrets.AWS_SECURITY_GROUP_ID }}
63+ AMI_ID : ${{matrix.AMI_ID}}
64+
0 commit comments