|
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 |
| - |
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 |
| 77 | + integration: |
| 78 | + needs: setup |
| 79 | + runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} |
78 | 80 | timeout-minutes: 40
|
79 | 81 | strategy:
|
80 |
| - fail-fast: false |
81 | 82 | matrix:
|
| 83 | + os: ${{ fromJSON(needs.setup.outputs.available-runners) }} |
82 | 84 | containerd: ["1.6.30", "1.7.14"]
|
83 | 85 | env:
|
84 | 86 | DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}"
|
|
88 | 90 | with:
|
89 | 91 | go-version: ${{ env.GO_VERSION }}
|
90 | 92 | - run: make integration
|
| 93 | + |
0 commit comments