-
Notifications
You must be signed in to change notification settings - Fork 55
94 lines (89 loc) · 3.31 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Build
on:
push:
branches: ['main', 'release/**']
paths:
- '**'
- '!docs/**' # ignore docs changes
- '!**.md' # ignore markdown changes
pull_request:
branches: ['main', 'release/**']
paths:
- '.github/workflows/build.yml'
- '**.go'
- 'go.*'
- 'cmd/go.*'
- 'Makefile'
- 'Dockerfile'
- 'integration/**'
- 'scripts/**'
env:
GO_VERSION: '1.22.6'
jobs:
setup:
# This job sets up the runners to be used in the matrix for the build workflow.
# It provides a list of available runners with stable, human-friendly names and a mapping
# from those names to the actual `runs-on` value for each runner type. This allows us to
# use codebuild-hosted runners for awslabs/soci-snapshotter without requiring forks to also
# have codebuild-hosted runners.
#
# If you want to use codebuild runners for your personal fork, follow the instructions to set
# up a codebuild project. https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html
# Then, replace 'soci-snapshotter-instance' with the name of the project you created.
name: Setup Build Matrix
runs-on: ubuntu-latest
strategy:
matrix:
# We're using a matrix with a single entry so that we can define some config as YAML rather than
# having to write escaped json in a string.
include:
- use-codebuild: ${{ github.repository_owner == 'awslabs' }}
runs-on-names-cb: [ubuntu-x86, al2-arm]
runs-on-names-gh: [ubuntu]
runner-labels:
ubuntu: ubuntu-22.04
ubuntu-x86: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large"
al2-arm: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large"
outputs:
available-runners: ${{ matrix.use-codebuild && toJSON(matrix.runs-on-names-cb) || toJSON(matrix.runs-on-names-gh) }}
runner-labels: ${{ toJSON(matrix.runner-labels) }}
steps:
- name: Dump Config
run: echo '${{ toJSON(matrix) }}'
test:
needs: setup
runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
strategy:
matrix:
os: ${{ fromJSON(needs.setup.outputs.available-runners) }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install zlib static on AL2 ARM instances
if: matrix.os == 'al2-arm'
run: dnf install zlib-static.aarch64 -y
- run: make
- run: make test
integration:
needs: setup
runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(needs.setup.outputs.available-runners) }}
containerd: ["1.6.34", "1.7.20", "2.0.0-rc.3"]
env:
DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install zlib static on AL2 ARM instances
if: matrix.os == 'al2-arm'
run: dnf install zlib-static.aarch64 -y
- run: make integration