Skip to content

Commit b5bc882

Browse files
committed
Restructure GHA workflows
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
1 parent 5c06c7d commit b5bc882

17 files changed

+1016
-706
lines changed

.github/workflows/environment.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Shared environment
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
GO_OLD:
7+
description: "oldest tested golang version"
8+
value: "1.23"
9+
GO_STABLE:
10+
description: "main supported golang version"
11+
value: "1.24"
12+
GO_CANARY:
13+
description: "canary golang version"
14+
value: canary
15+
RUNNER_WINDOWS_OLD:
16+
description: "windows old runner"
17+
value: windows-2019
18+
RUNNER_WINDOWS_STABLE:
19+
description: "windows stable runner"
20+
value: windows-2022
21+
RUNNER_WINDOWS_CANARY:
22+
description: "windows canary runner"
23+
value: windows-2025
24+
RUNNER_LINUX_OLD:
25+
description: "linux old runner"
26+
value: ubuntu-22.04
27+
RUNNER_LINUX_STABLE:
28+
description: "linux stable runner"
29+
value: ubuntu-24.04
30+
RUNNER_LINUX_AMD64_STABLE:
31+
description: "linux amd64 stable runner"
32+
value: ubuntu-24.04
33+
RUNNER_LINUX_ARM64_STABLE:
34+
description: "linux arm64 stable runner"
35+
value: ubuntu-24.04-arm
36+
RUNNER_LINUX_CANARY:
37+
description: "linux canary runner"
38+
value: ubuntu-24.04
39+
RUNNER_MACOS_OLD:
40+
description: "macos old runner"
41+
value: macos-13
42+
RUNNER_MACOS_STABLE:
43+
description: "macos stable runner"
44+
value: macos-14
45+
RUNNER_MACOS_CANARY:
46+
description: "macos canary runner"
47+
value: macos-15
48+
TIMEOUT_SHORT:
49+
description: "short timeout"
50+
value: "10"
51+
TIMEOUT_LONG:
52+
description: "long timeout"
53+
value: "40"
54+
GITHUB_TOKEN:
55+
description: "Github token"
56+
value: ""
57+
WINDOWS_CONTAINERD_VERSION:
58+
description: "containerd version for windows"
59+
value: "v2.0.4"
60+
WINDOWS_WINCNI_VERSION:
61+
description: "wincni version"
62+
value: "v0.3.1"
63+
WINDOWS_BUILDKIT_VERSION:
64+
description: "buildkit version"
65+
value: "v0.20.2"
66+
67+
jobs:
68+
blank:
69+
name: "environment"
70+
runs-on: ubuntu-24.04
71+
steps:
72+
- run: |
73+
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV"
74+
echo "Environment setup complete"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: build-dependencies
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
timeout:
7+
required: true
8+
type: number
9+
runner-for-linux:
10+
required: true
11+
type: string
12+
runner-for-linux-arm:
13+
required: true
14+
type: string
15+
containerd-version-current:
16+
required: true
17+
type: string
18+
containerd-version-old:
19+
required: true
20+
type: string
21+
22+
jobs:
23+
# This job builds the dependency target of the test docker image for all supported architectures and cache it in GHA
24+
build-dependencies:
25+
name: "dependencies | ${{ matrix.containerd }} | ${{ matrix.arch }}"
26+
timeout-minutes: ${{ inputs.timeout }}
27+
runs-on: "${{ matrix.runner }}"
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
- runner: ${{ inputs.runner-for-linux }}
33+
containerd: ${{ inputs.containerd-version-old }}
34+
arch: amd64
35+
- runner: ${{ inputs.runner-for-linux }}
36+
containerd: ${{ inputs.containerd-version-current }}
37+
arch: amd64
38+
- runner: ${{ inputs.runner-for-linux-arm }}
39+
containerd: ${{ inputs.containerd-version-current }}
40+
arch: arm64
41+
steps:
42+
- name: "Init: checkout"
43+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44+
with:
45+
fetch-depth: 1
46+
- name: "Init: expose GitHub Runtime variables for gha"
47+
uses: crazy-max/ghaction-github-runtime@3cb05d89e1f492524af3d41a1c98c83bc3025124 # v3.1.0
48+
- name: "Run: build dependencies for the integration test environment image"
49+
run: |
50+
docker buildx create --name with-gha --use
51+
docker buildx build \
52+
--cache-to type=gha,compression=zstd,mode=max,scope=test-integration-dependencies-${{ matrix.arch }} \
53+
--cache-from type=gha,scope=test-integration-dependencies-${{ matrix.arch }} \
54+
--target build-dependencies --build-arg CONTAINERD_VERSION=${{ matrix.containerd }} .

.github/workflows/job-build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This job just builds nerdctl for the golang versions we support (as a smoke test)
2+
name: build
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
timeout:
8+
required: true
9+
type: number
10+
go-version-stable:
11+
required: true
12+
type: string
13+
go-version-old:
14+
required: true
15+
type: string
16+
runner:
17+
required: true
18+
type: string
19+
20+
jobs:
21+
build:
22+
name: ${{ format('go {0}', matrix.canary && 'canary' || matrix.go ) }}
23+
timeout-minutes: ${{ inputs.timeout }}
24+
runs-on: "${{ matrix.runner }}"
25+
defaults:
26+
run:
27+
shell: bash
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
go: ["${{ inputs.go-version-old }}", "${{ inputs.go-version-stable }}"]
33+
canary: false
34+
includes:
35+
go: ${{ inputs.go-version }}
36+
canary: true
37+
38+
env:
39+
GO_VERSION: ${{ matrix.go }}
40+
41+
steps:
42+
- name: "Init: checkout"
43+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44+
with:
45+
fetch-depth: 1
46+
47+
- if: ${{ matrix.canary == true }}
48+
name: "Init: retrieve canary GO_VERSION"
49+
run: |
50+
. ./hack/github/golang.sh
51+
printf "GO_VERSION=%s\n" "$(go::canary::for::go-setup)" >> "$GITHUB_ENV"
52+
53+
- name: "Init: install go"
54+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
55+
with:
56+
go-version: ${{ env.GO_VERSION }}
57+
check-latest: true
58+
59+
- name: "Run: make binaries"
60+
run: GO_VERSION="$(echo ${{ env.GO_VERSION }} | sed -e s/.x//)" make binaries

.github/workflows/job-lint-go.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: lint-go
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
timeout:
7+
required: true
8+
type: number
9+
go-version:
10+
required: true
11+
type: string
12+
runner-for-linux:
13+
required: true
14+
type: string
15+
runner-for-freebsd:
16+
required: true
17+
type: string
18+
runner-for-macos:
19+
required: true
20+
type: string
21+
runner-for-windows:
22+
required: true
23+
type: string
24+
25+
jobs:
26+
# Note: technically, `make lint-go-all` would run the linter for all targets, and could be called once, on a single instance.
27+
# The point of running it on a matrix instead, each GOOS separately, is to verify that the tooling itself is working on the target OS.
28+
lint-go:
29+
name: ${{ format('{0}{1}', matrix.goos, matrix.canary == true && ' | canary' || '') }}
30+
timeout-minutes: ${{ inputs.timeout }}
31+
runs-on: "${{ matrix.runner }}"
32+
defaults:
33+
run:
34+
shell: bash
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
include:
39+
- runner: ${{ inputs.runner-for-linux }}
40+
goos: linux
41+
- runner: ${{ inputs.runner-for-freebsd }}
42+
goos: freebsd
43+
- runner: ${{ inputs.runner-for-macos }}
44+
goos: darwin
45+
- runner: ${{ inputs.runner-for-windows }}
46+
goos: windows
47+
- runner: ${{ inputs.runner-for-linux }}
48+
goos: linux
49+
# This allows the canary script to select any upcoming golang alpha/beta/RC
50+
canary: true
51+
steps:
52+
- name: "Init: checkout"
53+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
with:
55+
fetch-depth: 1
56+
- if: ${{ matrix.canary == true }}
57+
name: "Init: retrieve canary GO_VERSION"
58+
run: |
59+
# If canary is specified, get the latest available golang pre-release instead of the major version
60+
. ./hack/build-integration-canary.sh
61+
canary::golang::latest
62+
- name: "Init: install go"
63+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
64+
with:
65+
go-version: ${{ inputs.go-version }}
66+
check-latest: true
67+
- name: "Init: install dev-tools"
68+
run: |
69+
make install-dev-tools
70+
- name: "Run"
71+
run: |
72+
NO_COLOR=true GOOS="${{ matrix.goos }}" make lint-go
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: lint-other
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
timeout:
7+
required: true
8+
type: number
9+
go-version:
10+
required: true
11+
type: string
12+
runner:
13+
required: true
14+
type: string
15+
16+
jobs:
17+
lint-other:
18+
name: "yaml | shell"
19+
timeout-minutes: ${{ inputs.timeout }}
20+
runs-on: ${{ inputs.runner }}
21+
defaults:
22+
run:
23+
shell: bash
24+
steps:
25+
- name: "Init: checkout"
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
fetch-depth: 1
29+
- name: "Init: install go"
30+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
31+
with:
32+
go-version: ${{ inputs.go-version }}
33+
check-latest: true
34+
- name: "Init: install dev-tools"
35+
run: |
36+
make install-dev-tools
37+
- name: "Run: yaml"
38+
run: make lint-yaml
39+
- name: "Run: shell"
40+
run: make lint-shell
Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
1-
name: project
1+
name: project-checks
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- 'release/**'
8-
pull_request:
9-
10-
env:
11-
GOTOOLCHAIN: local
4+
workflow_call:
5+
inputs:
6+
timeout:
7+
required: true
8+
type: number
9+
go-version:
10+
required: true
11+
type: string
12+
runner:
13+
required: true
14+
type: string
1215

1316
jobs:
1417
project:
15-
name: checks
16-
runs-on: ubuntu-24.04
17-
timeout-minutes: 20
18+
name: "commits, licenses..."
19+
timeout-minutes: ${{ inputs.timeout }}
20+
runs-on: ${{ inputs.runner }}
21+
defaults:
22+
run:
23+
shell: bash
1824
steps:
19-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- name: "Init: checkout"
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2027
with:
21-
path: src/github.com/containerd/nerdctl
2228
fetch-depth: 100
23-
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
29+
path: src/github.com/containerd/nerdctl
30+
- name: "Init: install go"
31+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
2432
with:
25-
go-version: ${{ env.GO_VERSION }}
33+
go-version: ${{ inputs.go-version }}
34+
check-latest: true
2635
cache-dependency-path: src/github.com/containerd/nerdctl
27-
- uses: containerd/project-checks@d7751f3c375b8fe4a84c02a068184ee4c1f59bc4 # v1.2.2
36+
- name: "Run"
37+
uses: containerd/project-checks@d7751f3c375b8fe4a84c02a068184ee4c1f59bc4 # v1.2.2
2838
with:
2939
working-directory: src/github.com/containerd/nerdctl
3040
repo-access-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)