update snapshot links (#174) #335
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"] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: ["main"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| rust-checks: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: moonrepo/setup-rust@v1 | |
| with: | |
| cache: false | |
| components: rustfmt,clippy | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Run tests | |
| run: cargo test --all-targets --all-features | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Run cargo audit | |
| uses: actions-rs/audit-check@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| build-and-push: | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| needs: rust-checks | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set build variables | |
| id: vars | |
| run: .github/scripts/vars | |
| - name: Docker image metadata | |
| id: image-meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ steps.vars.outputs.image }} | |
| tags: | | |
| type=raw,value=${{ steps.vars.outputs.version }},event=push | |
| type=raw,value=latest,event=push,enable={{is_default_branch}} | |
| type=semver,pattern=v{{version}},event=tag | |
| type=semver,pattern=v{{major}}.{{minor}},event=tag | |
| type=semver,pattern=v{{major}},event=tag | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.image-meta.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| push: true | |
| publish-to-crates: | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| runs-on: ubuntu-latest | |
| needs: rust-checks | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: moonrepo/setup-rust@v1 | |
| with: | |
| cache: true | |
| channel: 1.87 | |
| - name: Publish to crates.io | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }} | |
| run: cargo publish --locked --no-verify |