140 lines
3.9 KiB
YAML
140 lines
3.9 KiB
YAML
name: CI
|
|
on:
|
|
pull_request:
|
|
push:
|
|
merge_group:
|
|
schedule:
|
|
- cron: '0 0 * * *' # Every day at midnight
|
|
|
|
jobs:
|
|
checks:
|
|
name: Checks
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 20
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- run: ./scripts/install-protobuf.sh
|
|
|
|
- run: cargo check --examples --tests --all-targets
|
|
- run: cargo check --examples --tests --all-targets --all-features
|
|
|
|
- run: rustup toolchain install nightly --component rustfmt
|
|
- run: cargo +nightly fmt --all -- --check --files-with-diff
|
|
|
|
- run: cargo clippy --all-targets -- -D warnings
|
|
- run: cargo clippy --all-targets --all-features -- -D warnings
|
|
|
|
- run: cargo doc --no-deps --features docs
|
|
env:
|
|
RUSTDOCFLAGS: -Dwarnings
|
|
|
|
tests:
|
|
name: Tests
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 15
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: ./scripts/install-protobuf.sh
|
|
- env:
|
|
# runc::tests::test_exec needs $XDG_RUNTIME_DIR to be set
|
|
XDG_RUNTIME_DIR: /tmp/dummy-xdr
|
|
run: |
|
|
# runc-shim::cgroup::test_add_cgroup needs root permission to set cgroup
|
|
mkdir -p /tmp/dummy-xdr
|
|
sudo -E $(command -v cargo) test
|
|
sudo -E $(command -v cargo) test --all-features
|
|
|
|
# Collect build timings
|
|
# See https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html#cargo---timings
|
|
timings:
|
|
name: Timings
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: ./scripts/install-protobuf.sh
|
|
- run: cargo build --all-features --timings
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: timings
|
|
path: target/cargo-timings/cargo-timing.html
|
|
if-no-files-found: error
|
|
|
|
deny:
|
|
name: Deny
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: EmbarkStudios/cargo-deny-action@v1
|
|
|
|
integration:
|
|
name: Integration
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 40
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-20.04, ubuntu-22.04]
|
|
containerd: [v1.6.24, v1.7.6]
|
|
|
|
steps:
|
|
- name: Checkout extensions
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download containerd archive
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release download ${{ matrix.containerd }} \
|
|
--repo containerd/containerd \
|
|
--pattern 'containerd-1.*-linux-amd64.tar.gz' \
|
|
--output containerd.tar.gz
|
|
|
|
- name: Extract containerd binaries to $HOME/.local/bin
|
|
run: |
|
|
mkdir -p $HOME/.local/bin
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
tar -xf containerd.tar.gz -C $HOME/.local
|
|
|
|
- name: Checkout containerd
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: containerd/containerd
|
|
path: src/github.com/containerd/containerd
|
|
ref: ${{ matrix.containerd }}
|
|
|
|
- name: Install shim
|
|
run: |
|
|
cargo build --release --bin containerd-shim-runc-v2-rs
|
|
sudo install -D ./target/release/containerd-shim-runc-v2-rs /usr/local/bin/
|
|
|
|
## get latest go version for integrations tests so we can skip runnings tests
|
|
- uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.20.4'
|
|
|
|
- name: Integration
|
|
env:
|
|
GOPROXY: direct
|
|
TEST_RUNTIME: "io.containerd.runc.v2-rs"
|
|
TESTFLAGS_PARALLEL: 1
|
|
EXTRA_TESTFLAGS: "-no-criu -test.skip='(TestContainerPTY|TestContainerExecLargeOutputWithTTY|TestTaskUpdate|TestTaskResize|TestContainerAttach|TestContainerAttachProcess)'"
|
|
TESTFLAGS_RACE: "-race"
|
|
run: |
|
|
sudo -E PATH=$PATH make integration
|
|
working-directory: src/github.com/containerd/containerd
|