Skip to content

Commit

Permalink
Cleanup canary
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Mar 6, 2025
1 parent 5957cee commit 05c3ece
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 171 deletions.
23 changes: 23 additions & 0 deletions .github/actions/dev-tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Dev-tools install"

description: "This action installs dev-tools, with caching."

runs:
using: composite
steps:
- name: Environment setup
shell: bash
run: |
echo "GO_VERSION=$(go version) >> "$GITHUB_ENV"
echo "UNAME=$(uname)" >> "$GITHB_ENV"
- name: Enable cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache
with:
path: ~/go/bin
key: dev-tools-${{ env.UNAME }}-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }}
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install dev tools
shell: bash
continue-on-error: false
run: make install-dev-tools
35 changes: 35 additions & 0 deletions .github/actions/install-go/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Go install"

description: "This action installs go, with caching.
By default, the latest stable release is used.
You can also pass an explicit version:
- `1.23` will install the latest stable patch release for that branch
- `1.22.2` will install that specific version
- `canary` will install the latest alpha/beta/RC"

inputs:
version:
default: ""
description: ""

runs:
using: composite
steps:
- name: Environment setup
shell: bash
run: |
export GO_VERSION=${{ inputs.version }}
echo "GO_VERSION=$(make install-go-resolve-version)" >> "$GITHUB_ENV"
echo "PATH=/opt/go/bin:$HOME/go/bin:$PATH" >> "$GITHUB_ENV"
echo "UNAME=$(uname)" >> "$GITHB_ENV"
- name: Enable cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache
with:
path: /opt/go
key: golang-${{ env.UNAME }}-${{ env.GO_VERSION }}
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install go
shell: bash
continue-on-error: false
run: GO_INSTALL_DESTINATION=/opt make install-go
64 changes: 15 additions & 49 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,22 @@ env:
GO_VERSION: 1.24
GOTOOLCHAIN: local
GO_INSTALL_DESTINATION: /opt
GOOS: linux

jobs:
go_current:
timeout-minutes: 5
name: "go stable"
runs-on: ubuntu-24.04
steps:
# First, setup: clone, install go (with cache), install dev tools (with cache)
# Clone
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 100
- name: Environment setup
run: |
echo "GO_VERSION=$(make install-go-resolve-version)" >> "$GITHUB_ENV"
echo "PATH=$GO_INSTALL_DESTINATION/go/bin:$HOME/go/bin:$PATH" >> "$GITHUB_ENV"
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache-go
with:
path: /opt/go
key: golang-${{ env.GO_VERSION }}
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache-go-dev
with:
path: ~/go/bin
key: golang-dev-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }}
- if: ${{ steps.cache-go.outputs.cache-hit != 'true' }}
name: Install go
continue-on-error: false
run: make install-go
- if: ${{ steps.cache-go-dev.outputs.cache-hit != 'true' }}
name: Install dev tools
continue-on-error: false
run: make install-dev-tools
# Install go
- name: "Install go"
uses: ./.github/actions/install-go
# Install dev-tools
- name: "Install dev-tools"
uses: ./.github/actions/dev-tools

- name: imports
run: make lint-imports
Expand All @@ -63,29 +46,14 @@ jobs:
env:
GO_VERSION: canary
steps:
# Clone
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: Environment setup
run: |
echo "GO_VERSION=$(make install-go-resolve-version)" >> "$GITHUB_ENV"
echo "PATH=$GO_INSTALL_DESTINATION/go/bin:$HOME/go/bin:$PATH" >> "$GITHUB_ENV"
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache-go
with:
path: /opt/go
key: golang-${{ env.GO_VERSION }}
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache-go-dev
with:
path: ~/go/bin
key: golang-dev-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }}
- if: ${{ steps.cache-go.outputs.cache-hit != 'true' }}
name: Install go
run: make install-go
- if: ${{ steps.cache-go-dev.outputs.cache-hit != 'true' }}
name: Install dev tools
run: make install-dev-tools
# Install go
- name: "Install go"
uses: ./.github/actions/install-go
# Install dev-tools
- name: "Install dev-tools"
uses: ./.github/actions/dev-tools

- name: imports
run: make lint-imports
Expand All @@ -100,8 +68,6 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: make lint-yaml
run: make lint-yaml
- name: make lint-shell
Expand Down
89 changes: 51 additions & 38 deletions .github/workflows/test-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ on:
- '**.md'

env:
UBUNTU_VERSION: "24.04"
GO_VERSION: canary
GOTOOLCHAIN: local
GO_INSTALL_DESTINATION: /opt
GOOS: linux
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
linux:
runs-on: "ubuntu-24.04"
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Prepare integration test environment"
- name: "Setup environment"
run: |
# Get latest canary go version
export GO_VERSION=$(make install-go-resolve-version)
# Build integration image with updated dependencies
. ./hack/build-integration-canary.sh
canary::build::integration
LOG_LEVEL=info canary::build::integration
- name: "Remove snap loopback devices (conflicts with our loopback devices in TestRunDevice)"
run: |
sudo systemctl disable --now snapd.service snapd.socket
Expand All @@ -41,6 +45,7 @@ jobs:
docker run --privileged --rm tonistiigi/binfmt --install linux/amd64
docker run --privileged --rm tonistiigi/binfmt --install linux/arm64
docker run --privileged --rm tonistiigi/binfmt --install linux/arm/v7
- name: "Run unit tests"
run: go test -v ./pkg/...
- name: "Run integration tests"
Expand All @@ -50,48 +55,56 @@ jobs:

windows:
timeout-minutes: 40
runs-on: windows-latest
runs-on: windows-2022
env:
GOOS: windows
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Clone"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Setup go environment"
run: |
echo "GO_VERSION=$(make install-go-resolve-version)" >> "$GITHUB_ENV"
echo "PATH=$GO_INSTALL_DESTINATION/go/bin:$HOME/go/bin:$PATH" >> "$GITHUB_ENV"
- name: "Cache go"
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache-go
with:
path: /opt/go
key: golang-${{ env.GOOS }}-${{ env.GO_VERSION }}
- if: ${{ steps.cache-go.outputs.cache-hit != 'true' }}
name: "Setup go"
continue-on-error: false
run: make install-go
- name: "Cache dev-tools"
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache-go-dev
with:
fetch-depth: 1
- name: Set GO env
path: ~/go/bin
key: golang-dev-${{ env.GOOS }}-${{ env.GO_VERSION }}-${{ hashFiles('Makefile') }}
- if: ${{ steps.cache-go-dev.outputs.cache-hit != 'true' }}
name: "Setup dev tools"
continue-on-error: false
run: make install-dev-tools
- name: "Setup CNI & containerd"
run: |
# Get latest containerd
# CNI install script has not been modified in 3+ years.
# There is little to no reason to update this to latest containerd
curl -fsSLO https://raw.githubusercontent.com/containerd/containerd/refs/tags/v1.7.25/script/setup/install-cni-windows
GOPATH=$(go env GOPATH) ./install-cni-windows
# Setup nerdctl
go install ./cmd/nerdctl
# Get latest tagged containerd
args=(curl --proto '=https' --tlsv1.2 -fsSL -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28")
[ "${GITHUB_TOKEN:-}" == "" ] && {
>&2 printf "GITHUB_TOKEN is not set - you might face rate limitations with the Github API\n"
echo "GITHUB_TOKEN is not set - you might face rate limitations with the Github API"
} || args+=(-H "Authorization: Bearer $GITHUB_TOKEN")
ctd_v="$("${args[@]}" https://api.github.com/repos/containerd/containerd/tags | jq -rc .[0].name)"
echo "CONTAINERD_VERSION=${ctd_v:1}" >> "$GITHUB_ENV"
. ./hack/build-integration-canary.sh
canary::golang::latest
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- run: go install ./cmd/nerdctl
- run: make install-dev-tools
# This here is solely to get the cni install script, which has not been modified in 3+ years.
# There is little to no reason to update this to latest containerd
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: containerd/containerd
ref: "v1.7.25"
path: containerd
fetch-depth: 1
- name: "Set up CNI"
working-directory: containerd
run: GOPATH=$(go env GOPATH) script/setup/install-cni-windows
# Windows setup script can only use released versions
- name: "Set up containerd"
env:
ctrdVersion: ${{ env.CONTAINERD_VERSION }}
run: powershell hack/configure-windows-ci.ps1
ctrdVersion="${ctd_v:1}" powershell hack/configure-windows-ci.ps1
- name: "Run unit tests"
run: go test -v ./pkg/...
- name: "Run integration tests"
run: ./hack/test-integration.sh -test.only-flaky=false
- name: "Run integration tests (flaky)"
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ on:

jobs:
linux:
runs-on: "ubuntu-24.04"
runs-on: ubuntu-24.04
timeout-minutes: 40
env:
ROOTFUL: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Run Kubernetes integration tests"
# See https://github.com/containerd/nerdctl/blob/main/docs/testing/README.md#about-parallelization
run: |
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
ARCH: "${{ matrix.arch }}"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Expose GitHub Runtime variables for gha"
uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4 # v3.0.0
- name: "Build dependencies for the integration test environment image"
Expand Down Expand Up @@ -72,8 +70,6 @@ jobs:
goos: linux
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -119,8 +115,6 @@ jobs:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Expose GitHub Runtime variables for gha"
uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4 # v3.0.0
- name: "Prepare integration test environment"
Expand Down Expand Up @@ -168,8 +162,6 @@ jobs:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
Expand Down Expand Up @@ -267,8 +259,6 @@ jobs:
EOT
sudo systemctl restart apparmor.service
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Register QEMU (tonistiigi/binfmt)"
run: |
# `--install all` will only install emulation for architectures that cannot be natively executed
Expand Down Expand Up @@ -310,8 +300,6 @@ jobs:
go-version: ["1.23.x", "1.24.x"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ${{ matrix.go-version }}
Expand All @@ -325,8 +313,6 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -361,8 +347,6 @@ jobs:
shell: bash
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -394,8 +378,6 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: /root/.vagrant.d
Expand Down
Loading

0 comments on commit 05c3ece

Please sign in to comment.