itest: New macro, support for tmt and debian autopkgtest, and more #671
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
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| # Something seems to be setting this in the default GHA runners, which breaks bcvk | |
| # as the default runner user doesn't have access | |
| LIBVIRT_DEFAULT_URI: "qemu:///session" | |
| jobs: | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Check build | |
| run: cargo check --all-targets | |
| - name: Run unit tests | |
| run: cargo test --lib | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup bootc Ubuntu environment | |
| uses: bootc-dev/actions/bootc-ubuntu-setup@main | |
| with: | |
| libvirt: 'true' | |
| - name: Install additional dependencies | |
| run: sudo apt install -y go-md2man | |
| - name: Extract image lists from Justfile | |
| run: | | |
| echo "PRIMARY_IMAGE=$(just --evaluate PRIMARY_IMAGE)" >> $GITHUB_ENV | |
| echo "ALL_BASE_IMAGES=$(just --evaluate ALL_BASE_IMAGES)" >> $GITHUB_ENV | |
| - name: Setup Rust | |
| uses: bootc-dev/actions/setup-rust@main | |
| - name: Build | |
| run: just validate && just build | |
| - name: Run unit tests | |
| run: just unit | |
| - name: Pull test images | |
| run: just pull-test-images | |
| - name: Create nextest archive | |
| run: | | |
| cargo nextest archive --release -p integration-tests --archive-file nextest-archive.tar.zst | |
| env: | |
| BCVK_PATH: ${{ github.workspace }}/target/release/bcvk | |
| BCVK_PRIMARY_IMAGE: ${{ env.PRIMARY_IMAGE }} | |
| BCVK_ALL_IMAGES: ${{ env.ALL_BASE_IMAGES }} | |
| - name: Upload nextest archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nextest-archive | |
| path: nextest-archive.tar.zst | |
| retention-days: 7 | |
| - name: Upload bcvk binary for tests | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bcvk-binary-tests | |
| path: target/release/bcvk | |
| retention-days: 7 | |
| - name: Create bcvk archive | |
| run: just archive | |
| - name: Upload bcvk binary artifacts | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bcvk-binary | |
| path: | | |
| target/bcvk-*.tar.gz | |
| target/bcvk-*.tar.gz.sha256 | |
| retention-days: 7 | |
| publish-binary: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Install ORAS CLI | |
| run: | | |
| # renovate: datasource=github-releases depName=oras-project/oras | |
| VERSION=1.2.2 | |
| curl -LO https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz | |
| tar -xzf oras_${VERSION}_linux_amd64.tar.gz | |
| sudo mv oras /usr/local/bin/ | |
| - name: Download bcvk binary artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bcvk-binary | |
| - name: Login to GitHub Container Registry | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io --username ${{ github.repository_owner }} --password-stdin | |
| - name: Push binary as OCI artifact | |
| run: | | |
| for file in bcvk-*.tar.gz; do | |
| ARCH=$(echo "$file" | sed 's/bcvk-\(.*\)-unknown-linux-gnu\.tar\.gz/\1/') | |
| oras push "ghcr.io/bootc-dev/bcvk-binary:${ARCH}-latest" "$file:application/gzip" "${file}.sha256:text/plain" | |
| done | |
| integration-tests: | |
| runs-on: ubuntu-24.04 | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| partition: [1, 2, 3, 4] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: bootc-dev/actions/bootc-ubuntu-setup@main | |
| with: | |
| libvirt: 'true' | |
| - name: Extract image lists from Justfile | |
| run: | | |
| echo "PRIMARY_IMAGE=$(just --evaluate PRIMARY_IMAGE)" >> $GITHUB_ENV | |
| echo "ALL_BASE_IMAGES=$(just --evaluate ALL_BASE_IMAGES)" >> $GITHUB_ENV | |
| - name: Setup Rust | |
| uses: bootc-dev/actions/setup-rust@main | |
| - name: Pull test images | |
| run: just pull-test-images | |
| - name: Download nextest archive | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nextest-archive | |
| - name: Download bcvk binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bcvk-binary-tests | |
| path: target/release | |
| - name: Make bcvk executable | |
| run: chmod +x target/release/bcvk | |
| - name: Run integration tests (partition ${{ matrix.partition }}/4) | |
| run: | | |
| # Clean up any leftover containers before starting | |
| cargo run --release --bin test-cleanup -p integration-tests 2>/dev/null || true | |
| # Run the partitioned tests | |
| cargo nextest run --archive-file nextest-archive.tar.zst \ | |
| --profile integration \ | |
| --partition hash:${{ matrix.partition }}/4 | |
| # Clean up containers after tests complete | |
| cargo run --release --bin test-cleanup -p integration-tests 2>/dev/null || true | |
| env: | |
| BCVK_PATH: ${{ github.workspace }}/target/release/bcvk | |
| BCVK_PRIMARY_IMAGE: ${{ env.PRIMARY_IMAGE }} | |
| BCVK_ALL_IMAGES: ${{ env.ALL_BASE_IMAGES }} | |
| - name: Upload junit XML | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: integration-junit-xml-${{ matrix.partition }} | |
| path: target/nextest/integration/junit.xml | |
| retention-days: 7 | |
| # Sentinel job for required checks - configure this job name in repository settings | |
| required-checks: | |
| if: always() | |
| needs: [build-macos, build, integration-tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: exit 1 | |
| if: >- | |
| needs.build-macos.result != 'success' || | |
| needs.build.result != 'success' || | |
| needs.integration-tests.result != 'success' |