Create first integration test #74
Workflow file for this run
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
| # SPDX-FileCopyrightText: Yalan Zhang <yalzhang@redhat.com> | |
| # SPDX-FileCopyrightText: Timothée Ravier <tim@siosm.fr> | |
| # SPDX-FileCopyrightText: Alice Frosi <afrosi@redhat.com> | |
| # | |
| # SPDX-License-Identifier: CC0-1.0 | |
| # Inspired by https://github.com/coreos/repo-templates | |
| name: "Rust" | |
| on: | |
| pull_request: | |
| branches: | |
| - "main" | |
| permissions: | |
| contents: "read" | |
| # Don't waste job slots on superseded code | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Pinned toolchain for linting | |
| ACTIONS_LINTS_TOOLCHAIN: 1.85.0 | |
| jobs: | |
| tests-stable: | |
| name: "Tests, stable toolchain" | |
| runs-on: "ubuntu-24.04" | |
| container: "ghcr.io/confidential-clusters/buildroot:latest" | |
| steps: | |
| - name: "Check out repository" | |
| uses: actions/checkout@v5 | |
| - name: "Install toolchain" | |
| uses: dtolnay/rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: "Cache build artifacts" | |
| uses: Swatinem/rust-cache@v2 | |
| - name: "cargo build" | |
| run: cargo build --all-targets | |
| - name: "cargo test" | |
| run: cargo test --lib | |
| tests-release-stable: | |
| name: "Tests (release), stable toolchain" | |
| runs-on: "ubuntu-24.04" | |
| container: "ghcr.io/confidential-clusters/buildroot:latest" | |
| steps: | |
| - name: "Check out repository" | |
| uses: actions/checkout@v5 | |
| - name: "Install toolchain" | |
| uses: dtolnay/rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: "Cache build artifacts" | |
| uses: Swatinem/rust-cache@v2 | |
| - name: "cargo build (release)" | |
| run: cargo build --lib --release | |
| - name: "cargo test (release)" | |
| run: cargo test --lib --release | |
| tests-release-msrv: | |
| name: "Tests (release), minimum supported toolchain" | |
| runs-on: "ubuntu-24.04" | |
| container: "ghcr.io/confidential-clusters/buildroot:latest" | |
| steps: | |
| - name: "Check out repository" | |
| uses: actions/checkout@v5 | |
| - name: "Detect crate MSRV" | |
| run: | | |
| msrv=$(cargo metadata --format-version 1 --no-deps | \ | |
| jq -r '.packages[0].rust_version') | |
| echo "Crate MSRV: $msrv" | |
| echo "MSRV=$msrv" >> $GITHUB_ENV | |
| - name: "Install toolchain" | |
| uses: dtolnay/rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ env.MSRV }} | |
| - name: "Cache build artifacts" | |
| uses: Swatinem/rust-cache@v2 | |
| - name: "cargo build (release)" | |
| run: cargo build --lib --release | |
| - name: "cargo test (release)" | |
| run: cargo test --lib --release | |
| linting: | |
| name: "Lints, pinned toolchain" | |
| runs-on: "ubuntu-24.04" | |
| container: "ghcr.io/confidential-clusters/buildroot:latest" | |
| steps: | |
| - name: "Check out repository" | |
| uses: actions/checkout@v5 | |
| - name: "Install toolchain" | |
| uses: dtolnay/rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ env.ACTIONS_LINTS_TOOLCHAIN }} | |
| components: rustfmt, clippy | |
| - name: "Cache build artifacts" | |
| uses: Swatinem/rust-cache@v2 | |
| - name: "cargo fmt (check)" | |
| run: cargo fmt -- --check -l | |
| - name: "cargo clippy (warnings)" | |
| run: cargo clippy --all-targets -- -D warnings | |
| tests-other-channels: | |
| name: "Tests, unstable toolchain" | |
| runs-on: "ubuntu-24.04" | |
| container: "ghcr.io/confidential-clusters/buildroot:latest" | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| channel: [beta, nightly] | |
| steps: | |
| - name: "Check out repository" | |
| uses: actions/checkout@v5 | |
| - name: "Install toolchain" | |
| uses: dtolnay/rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ matrix.channel }} | |
| - name: "Cache build artifacts" | |
| uses: Swatinem/rust-cache@v2 | |
| - name: "cargo build" | |
| run: cargo build --lib | |
| - name: "cargo test" | |
| run: cargo test --lib | |
| integration-tests: | |
| name: "Integration tests" | |
| runs-on: "ubuntu-24.04" | |
| env: | |
| REGISTRY: "localhost:5000" | |
| RUNTIME: "docker" | |
| steps: | |
| - name: "Check out repository" | |
| uses: actions/checkout@v5 | |
| - name: "Install kubectl" | |
| run: | | |
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
| chmod +x kubectl | |
| sudo mv kubectl /usr/local/bin/kubectl | |
| - name: "Install kind" | |
| run: | | |
| curl -Lo ./kind.bin https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64 | |
| chmod +x ./kind.bin | |
| sudo mv ./kind.bin /usr/local/bin/kind | |
| - name: "Install toolchain" | |
| uses: dtolnay/rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: "Cache build artifacts" | |
| uses: Swatinem/rust-cache@v2 | |
| - name: "Setup cluster" | |
| run: make cluster-up | |
| - name: "Build and push images" | |
| run: make push | |
| - name: "Create the manifests" | |
| run: make manifests | |
| - name: "Run integration tests" | |
| run: make integration-tests | |
| - name: "Collecting logs on a failure" | |
| if: failure() | |
| run: | | |
| echo "Job failed, collecting kind logs..." | |
| mkdir -p logs | |
| docker info > logs/docker-info || true | |
| docker logs kind-control-plane > logs/kind-control-plane || true | |
| kind export logs logs/kind-logs || true | |
| tar -czf kind-logs.tar.gz logs || true | |
| - name: "Upload logs as artifact" | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kind-logs | |
| path: kind-logs.tar.gz |