containers-image-proxy 0.11.0

Interact with the github.com/containers/image library via skopeo
Documentation
name: CI

permissions:
  actions: read

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  merge_group:

env:
  CARGO_NET_RETRY: 10
  CARGO_TERM_COLOR: always
  CI: 1
  RUSTUP_MAX_RETRIES: 10
  RUST_BACKTRACE: short

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  semver-checks:
    name: Semver Checks
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@v7
    - uses: obi1kenobi/cargo-semver-checks-action@v2
      with:
        # Pinned until cargo-semver-checks supports rustdoc format v57 (Rust 1.93+)
        rust-toolchain: "1.92.0"

  build-test:
    name: Build+Test
    runs-on: ubuntu-latest
    container: quay.io/coreos-assembler/fcos-buildroot:testing-devel
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
    steps:
      - name: Checkout repository
        uses: actions/checkout@v7
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 20
      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2
      - name: cargo fmt (check)
        run: cargo fmt -- --check -l
      - name: Compile (no features)
        run: cargo test --no-run
      - name: Compile (all features)
        run: cargo test --no-run --all-features
      - name: Test
        run: cargo test --all-features -- --nocapture --quiet
      - name: cargo clippy (non-gating)
        run: cargo clippy
      - name: Checkout ostree-rs-ext
        uses: actions/checkout@v7
        with:
          repository: ostreedev/ostree-rs-ext
          path: ostree-rs-ext
          fetch-depth: 20
      - name: Test ostree-rs-ext
        run: ./ci/test-ostree-rs-ext.sh

  test-old-skopeo:
    name: Test (old skopeo)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v7
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 20
      - name: Test in AlmaLinux bootc container (skopeo 1.18)
        run: |
          set -euxo pipefail
          rm -rf .ci-cargo-home
          mkdir -p .ci-cargo-home
          docker run --rm \
            -e CARGO_TARGET_DIR=/tmp/target \
            -e EXPECT_BLOB_STREAM_SOURCE=GetBlob \
            -v "$PWD:/src" \
            -v "$PWD/.ci-cargo-home:/root/.cargo" \
            -w /src \
            quay.io/almalinuxorg/almalinux-bootc:10.0 \
            sh -lc 'dnf -y install cargo rustc openssl-devel pkg-config >/dev/null && skopeo --version && cargo test --all-features -- --nocapture --quiet'
          sudo rm -rf .ci-cargo-home

  test-new-skopeo:
    name: Test (new skopeo)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v7
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 20
      - name: Test in CentOS Stream 10 container (skopeo >= 1.19)
        run: |
          set -euxo pipefail
          rm -rf .ci-cargo-home
          mkdir -p .ci-cargo-home
          docker run --rm \
            -e CARGO_TARGET_DIR=/tmp/target \
            -e EXPECT_BLOB_STREAM_SOURCE=GetRawBlob \
            -v "$PWD:/src" \
            -v "$PWD/.ci-cargo-home:/root/.cargo" \
            -w /src \
            quay.io/centos/centos:stream10 \
            sh -lc 'dnf -y install cargo rustc skopeo openssl-devel pkg-config >/dev/null && skopeo --version && cargo test --all-features -- --nocapture --quiet'
          sudo rm -rf .ci-cargo-home

  required-checks:
    if: always()
    needs: [semver-checks, build-test, test-old-skopeo, test-new-skopeo]
    runs-on: ubuntu-latest
    steps:
      - name: Check all jobs
        env:
          NEEDS: ${{ toJson(needs) }}
        run: |
          FAILED=$(echo "$NEEDS" | jq -r 'to_entries[] | select(.value.result | IN("success","skipped") | not) | .key')
          if [ -n "$FAILED" ]; then
            echo "The following jobs did not succeed: $FAILED"
            exit 1
          fi
          echo "All jobs succeeded or were skipped."