@@ -23,62 +23,101 @@ env:
23
23
GO_VERSION : ' 1.21.10'
24
24
25
25
jobs :
26
- test-on-codebuild :
27
- if : github.repository == 'awslabs/soci-snapshotter'
28
- runs-on : codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }}
26
+ setup :
27
+ # This job sets up the runners to be used in the matrix for the build workflow.
28
+ # It provides a list of available runners with stable, human-friendly names and a mapping
29
+ # from those names to the actual `runs-on` value for each runner type. This allows us to
30
+ # use codebuild-hosted runners for awslabs/soci-snapshotter without requiring forks to also
31
+ # have codebuild-hosted runners.
32
+ #
33
+ # If you want to use codebuild runners for your personal fork, follow the instructions to set
34
+ # up a codebuild project. https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html
35
+ # Then, replace 'soci-snapshotter-instance' with the name of the project you created.
36
+ name : Setup Build Matrix
37
+ runs-on : ubuntu-latest
38
+ if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'awslabs/soci-snapshotter'
29
39
strategy :
30
40
matrix :
31
- os : [arm-3.0-large]
32
- timeout-minutes : 15
41
+ # We're using a matrix with a single entry so that we can define some config as YAML rather than
42
+ # having to write escaped json in a string.
43
+ include :
44
+ - use-codebuild : ${{ github.repository_owner == 'coderbirju' }}
45
+ runs-on-names-cb : [ ubuntu-x86, al2-arm ]
46
+ runs-on-names : [ ubuntu ]
47
+ runner-labels :
48
+ ubuntu : ubuntu-22.04
49
+ ubuntu-x86 : " codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge"
50
+ al2-arm : " codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large"
51
+ outputs :
52
+ available-runners : ${{ matrix.use-codebuild && toJSON(matrix.runs-on-names-cb) || toJSON(matrix.runs-on-names) }}
53
+ runner-labels : ${{ toJSON(matrix.runner-labels) }}
33
54
steps :
34
- - uses : actions/checkout@v4
35
- - uses : actions/setup-go@v5
36
- with :
37
- go-version : ${{ env.GO_VERSION }}
38
- - run : make
39
- - run : make test
55
+ - name : Dump Config
56
+ run : echo '${{ toJSON(matrix) }}'
40
57
41
- test-on-fork :
42
- if : github.repository != 'awslabs/soci-snapshotter'
43
- runs-on : codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }}
58
+
59
+ test :
60
+ needs : setup
61
+ runs-on : ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
44
62
strategy :
45
63
matrix :
46
- os : [arm-3.0-large]
64
+ os : ${{ fromJSON(needs.setup.outputs.available-runners) }}
47
65
timeout-minutes : 15
48
66
steps :
49
67
- uses : actions/checkout@v4
50
68
- uses : actions/setup-go@v5
51
69
with :
52
70
go-version : ${{ env.GO_VERSION }}
53
- - run : dnf list --installed
54
- - run : dnf install zlib-static.aarch64 -y
71
+ - name : Install zlib static on AL2
72
+ if : matrix.os == 'al2-arm'
73
+ run : dnf install zlib-static.aarch64 -y
55
74
- run : make
56
75
- run : make test
57
76
58
- integration-on-codebuild :
59
- if : github.repository == 'awslabs/soci-snapshotter'
60
- runs-on : codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge
61
- timeout-minutes : 40
62
- strategy :
63
- fail-fast : false
64
- matrix :
65
- containerd : ["1.6.30", "1.7.14"]
66
- env :
67
- DOCKER_BUILD_ARGS : " CONTAINERD_VERSION=${{ matrix.containerd }}"
68
- steps :
69
- - uses : actions/checkout@v4
70
- - uses : actions/setup-go@v5
71
- with :
72
- go-version : ${{ env.GO_VERSION }}
73
- - run : make integration
74
77
75
- integration-on-fork :
76
- if : github.repository != 'awslabs/soci-snapshotter'
77
- runs-on : codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge
78
+ # test-on-codebuild:
79
+ # if: github.repository == 'awslabs/soci-snapshotter'
80
+ # runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }}
81
+ # strategy:
82
+ # matrix:
83
+ # os: [arm-3.0-large, ubuntu-7.0-xlarge]
84
+ # timeout-minutes: 15
85
+ # steps:
86
+ # - uses: actions/checkout@v4
87
+ # - uses: actions/setup-go@v5
88
+ # with:
89
+ # go-version: ${{ env.GO_VERSION }}
90
+ # - name: Install zlib static on AL2
91
+ # if: matrix.os == 'arm-3.0-large'
92
+ # run: dnf install zlib-static.aarch64 -y
93
+ # - run: make
94
+ # - run: make test
95
+
96
+ # test-on-fork:
97
+ # if: github.repository != 'awslabs/soci-snapshotter'
98
+ # runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }}
99
+ # strategy:
100
+ # matrix:
101
+ # os: [arm-3.0-large]
102
+ # timeout-minutes: 15
103
+ # steps:
104
+ # - uses: actions/checkout@v4
105
+ # - uses: actions/setup-go@v5
106
+ # with:
107
+ # go-version: ${{ env.GO_VERSION }}
108
+ # - name: Install zlib static on AL2
109
+ # if: matrix.os == 'arm-3.0-large'
110
+ # run: dnf install zlib-static.aarch64 -y
111
+ # - run: make
112
+ # - run: make test
113
+
114
+ integration :
115
+ needs : setup
116
+ runs-on : ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
78
117
timeout-minutes : 40
79
118
strategy :
80
- fail-fast : false
81
119
matrix :
120
+ os : ${{ fromJSON(needs.setup.outputs.available-runners) }}
82
121
containerd : ["1.6.30", "1.7.14"]
83
122
env :
84
123
DOCKER_BUILD_ARGS : " CONTAINERD_VERSION=${{ matrix.containerd }}"
@@ -88,3 +127,20 @@ jobs:
88
127
with :
89
128
go-version : ${{ env.GO_VERSION }}
90
129
- run : make integration
130
+
131
+ # integration-on-fork:
132
+ # if: github.repository != 'awslabs/soci-snapshotter'
133
+ # runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge
134
+ # timeout-minutes: 40
135
+ # strategy:
136
+ # fail-fast: false
137
+ # matrix:
138
+ # containerd: ["1.6.30", "1.7.14"]
139
+ # env:
140
+ # DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}"
141
+ # steps:
142
+ # - uses: actions/checkout@v4
143
+ # - uses: actions/setup-go@v5
144
+ # with:
145
+ # go-version: ${{ env.GO_VERSION }}
146
+ # - run: make integration
0 commit comments