Merge pull request #348 from jay-mckay/main #588
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- 'release/**' | |
pull_request: | |
branches: | |
- main | |
- 'release/**' | |
jobs: | |
# | |
# Project checks | |
# | |
project: | |
name: Project Checks | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
# | |
# Checkout repos | |
# | |
- name: Checkout cgroups | |
uses: actions/checkout@v4 | |
with: | |
path: src/github.com/containerd/cgroups | |
fetch-depth: 25 | |
# | |
# Install Go | |
# | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.x' | |
cache-dependency-path: src/github.com/containerd/cgroups | |
- name: Project checks | |
uses: containerd/[email protected] | |
with: | |
working-directory: src/github.com/containerd/cgroups | |
lint: | |
name: Lint | |
timeout-minutes: 10 | |
needs: [project] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [1.22.x, 1.23.x] | |
steps: | |
- name: Checkout cgroups | |
uses: actions/checkout@v4 | |
with: | |
path: src/github.com/containerd/cgroups | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: src/github.com/containerd/cgroups | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.62.0 | |
args: --verbose | |
working-directory: src/github.com/containerd/cgroups | |
cgroupV1: | |
name: Cgroup V1 tests | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 15 | |
needs: [project] | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: [1.22.x, 1.23.x] | |
env: | |
BOX: almalinux/8 | |
GO_VERSION: ${{ matrix.go-version }} | |
steps: | |
- name: Show the host info | |
run: | | |
set -x | |
uname -a | |
cat /etc/os-release | |
cat /proc/cpuinfo | |
free -mt | |
- name: Checkout cgroups | |
uses: actions/checkout@v4 | |
with: | |
path: src/github.com/containerd/cgroups | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set Go version | |
run: | | |
go_version=$(go version | grep -oP 'go\d+\.\d+\.\d+' | sed -E 's/go([0-9]+)\.([0-9]+)\.([0-9]+)/\1\.\2\.\3/') | |
echo "GO_VERSION=$go_version" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: /root/.vagrant.d | |
key: vagrant-${{ env.BOX }} | |
- name: Set up vagrant | |
run: | | |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | |
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources | |
sudo apt-get update | |
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant ovmf | |
# https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1725#issuecomment-1454058646 | |
sudo cp /usr/share/OVMF/OVMF_VARS_4M.fd /var/lib/libvirt/qemu/nvram/ | |
sudo systemctl enable --now libvirtd | |
sudo apt-get build-dep -y ruby-libvirt | |
sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev | |
if ! vagrant plugin list | grep -q vagrant-libvirt; then | |
sudo env VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 vagrant plugin install vagrant-libvirt | |
fi | |
- name: Boot VM | |
working-directory: src/github.com/containerd/cgroups | |
run: sudo BOX=$BOX GO_VERSION=$GO_VERSION vagrant up --provision-with=install-packages,setup-etc-environment,install-golang,setup-gopath | |
- name: Run cgroup tests | |
working-directory: src/github.com/containerd/cgroups | |
run: sudo BOX=$BOX GO_VERSION=$GO_VERSION vagrant up --provision-with=test | |
- name: Build cgctl | |
working-directory: src/github.com/containerd/cgroups | |
run: sudo BOX=$BOX GO_VERSION=$GO_VERSION vagrant up --provision-with=build-cgctl | |
cgroupV2: | |
name: Cgroup V2 tests | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 15 | |
needs: [project] | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: [1.22.x, 1.23.x] | |
steps: | |
- name: Checkout cgroups | |
uses: actions/checkout@v4 | |
with: | |
path: src/github.com/containerd/cgroups | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Run cgroup tests | |
run: | | |
$(command -v go) test -exec sudo -v -race -coverprofile=coverage.txt -covermode=atomic ./... | |
working-directory: src/github.com/containerd/cgroups | |
- name: Build cgctl | |
run: make all | |
working-directory: src/github.com/containerd/cgroups | |
proto: | |
name: Compare auto-generated Go files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout cgroups | |
uses: actions/checkout@v4 | |
with: | |
path: src/github.com/containerd/cgroups | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.x' | |
cache-dependency-path: src/github.com/containerd/cgroups | |
- name: Set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- name: Install protoc | |
run: | | |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.5/protoc-21.5-linux-x86_64.zip | |
# /usr/local is not writable from GitHub Actions' user | |
sudo unzip protoc-21.5-linux-x86_64.zip -d /usr/local | |
- name: Install proto-related tools for Go | |
run: | | |
go install google.golang.org/protobuf/cmd/[email protected] | |
go install github.com/containerd/[email protected] | |
go install github.com/containerd/protobuild/cmd/[email protected] | |
- name: Compare auto-generated Go files | |
run: | | |
make proto | |
git diff --exit-code | |
working-directory: src/github.com/containerd/cgroups |