diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index a68f1c9..51528d7 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -17,9 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + - run: ./scripts/install-protobuf.sh - run: cargo check --examples --tests -p containerd-shim -p containerd-shim-protos - run: rustup toolchain install nightly --component rustfmt @@ -41,9 +39,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + - run: ./scripts/install-protobuf.sh - name: Tests run: | cargo test -p containerd-shim -p containerd-shim-protos diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1c325e..9457583 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,9 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + + - run: ./scripts/install-protobuf.sh + - run: cargo check --examples --tests --all-targets - run: cargo check --examples --tests --all-targets --all-features @@ -45,16 +45,13 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + - 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 - export PROTOC=$(which protoc) sudo -E $(command -v cargo) test sudo -E $(command -v cargo) test --all-features @@ -67,9 +64,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + - run: ./scripts/install-protobuf.sh - run: cargo build --all-features --timings - uses: actions/upload-artifact@v3 with: diff --git a/scripts/install-protobuf.sh b/scripts/install-protobuf.sh new file mode 100755 index 0000000..a775050 --- /dev/null +++ b/scripts/install-protobuf.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Helper script for Github Actions to install protobuf on different runners. + +if [ "$RUNNER_OS" == 'Linux' ]; then + # Install on Linux + sudo apt-get update + sudo apt-get install -y protobuf-compiler +elif [ "$RUNNER_OS" == 'macOS' ]; then + # Install on macOS + brew install protobuf +elif [ "$RUNNER_OS" == 'Windows' ]; then + # Install on Windows + choco install protoc +else + echo "Unsupported OS: $RUNNER_OS" + exit 1 +fi + +# Check the installed Protobuf version +protoc --version