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