github.com/containerd/Containerd@v1.4.13/.github/workflows/ci.yml (about) 1 name: CI 2 on: 3 push: 4 branches: 5 - master 6 - 'release/**' 7 pull_request: 8 branches: 9 - master 10 - 'release/**' 11 12 jobs: 13 # 14 # golangci-lint 15 # 16 linters: 17 name: Linters 18 runs-on: ${{ matrix.os }} 19 timeout-minutes: 10 20 21 strategy: 22 matrix: 23 os: [ubuntu-18.04, macos-10.15] # TODO: pass linters on 'windows-2019' 24 25 steps: 26 - name: Install Go 27 uses: actions/setup-go@v2 28 with: 29 go-version: '1.16.14' 30 31 - name: Set env 32 shell: bash 33 run: | 34 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV 35 echo "${{ github.workspace }}/bin" >> $GITHUB_PATH 36 37 - name: Checkout 38 uses: actions/checkout@v2 39 with: 40 path: src/github.com/containerd/containerd 41 42 - name: Install dev tools 43 env: 44 GO111MODULE: off 45 shell: bash 46 run: script/setup/install-dev-tools 47 working-directory: src/github.com/containerd/containerd 48 49 - name: Make check 50 env: 51 GO111MODULE: off 52 shell: bash 53 run: make check 54 working-directory: src/github.com/containerd/containerd 55 56 # 57 # Project checks 58 # 59 project: 60 name: Project Checks 61 runs-on: ubuntu-18.04 62 timeout-minutes: 5 63 64 steps: 65 - uses: actions/checkout@v2 66 with: 67 path: src/github.com/containerd/containerd 68 fetch-depth: 100 69 70 - uses: containerd/project-checks@v1 71 with: 72 working-directory: src/github.com/containerd/containerd 73 74 # 75 # Protobuf checks 76 # 77 protos: 78 name: Protobuf 79 runs-on: ubuntu-18.04 80 timeout-minutes: 5 81 82 steps: 83 - uses: actions/setup-go@v2 84 with: 85 go-version: '1.16.14' 86 87 - name: Set env 88 shell: bash 89 run: | 90 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV 91 echo "${{ github.workspace }}/bin" >> $GITHUB_PATH 92 93 - name: Checkout 94 uses: actions/checkout@v2 95 with: 96 path: src/github.com/containerd/containerd 97 98 - name: Install protobuf 99 env: 100 GO111MODULE: off 101 working-directory: src/github.com/containerd/containerd 102 run: | 103 sudo -E PATH=$PATH script/setup/install-protobuf 104 sudo chmod +x /usr/local/bin/protoc 105 sudo chmod og+rx /usr/local/include/google /usr/local/include/google/protobuf /usr/local/include/google/protobuf/compiler 106 sudo chmod -R og+r /usr/local/include/google/protobuf/ 107 protoc --version 108 109 - name: Install dev tools 110 env: 111 GO111MODULE: off 112 run: script/setup/install-dev-tools 113 working-directory: src/github.com/containerd/containerd 114 115 - name: Make 116 env: 117 GO111MODULE: off 118 working-directory: src/github.com/containerd/containerd 119 run: | 120 export PATH=$PATH:$(go env GOPATH)/bin 121 make check-protos check-api-descriptors 122 123 man: 124 name: Manpages 125 runs-on: ubuntu-18.04 126 timeout-minutes: 5 127 128 steps: 129 - uses: actions/setup-go@v2 130 with: 131 go-version: '1.16.14' 132 133 - name: Set env 134 shell: bash 135 run: | 136 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV 137 echo "${{ github.workspace }}/bin" >> $GITHUB_PATH 138 139 - name: Checkout 140 uses: actions/checkout@v2 141 with: 142 path: src/github.com/containerd/containerd 143 144 - name: Install dependencies 145 run: GO111MODULE=on go get github.com/cpuguy83/go-md2man/v2@v2.0.0 146 147 - name: Make 148 env: 149 GO111MODULE: off 150 run: make man 151 working-directory: src/github.com/containerd/containerd 152 153 # 154 # Build containerd binaries 155 # 156 binaries: 157 name: Binaries 158 runs-on: ${{ matrix.os }} 159 timeout-minutes: 10 160 needs: [project, linters, protos, man] 161 162 strategy: 163 matrix: 164 os: [ubuntu-18.04, macos-10.15, windows-2019] 165 166 steps: 167 - uses: actions/setup-go@v2 168 with: 169 go-version: '1.16.14' 170 171 - name: Set env 172 shell: bash 173 run: | 174 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV 175 echo "${{ github.workspace }}/bin" >> $GITHUB_PATH 176 177 - name: Checkout 178 uses: actions/checkout@v2 179 with: 180 path: src/github.com/containerd/containerd 181 182 - name: Make 183 env: 184 GO111MODULE: off 185 run: | 186 make build 187 make binaries 188 working-directory: src/github.com/containerd/containerd 189 190 # 191 # Integration and CRI tests 192 # 193 integration-windows: 194 name: Windows Integration 195 runs-on: windows-2019 196 timeout-minutes: 30 197 needs: [project, linters, protos, man] 198 199 steps: 200 - uses: actions/setup-go@v2 201 with: 202 go-version: '1.16.14' 203 204 - name: Set env 205 shell: bash 206 run: | 207 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV 208 echo "${{ github.workspace }}/src/github.com/containerd/containerd/bin" >> $GITHUB_PATH 209 210 - name: Checkout containerd 211 uses: actions/checkout@v2 212 with: 213 path: src/github.com/containerd/containerd 214 - name: Checkout Microsoft/hcsshim 215 uses: actions/checkout@v2 216 with: 217 repository: Microsoft/hcsshim 218 path: src/github.com/Microsoft/hcsshim 219 220 - name: Install Build Deps 221 shell: bash 222 run: | 223 cd src/github.com/containerd/containerd 224 script/setup/install-dev-tools 225 - name: Binaries 226 env: 227 GO111MODULE: off 228 shell: bash 229 run: | 230 set -o xtrace 231 export CGO_ENABLED=1 232 cd src/github.com/containerd/containerd 233 mingw32-make.exe binaries 234 bindir="$(pwd)" 235 SHIM_COMMIT=$(grep Microsoft/hcsshim vendor.conf | awk '{print $2}') 236 cd ../../Microsoft/hcsshim 237 git fetch --tags origin "${SHIM_COMMIT}" 238 git checkout "${SHIM_COMMIT}" 239 GO111MODULE=on go build -mod=vendor -o "${bindir}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1 240 241 - name: Tests 242 shell: bash 243 env: 244 CGO_ENABLED: 1 245 GO111MODULE: off 246 run: | 247 cd src/github.com/containerd/containerd 248 mingw32-make.exe test root-test 249 250 - name: Integration 1 251 env: 252 GO111MODULE: off 253 shell: bash 254 run: | 255 cd src/github.com/containerd/containerd 256 export CGO_ENABLED=1 257 mingw32-make.exe integration 258 # Run the integration suite a second time. See discussion in github.com/containerd/containerd/pull/175 259 - name: Integration 2 260 env: 261 GO111MODULE: off 262 shell: bash 263 run: | 264 cd src/github.com/containerd/containerd 265 export TESTFLAGS_PARALLEL=1 266 export CGO_ENABLED=1 267 mingw32-make.exe integration 268 269 integration-linux: 270 name: Linux Integration 271 runs-on: ubuntu-18.04 272 timeout-minutes: 15 273 needs: [project, linters, protos, man] 274 275 strategy: 276 matrix: 277 runtime: [io.containerd.runtime.v1.linux, io.containerd.runc.v1, io.containerd.runc.v2] 278 runc: [runc, crun] 279 exclude: 280 - runtime: io.containerd.runc.v1 281 runc: crun 282 - runtime: io.containerd.runtime.v1.linux 283 runc: crun 284 285 steps: 286 - uses: actions/setup-go@v2 287 with: 288 go-version: '1.16.14' 289 290 - name: Set env 291 shell: bash 292 run: | 293 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV 294 echo "${{ github.workspace }}/bin" >> $GITHUB_PATH 295 296 - name: Checkout containerd 297 uses: actions/checkout@v2 298 with: 299 path: src/github.com/containerd/containerd 300 301 - name: Install containerd dependencies 302 env: 303 RUNC_FLAVOR: ${{ matrix.runc }} 304 run: | 305 sudo -E PATH=$PATH script/setup/install-seccomp 306 sudo -E PATH=$PATH script/setup/install-runc 307 sudo -E PATH=$PATH script/setup/install-cni 308 sudo -E PATH=$PATH script/setup/install-critools 309 working-directory: src/github.com/containerd/containerd 310 311 - name: Install criu 312 run: | 313 sudo apt-get install -y \ 314 libprotobuf-dev \ 315 libprotobuf-c-dev \ 316 protobuf-c-compiler \ 317 protobuf-compiler \ 318 python-protobuf \ 319 libnl-3-dev \ 320 libnet-dev \ 321 libcap-dev \ 322 python-future 323 wget https://github.com/checkpoint-restore/criu/archive/v3.13.tar.gz -O criu.tar.gz 324 tar -zxf criu.tar.gz 325 cd criu-3.13 326 sudo make install-criu 327 328 - name: Install containerd 329 env: 330 CGO_ENABLED: 1 331 GO111MODULE: off 332 run: | 333 make binaries 334 sudo -E PATH=$PATH make install 335 working-directory: src/github.com/containerd/containerd 336 337 - name: Tests 338 env: 339 GOPROXY: direct 340 SKIPTESTS: github.com/containerd/containerd/snapshots/devmapper 341 GO111MODULE: off 342 run: | 343 make test 344 sudo -E PATH=$PATH make root-test 345 working-directory: src/github.com/containerd/containerd 346 347 - name: Integration 1 348 env: 349 GOPROXY: direct 350 TEST_RUNTIME: ${{ matrix.runtime }} 351 RUNC_FLAVOR: ${{ matrix.runc }} 352 GO111MODULE: off 353 run: | 354 sudo -E PATH=$PATH make integration EXTRA_TESTFLAGS=-no-criu TESTFLAGS_RACE=-race 355 working-directory: src/github.com/containerd/containerd 356 357 # Run the integration suite a second time. See discussion in github.com/containerd/containerd/pull/1759 358 - name: Integration 2 359 env: 360 GOPROXY: direct 361 TEST_RUNTIME: ${{ matrix.runtime }} 362 RUNC_FLAVOR: ${{ matrix.runc }} 363 GO111MODULE: off 364 run: | 365 sudo -E PATH=$PATH TESTFLAGS_PARALLEL=1 make integration EXTRA_TESTFLAGS=-no-criu 366 working-directory: src/github.com/containerd/containerd 367 368 - name: CRI test 369 env: 370 TEST_RUNTIME: ${{ matrix.runtime }} 371 run: | 372 BDIR="$(mktemp -d -p $PWD)" 373 mkdir -p ${BDIR}/{root,state} 374 cat > ${BDIR}/config.toml <<EOF 375 [plugins.cri.containerd.default_runtime] 376 runtime_type = "${TEST_RUNTIME}" 377 EOF 378 sudo ls /etc/cni/net.d 379 sudo -E PATH=$PATH /usr/local/bin/containerd -a ${BDIR}/c.sock --config ${BDIR}/config.toml --root ${BDIR}/root --state ${BDIR}/state --log-level debug &> ${BDIR}/containerd-cri.log & 380 sudo -E PATH=$PATH /usr/local/bin/ctr -a ${BDIR}/c.sock version 381 sudo -E PATH=$PATH critest --runtime-endpoint=unix:///${BDIR}/c.sock --parallel=8 382 TEST_RC=$? 383 test $TEST_RC -ne 0 && cat ${BDIR}/containerd-cri.log 384 sudo pkill containerd 385 sudo -E rm -rf ${BDIR} 386 test $TEST_RC -eq 0 || /bin/false 387 388 cgroup2: 389 name: CGroupsV2 and SELinux Integration 390 # nested virtualization is only available on macOS hosts 391 runs-on: macos-10.15 392 timeout-minutes: 40 393 needs: [project, linters, protos, man] 394 strategy: 395 matrix: 396 # Currently crun is disabled to decrease CI flakiness. 397 # We can enable crun again when we get a better CI infra. 398 runc: [runc] 399 steps: 400 - name: Checkout containerd 401 uses: actions/checkout@v2 402 403 - name: "Cache ~/.vagrant.d/boxes" 404 uses: actions/cache@v2 405 with: 406 path: ~/.vagrant.d/boxes 407 key: vagrant-${{ hashFiles('Vagrantfile*') }} 408 409 - name: Start vagrant 410 run: vagrant up 411 412 - name: Integration 413 env: 414 RUNC_FLAVOR: ${{ matrix.runc }} 415 # SELinux: replace Permissive with Enforcing after https://github.com/containers/container-selinux/pull/98 416 # is merged and the package becomes generally available. 417 SELINUX: Permissive 418 run: vagrant up --provision-with=selinux,install-runc,test-integration 419 420 - name: CRI test 421 env: 422 RUNC_FLAVOR: ${{ matrix.runc }} 423 # SELinux: replace Permissive with Enforcing after https://github.com/containers/container-selinux/pull/98 424 # is merged and the package becomes generally available. 425 SELINUX: Permissive 426 run: vagrant up --provision-with=selinux,install-runc,test-cri