Files
containerd/.github/workflows/ci.yml
Derek McGowan f12e90937c Enable project checks
These checks had to be disabled to get the CRI merge completed.
Now these should be added back.
After CRI merge, more time for lint is needed on mac.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-10-12 11:37:38 -07:00

451 lines
13 KiB
YAML

name: CI
on:
push:
branches:
- master
- 'release/**'
pull_request:
branches:
- master
- 'release/**'
jobs:
#
# golangci-lint
#
linters:
name: Linters
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
go-version: [1.15.2]
os: [ubuntu-18.04, macos-10.15, windows-2019]
steps:
- uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
- uses: golangci/golangci-lint-action@v2
with:
version: v1.29
working-directory: src/github.com/containerd/containerd
args: --timeout=5m
#
# Project checks
#
project:
name: Project Checks
runs-on: ubuntu-18.04
timeout-minutes: 5
steps:
#
# Install Go
#
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.15.2'
- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
#
# Checkout repos
#
- name: Checkout this repo
uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
fetch-depth: 100
- name: Checkout project repo
uses: actions/checkout@v2
with:
repository: containerd/project
path: src/github.com/containerd/project
#
# Go get dependencies
#
- name: Install dependencies
env:
GO111MODULE: off
run: |
go get -u github.com/vbatts/git-validation
go get -u github.com/kunalkushwaha/ltag
go get -u github.com/LK4D4/vndr
#
# DCO / File headers / Vendor directory validation
#
- name: DCO
env:
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }}
DCO_VERBOSITY: "-q"
DCO_RANGE: ""
working-directory: src/github.com/containerd/containerd
run: |
set -x
if [ -z "${GITHUB_COMMIT_URL}" ]; then
DCO_RANGE=$(jq -r '.after + "..HEAD"' ${GITHUB_EVENT_PATH})
else
DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha + "..HEAD"')
fi
../project/script/validate/dco
- name: Headers
run: ../project/script/validate/fileheader ../project/
working-directory: src/github.com/containerd/containerd
- name: Vendor
run: ../project/script/validate/vendor
working-directory: src/github.com/containerd/containerd
#
# Protobuf checks
#
protos:
name: Protobuf
runs-on: ubuntu-18.04
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.15.2'
- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
- name: Checkout
uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
- name: Install protobuf
env:
GO111MODULE: off
working-directory: src/github.com/containerd/containerd
run: |
sudo env PATH=$PATH GOPATH=$GOPATH script/setup/install-protobuf
sudo chmod +x /usr/local/bin/protoc
sudo chmod og+rx /usr/local/include/google /usr/local/include/google/protobuf /usr/local/include/google/protobuf/compiler
sudo chmod -R og+r /usr/local/include/google/protobuf/
protoc --version
- name: Install dev tools
env:
GO111MODULE: off
run: script/setup/install-dev-tools
working-directory: src/github.com/containerd/containerd
- name: Check fmt
working-directory: src/github.com/containerd/containerd
run: |
make proto-fmt
- name: Check protos
env:
GO111MODULE: off
working-directory: src/github.com/containerd/containerd
run: |
make check-protos check-api-descriptors
man:
name: Manpages
runs-on: ubuntu-18.04
timeout-minutes: 5
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.15.2'
- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
- name: Checkout
uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
- name: Install dependencies
run: GO111MODULE=on go get github.com/cpuguy83/go-md2man/v2@v2.0.0
- name: Make
run: make man
working-directory: src/github.com/containerd/containerd
#
# Build containerd binaries
#
binaries:
name: Binaries
runs-on: ${{ matrix.os }}
timeout-minutes: 10
needs: [project, linters, protos, man]
strategy:
matrix:
os: [ubuntu-18.04, macos-10.15, windows-2019]
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.15.2'
- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
- name: Checkout
uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
- name: Make
run: |
make build
make binaries
working-directory: src/github.com/containerd/containerd
#
# Integration and CRI tests
#
integration-windows:
name: Windows Integration
runs-on: windows-2019
timeout-minutes: 30
needs: [project, linters, protos, man]
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.15.2'
- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/src/github.com/containerd/containerd/bin"
- name: Checkout containerd
uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
- name: Checkout Microsoft/hcsshim
uses: actions/checkout@v2
with:
repository: Microsoft/hcsshim
path: src/github.com/Microsoft/hcsshim
- name: Install Build Deps
shell: bash
run: |
cd src/github.com/containerd/containerd
script/setup/install-dev-tools
- name: Binaries
shell: bash
run: |
set -o xtrace
export CGO_ENABLED=1
cd src/github.com/containerd/containerd
mingw32-make.exe binaries
bindir="$(pwd)"
SHIM_COMMIT=$(grep Microsoft/hcsshim vendor.conf | awk '{print $2}')
cd ../../Microsoft/hcsshim
git fetch --tags origin "${SHIM_COMMIT}"
git checkout "${SHIM_COMMIT}"
GO111MODULE=on go build -mod=vendor -o "${bindir}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1
- name: Integration 1
shell: bash
run: |
cd src/github.com/containerd/containerd
export CGO_ENABLED=1
mingw32-make.exe integration
# Run the integration suite a second time. See discussion in github.com/containerd/containerd/pull/175
- name: Integration 2
shell: bash
run: |
cd src/github.com/containerd/containerd
export TESTFLAGS_PARALLEL=1
export CGO_ENABLED=1
mingw32-make.exe integration
integration-linux:
name: Linux Integration
runs-on: ubuntu-18.04
timeout-minutes: 15
needs: [project, linters, protos, man]
strategy:
matrix:
runtime: [io.containerd.runtime.v1.linux, io.containerd.runc.v1, io.containerd.runc.v2]
runc: [runc, crun]
exclude:
- runtime: io.containerd.runc.v1
runc: crun
- runtime: io.containerd.runtime.v1.linux
runc: crun
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.15.2'
- name: Setup gosu
shell: bash
run: |
GOSU=/usr/local/bin/gosu
arch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"
sudo wget -O ${GOSU} "https://github.com/tianon/gosu/releases/download/1.12/gosu-$arch"
sudo chmod +x ${GOSU}
sudo chown root ${GOSU}
sudo chmod +s ${GOSU}
- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
- name: Checkout containerd
uses: actions/checkout@v2
with:
path: src/github.com/containerd/containerd
- name: Install containerd dependencies
env:
RUNC_FLAVOR: ${{ matrix.runc }}
run: |
sudo PATH=$PATH script/setup/install-seccomp
gosu root script/setup/install-runc
gosu root script/setup/install-cni
gosu root script/setup/install-critools
working-directory: src/github.com/containerd/containerd
- name: Install criu
run: |
sudo apt-get install -y \
libprotobuf-dev \
libprotobuf-c-dev \
protobuf-c-compiler \
protobuf-compiler \
python-protobuf \
libnl-3-dev \
libnet-dev \
libcap-dev \
python-future
wget https://github.com/checkpoint-restore/criu/archive/v3.13.tar.gz -O criu.tar.gz
tar -zxf criu.tar.gz
cd criu-3.13
sudo make install-criu
- name: Install containerd
env:
CGO_ENABLED: 1
run: |
make binaries
sudo make install
working-directory: src/github.com/containerd/containerd
- name: Integration 1
env:
GOPROXY: direct
TEST_RUNTIME: ${{ matrix.runtime }}
RUNC_FLAVOR: ${{ matrix.runc }}
run: |
sudo GOPATH=$GOPATH GOPROXY=$GOPROXY TEST_RUNTIME=$TEST_RUNTIME RUNC_FLAVOR=$RUNC_FLAVOR make integration EXTRA_TESTFLAGS=-no-criu TESTFLAGS_RACE=-race
working-directory: src/github.com/containerd/containerd
# Run the integration suite a second time. See discussion in github.com/containerd/containerd/pull/1759
- name: Integration 2
env:
GOPROXY: direct
TEST_RUNTIME: ${{ matrix.runtime }}
RUNC_FLAVOR: ${{ matrix.runc }}
run: |
sudo GOPATH=$GOPATH GOPROXY=$GOPROXY TEST_RUNTIME=$TEST_RUNTIME RUNC_FLAVOR=$RUNC_FLAVOR TESTFLAGS_PARALLEL=1 make integration EXTRA_TESTFLAGS=-no-criu
working-directory: src/github.com/containerd/containerd
- name: CRI test
env:
TEST_RUNTIME: ${{ matrix.runtime }}
run: |
BDIR="$(mktemp -d -p $PWD)"
mkdir -p ${BDIR}/{root,state}
cat > ${BDIR}/config.toml <<EOF
[plugins.cri.containerd.default_runtime]
runtime_type = \"${TEST_RUNTIME}\"
EOF
ls /etc/cni/net.d
sudo PATH=$PATH BDIR=$BDIR /usr/local/bin/containerd -a ${BDIR}/c.sock -root ${BDIR}/root -state ${BDIR}/state -log-level debug &> ${BDIR}/containerd-cri.log &
sudo PATH=$PATH BDIR=$BDIR /usr/local/bin/ctr -a ${BDIR}/c.sock version
sudo PATH=$PATH BDIR=$BDIR GOPATH=$GOPATH critest --runtime-endpoint=unix:///${BDIR}/c.sock --parallel=8
TEST_RC=$?
test $TEST_RC -ne 0 && cat ${BDIR}/containerd-cri.log
sudo pkill containerd
sudo BDIR=$BDIR rm -rf ${BDIR}
test $TEST_RC -eq 0 || /bin/false
cgroup2:
name: CGroupsV2 and SELinux Integration
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
needs: [project, linters, protos, man]
strategy:
matrix:
# Currently crun is disabled to decrease CI flakiness.
# We can enable crun again when we get a better CI infra.
runc: [runc]
steps:
- name: Checkout containerd
uses: actions/checkout@v2
- name: Start vagrant
run: vagrant up
- name: Integration
env:
RUNC_FLAVOR: ${{ matrix.runc }}
# SELinux: replace Permissive with Enforcing after https://github.com/containers/container-selinux/pull/98
# is merged and the package becomes generally available.
SELINUX: Permissive
run: vagrant up --provision-with=selinux,install-runc,test-integration
- name: CRI test
env:
RUNC_FLAVOR: ${{ matrix.runc }}
# SELinux: replace Permissive with Enforcing after https://github.com/containers/container-selinux/pull/98
# is merged and the package becomes generally available.
SELINUX: Permissive
run: vagrant up --provision-with=selinux,install-runc,test-cri