|
23 | 23 | GO_VERSION: '1.21.12' |
24 | 24 |
|
25 | 25 | jobs: |
| 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 | + strategy: |
| 39 | + matrix: |
| 40 | + # We're using a matrix with a single entry so that we can define some config as YAML rather than |
| 41 | + # having to write escaped json in a string. |
| 42 | + include: |
| 43 | + - use-codebuild: ${{ github.repository_owner == 'awslabs' }} |
| 44 | + runs-on-names-cb: [ubuntu-x86, al2-arm] |
| 45 | + runs-on-names-gh: [ubuntu] |
| 46 | + runner-labels: |
| 47 | + ubuntu: ubuntu-22.04 |
| 48 | + ubuntu-x86: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large" |
| 49 | + al2-arm: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large" |
| 50 | + outputs: |
| 51 | + available-runners: ${{ matrix.use-codebuild && toJSON(matrix.runs-on-names-cb) || toJSON(matrix.runs-on-names-gh) }} |
| 52 | + runner-labels: ${{ toJSON(matrix.runner-labels) }} |
| 53 | + steps: |
| 54 | + - name: Dump Config |
| 55 | + run: echo '${{ toJSON(matrix) }}' |
| 56 | + |
26 | 57 | test: |
27 | | - runs-on: ubuntu-20.04 |
| 58 | + needs: setup |
| 59 | + runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + os: ${{ fromJSON(needs.setup.outputs.available-runners) }} |
28 | 63 | timeout-minutes: 15 |
29 | 64 | steps: |
30 | 65 | - uses: actions/checkout@v4 |
31 | 66 | - uses: actions/setup-go@v5 |
32 | 67 | with: |
33 | 68 | go-version: ${{ env.GO_VERSION }} |
| 69 | + - name: Install zlib static on AL2 ARM instances |
| 70 | + if: matrix.os == 'al2-arm' |
| 71 | + run: dnf install zlib-static.aarch64 -y |
34 | 72 | - run: make |
35 | 73 | - run: make test |
| 74 | + |
36 | 75 | integration: |
37 | | - runs-on: ubuntu-20.04 |
| 76 | + needs: setup |
| 77 | + runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} |
38 | 78 | timeout-minutes: 40 |
39 | 79 | strategy: |
40 | 80 | fail-fast: false |
41 | 81 | matrix: |
42 | | - containerd: ["1.6.33", "1.7.18", "2.0.0-rc.3"] |
| 82 | + os: ${{ fromJSON(needs.setup.outputs.available-runners) }} |
| 83 | + containerd: ["1.6.33", "1.7.18"] |
43 | 84 | env: |
44 | 85 | DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}" |
45 | 86 | steps: |
46 | 87 | - uses: actions/checkout@v4 |
47 | 88 | - uses: actions/setup-go@v5 |
48 | 89 | with: |
49 | 90 | go-version: ${{ env.GO_VERSION }} |
| 91 | + - name: Install zlib static on AL2 ARM instances |
| 92 | + if: matrix.os == 'al2-arm' |
| 93 | + run: dnf install zlib-static.aarch64 -y |
50 | 94 | - run: make integration |
0 commit comments