Skip to content

Commit 7496c6c

Browse files
authored
Merge pull request #4177 from apostasie/ci-2025-04-ci-cleanup-b4
[CI]: cleanup, breakout 4: separate jobs
2 parents 6137211 + c364ee3 commit 7496c6c

File tree

10 files changed

+306
-134
lines changed

10 files changed

+306
-134
lines changed

.github/workflows/job-build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This job just builds nerdctl for the golang versions we support (as a smoke test)
2+
name: job-build
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
timeout:
8+
required: true
9+
type: number
10+
go-version:
11+
required: true
12+
type: string
13+
runner:
14+
required: true
15+
type: string
16+
canary:
17+
required: false
18+
default: false
19+
type: boolean
20+
21+
env:
22+
GOTOOLCHAIN: local
23+
24+
jobs:
25+
build-all-targets:
26+
name: ${{ format('go {0}', inputs.canary && 'canary' || inputs.go-version ) }}
27+
timeout-minutes: ${{ inputs.timeout }}
28+
runs-on: "${{ inputs.runner }}"
29+
defaults:
30+
run:
31+
shell: bash
32+
33+
env:
34+
GO_VERSION: ${{ inputs.go-version }}
35+
36+
steps:
37+
- name: "Init: checkout"
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
with:
40+
fetch-depth: 1
41+
42+
- if: ${{ inputs.canary }}
43+
name: "Init (canary): retrieve GO_VERSION"
44+
run: |
45+
latest_go="$(. ./hack/provisioning/version/fetch.sh; go::canary::for::go-setup)"
46+
printf "GO_VERSION=%s\n" "$latest_go" >> "$GITHUB_ENV"
47+
[ "$latest_go" != "" ] || \
48+
echo "::warning title=No canary go::There is currently no canary go version to test. Steps will not run."
49+
50+
- if: ${{ env.GO_VERSION != '' }}
51+
name: "Init: install go"
52+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
53+
with:
54+
go-version: ${{ env.GO_VERSION }}
55+
check-latest: true
56+
57+
- if: ${{ env.GO_VERSION != '' }}
58+
name: "Run: make binaries"
59+
run: |
60+
# We officially support these
61+
GOOS=linux make binaries
62+
GOOS=windows make binaries
63+
GOOS=freebsd make binaries
64+
GOOS=darwin make binaries
65+
GOARCH=arm GOARM=6 make binaries
66+
# These architectures are not released, but we still verify that we can at least compile
67+
GOARCH=ppc64le make binaries
68+
GOARCH=riscv64 make binaries
69+
GOARCH=s390x make binaries

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

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This job runs golangci-lint
2+
# Note that technically, `make lint-go-all` would run the linter for all targets, and could be called once, on a single instance.
3+
# 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.
4+
name: job-lint-go
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
timeout:
10+
required: true
11+
type: number
12+
go-version:
13+
required: true
14+
type: string
15+
runner:
16+
required: true
17+
type: string
18+
canary:
19+
required: false
20+
default: false
21+
type: boolean
22+
goos:
23+
required: true
24+
type: string
25+
26+
env:
27+
GOTOOLCHAIN: local
28+
29+
jobs:
30+
lint-go:
31+
name: ${{ format('{0}{1}', inputs.goos, inputs.canary && ' (go canary)' || '') }}
32+
timeout-minutes: ${{ inputs.timeout }}
33+
runs-on: "${{ inputs.runner }}"
34+
defaults:
35+
run:
36+
shell: bash
37+
env:
38+
GO_VERSION: ${{ inputs.go-version }}
39+
40+
steps:
41+
- name: "Init: checkout"
42+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43+
with:
44+
fetch-depth: 1
45+
46+
- if: ${{ inputs.canary }}
47+
name: "Init (canary): retrieve GO_VERSION"
48+
run: |
49+
latest_go="$(. ./hack/provisioning/version/fetch.sh; go::canary::for::go-setup)"
50+
printf "GO_VERSION=%s\n" "$latest_go" >> "$GITHUB_ENV"
51+
[ "$latest_go" != "" ] || \
52+
echo "::warning title=No canary go::There is currently no canary go version to test. Steps will not run."
53+
54+
- if: ${{ env.GO_VERSION != '' }}
55+
name: "Init: install go"
56+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
57+
with:
58+
go-version: ${{ env.GO_VERSION }}
59+
check-latest: true
60+
61+
- if: ${{ env.GO_VERSION != '' }}
62+
name: "Init: install dev-tools"
63+
run: |
64+
echo "::group:: make install-dev-tools"
65+
make install-dev-tools
66+
echo "::endgroup::"
67+
68+
- if: ${{ env.GO_VERSION != '' }}
69+
name: "Run"
70+
run: |
71+
# On canary, lint for all supported targets
72+
if [ "${{ inputs.canary }}" == "true" ]; then
73+
NO_COLOR=true make lint-go-all
74+
else
75+
NO_COLOR=true GOOS="${{ inputs.goos }}" make lint-go
76+
fi

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This job runs any subsidiary linter not part of golangci (shell, yaml, etc)
2+
name: job-lint-other
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
timeout:
8+
required: true
9+
type: number
10+
runner:
11+
required: true
12+
type: string
13+
14+
env:
15+
GOTOOLCHAIN: local
16+
17+
jobs:
18+
lint-other:
19+
name: "yaml | shell"
20+
timeout-minutes: ${{ inputs.timeout }}
21+
runs-on: ${{ inputs.runner }}
22+
defaults:
23+
run:
24+
shell: bash
25+
26+
steps:
27+
- name: "Init: checkout"
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
fetch-depth: 1
31+
32+
- name: "Run: yaml"
33+
run: |
34+
make lint-yaml
35+
36+
- name: "Run: shell"
37+
run: |
38+
make lint-shell

.github/workflows/project.yml renamed to .github/workflows/job-lint-project.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,49 @@
1-
name: project
1+
# This job runs containerd shared project-checks, that verifies licenses, headers, and commits.
2+
# To run locally, you may just use `make lint` instead, that does the same thing
3+
# (albeit `make lint` uses more modern versions).
4+
name: job-lint-project
25

36
on:
4-
push:
5-
branches:
6-
- main
7-
- 'release/**'
8-
pull_request:
7+
workflow_call:
8+
inputs:
9+
timeout:
10+
required: true
11+
type: number
12+
go-version:
13+
required: true
14+
type: string
15+
runner:
16+
required: true
17+
type: string
918

1019
env:
1120
GOTOOLCHAIN: local
1221

1322
jobs:
1423
project:
15-
name: checks
16-
runs-on: ubuntu-24.04
17-
timeout-minutes: 20
24+
name: "commits, licenses..."
25+
timeout-minutes: ${{ inputs.timeout }}
26+
runs-on: ${{ inputs.runner }}
27+
defaults:
28+
run:
29+
shell: bash
30+
1831
steps:
19-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
- name: "Init: checkout"
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2034
with:
21-
path: src/github.com/containerd/nerdctl
2235
fetch-depth: 100
23-
- name: "Install go"
36+
path: src/github.com/containerd/nerdctl
37+
38+
- name: "Init: install go"
2439
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
2540
with:
26-
go-version: ${{ env.GO_VERSION }}
41+
go-version: ${{ inputs.go-version }}
2742
check-latest: true
2843
cache-dependency-path: src/github.com/containerd/nerdctl
29-
- uses: containerd/project-checks@d7751f3c375b8fe4a84c02a068184ee4c1f59bc4 # v1.2.2
44+
45+
- name: "Run"
46+
uses: containerd/project-checks@d7751f3c375b8fe4a84c02a068184ee4c1f59bc4 # v1.2.2
3047
with:
3148
working-directory: src/github.com/containerd/nerdctl
3249
repo-access-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/job-test-unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Note: freebsd tests are not ran here (see integration instead)
2-
name: test-unit
2+
name: job-test-unit
33

44
on:
55
workflow_call:

.github/workflows/lint.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.

.github/workflows/tigron.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ env:
1515
jobs:
1616
lint:
1717
timeout-minutes: 15
18-
name: "${{ matrix.goos }} ${{ matrix.os }} | go ${{ matrix.canary }}"
19-
runs-on: ${{ matrix.os }}
18+
name: "${{ matrix.goos }} ${{ matrix.runner }} | go ${{ matrix.canary }}"
19+
runs-on: ${{ matrix.runner }}
2020
defaults:
2121
run:
2222
shell: bash
2323
strategy:
2424
matrix:
2525
include:
26-
- os: ubuntu-24.04
27-
- os: macos-15
28-
- os: windows-2022
29-
- os: ubuntu-24.04
26+
- runner: ubuntu-24.04
27+
- runner: macos-15
28+
- runner: windows-2022
29+
- runner: ubuntu-24.04
3030
goos: freebsd
31-
- os: ubuntu-24.04
31+
- runner: ubuntu-24.04
3232
canary: go-canary
3333
steps:
3434
- name: "Checkout project"
@@ -58,16 +58,11 @@ jobs:
5858
brew install yamllint shellcheck
5959
fi
6060
echo "::endgroup::"
61-
- if: ${{ env.GO_VERSION != '' }}
61+
- if: ${{ env.GO_VERSION != '' && env.RUNNER_OS == 'Linux' && matrix.goos == '' }}
6262
name: "lint"
6363
env:
6464
NO_COLOR: true
6565
run: |
66-
if [ "$RUNNER_OS" != "Linux" ] || [ "${{ matrix.goos }}" != "" ]; then
67-
echo "It is not necessary to run the linter on this platform (${{ env.RUNNER_OS }} ${{ matrix.goos }})"
68-
exit
69-
fi
70-
7166
echo "::group:: lint"
7267
cd mod/tigron
7368
export LINT_COMMIT_RANGE="$(jq -r '.after + "..HEAD"' ${GITHUB_EVENT_PATH})"

0 commit comments

Comments
 (0)