Merge pull request #2762 from containers/dependabot/cargo/cc-1.2.38 #6880
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: | |
pull_request: {} | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
NIX_VERSION: "2.30.1" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- name: Setup Cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- run: .github/install-deps | |
- name: Select Toolchain | |
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- run: cargo build && git diff --exit-code | |
dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- run: make verify-dependencies | |
go-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
with: | |
go-version-file: go.mod | |
- uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 | |
with: | |
version: v2.4.0 | |
only-new-issues: true | |
get-script: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0 | |
- run: scripts/get | |
release-static: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
env: | |
COSIGN_EXPERIMENTAL: 1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- name: Setup Cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-release-static-${{ hashFiles('**/Cargo.lock') }} | |
- run: .github/install-deps | |
- name: Select Toolchain | |
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- run: make release-static | |
- run: | | |
mkdir ${{ github.sha }} | |
mv target/x86_64-unknown-linux-gnu/release/conmonrs ${{ github.sha }} | |
- run: ./${{ github.sha }}/conmonrs -v | |
- uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0 | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
- name: Sign binary | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
run: | | |
cd ${{ github.sha }} | |
cosign sign-blob -y conmonrs \ | |
--output-signature conmonrs.sig \ | |
--output-certificate conmonrs.cert | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: conmonrs | |
path: ${{ github.sha }}/* | |
- uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
with: | |
credentials_json: ${{ secrets.GCS_CRIO_SA }} | |
- uses: google-github-actions/upload-cloud-storage@6397bd7208e18d13ba2619ee21b9873edc94427a # v3.0.0 | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
with: | |
path: ${{ github.sha }} | |
destination: cri-o/conmon-rs | |
create-marker: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
needs: | |
- release-static | |
- build-static | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- run: .github/create-marker | |
- uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 | |
with: | |
credentials_json: ${{ secrets.GCS_CRIO_SA }} | |
- uses: google-github-actions/upload-cloud-storage@6397bd7208e18d13ba2619ee21b9873edc94427a # v3.0.0 | |
with: | |
path: . | |
glob: latest-*.txt | |
destination: cri-o/conmon-rs | |
build-static: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
env: | |
COSIGN_EXPERIMENTAL: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [amd64, arm64, ppc64le, s390x] | |
name: build-static-${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v28 | |
with: | |
install_url: https://releases.nixos.org/nix/nix-${{ env.NIX_VERSION }}/install | |
- uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 | |
with: | |
name: conmon-rs | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
pushFilter: "(conmon-rs)" | |
- run: nix-build nix/default-${{ matrix.arch }}.nix | |
- run: file result/bin/conmonrs | grep static | grep stripped | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: build-static-${{ matrix.arch }} | |
path: | | |
result/bin/conmonrs | |
- run: | | |
mkdir ${{ github.sha }} | |
cp result/bin/conmonrs ${{ github.sha }}/conmonrs.${{ matrix.arch }} | |
- uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0 | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
- name: Sign binary | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
run: | | |
cd ${{ github.sha }} | |
cosign sign-blob -y conmonrs.${{ matrix.arch }} \ | |
--output-signature conmonrs.${{ matrix.arch }}.sig \ | |
--output-certificate conmonrs.${{ matrix.arch }}.cert | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: conmonrs-${{ matrix.arch }} | |
path: ${{ github.sha }}/* | |
- uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
with: | |
credentials_json: ${{ secrets.GCS_CRIO_SA }} | |
- uses: google-github-actions/upload-cloud-storage@6397bd7208e18d13ba2619ee21b9873edc94427a # v3.0.0 | |
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags') | |
with: | |
path: ${{ github.sha }} | |
destination: cri-o/conmon-rs | |
doc: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- name: Setup Cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-doc-${{ hashFiles('**/Cargo.lock') }} | |
- run: .github/install-deps | |
- name: Select Toolchain | |
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Cargo doc | |
run: cargo doc --no-deps | |
lint-clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- name: Setup Cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} | |
- run: .github/install-deps | |
- name: Select Toolchain | |
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
with: | |
toolchain: nightly | |
components: clippy, rustfmt | |
- name: Clippy Lint | |
run: cargo +nightly clippy --all-targets --all-features -- -D warnings | |
lint-rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- name: Select Toolchain | |
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Rustfmt | |
run: cargo fmt && git diff --exit-code | |
test-unit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- run: .github/install-deps | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: cargo llvm-cov --all-features --lcov --output-path lcov.info | |
- name: Upload Results | |
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
with: | |
files: lcov.info | |
test-integration: | |
needs: release-static | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
with: | |
go-version-file: go.mod | |
- name: Setup Rust and Golang Cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-cargo-test-integration-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/go.sum') }} | |
- name: Setup Testfiles Cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
path: | | |
/tmp/conmon-test-images | |
key: ${{ runner.os }}-cargo-test-files-${{ hashFiles('pkg/client/files_test.go') }} | |
- run: rm -rf target/x86_64-unknown-linux-gnu/release/conmonrs | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
name: conmonrs | |
path: target/x86_64-unknown-linux-gnu/release | |
- run: chmod +x target/x86_64-unknown-linux-gnu/release/conmonrs | |
- run: .github/install-deps | |
- name: create symlink | |
run: sudo ln -f -s $(go env GOROOT)/bin/* /usr/bin/ | |
- name: Integration tests | |
run: sudo -E RUNTIME_PATH="/usr/sbin/runc" make integration-static | |
- name: Chown cache | |
run: | | |
sudo chown -R $(id -u):$(id -g) ~/go/pkg/mod | |
sudo chown -R $(id -u):$(id -g) ~/.cache/go-build | |
test-critest: | |
needs: release-static | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
with: | |
go-version-file: go.mod | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
name: conmonrs | |
path: target/x86_64-unknown-linux-musl/release | |
- run: .github/setup | |
- name: Install ginkgo | |
run: | | |
sudo chown -R $(id -u):$(id -g) ~/go | |
sudo chown -R $(id -u):$(id -g) ~/.cache | |
go install github.com/onsi/ginkgo/v2/ginkgo@latest | |
ginkgo version | |
sudo cp $(command -v ginkgo) /usr/local/bin | |
- name: Run critest | |
shell: bash | |
run: | | |
set -euox pipefail | |
sudo cp target/x86_64-unknown-linux-musl/release/conmonrs /usr/libexec/crio/conmonrs | |
sudo chmod +x /usr/libexec/crio/conmonrs | |
set +o errexit | |
sudo -E PATH=$PATH critest \ | |
--runtime-endpoint=unix:///var/run/crio/crio.sock \ | |
--parallel=$(nproc) \ | |
--ginkgo.flake-attempts=3 \ | |
--ginkgo.randomize-all \ | |
--ginkgo.timeout=2m \ | |
--ginkgo.trace \ | |
--ginkgo.vv | |
TEST_RC=$? | |
set -o errexit | |
sudo journalctl --no-pager > journal.log | |
test $TEST_RC -ne 0 && cat journal.log | |
exit $TEST_RC | |
- name: Upload logs | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: journal.log | |
path: journal.log | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: crate-ci/typos@85f62a8a84f939ae994ab3763f01a0296d61a7ee # v1.36.2 | |
with: | |
config: .github/typos.toml | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: creyD/prettier_action@8c18391fdc98ed0d884c6345f03975edac71b8f0 # v4.6 | |
with: | |
dry: true | |
prettier_options: --write . |