sqlite-containers 2.2.1

SQLite-based containers for Rust
Documentation
name: CI/CD

permissions:
  contents: read

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  release:
    types: [created]

jobs:
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Test & Build
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  build:
    name: Test & Build
    strategy:
      matrix:
        rust: ["1.87.0", "1.99.1"]
        platform:
          - host: ubuntu-26.04
            target: x86_64-unknown-linux-gnu
          - host: ubuntu-26.04
            target: i686-unknown-linux-gnu
          - host: ubuntu-26.04-arm
            target: aarch64-unknown-linux-gnu
          - host: windows-latest
            target: x86_64-pc-windows-msvc
          - host: windows-latest
            target: i686-pc-windows-msvc
          - host: windows-11-arm
            target: aarch64-pc-windows-msvc
          - host: macos-26
            target: aarch64-apple-darwin
          - host: macos-26-intel
            target: x86_64-apple-darwin

    runs-on: ${{ matrix.platform.host }}
    steps:
      - name: Install Rust Toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v2
        with:
          toolchain: ${{ matrix.rust }}
          target: ${{ matrix.platform.target }}
          components: rustfmt clippy
          cache: false

      - name: Install Nextest
        uses: taiki-e/install-action@nextest

      - name: Install Multilib Support
        if: ${{ matrix.platform.target == 'i686-unknown-linux-gnu' }}
        run: |
          sudo apt-get update -qq
          sudo apt-get install -y --no-install-recommends gcc-multilib libc6-dev-i386
        env:
          DEBIAN_FRONTEND: noninteractive

      - name: Add GNU Make to PATH
        if: ${{ startsWith(matrix.platform.host, 'windows') }}
        run: Add-Content -Path ${env:GITHUB_PATH} -Value "${env:GITHUB_WORKSPACE}\etc\tools\gnu-make\win32\bin"

      - name: Checkout
        uses: actions/checkout@v7
        with:
          ref: ${{ github.event.release.tag_name && format('refs/tags/{0}', github.event.release.tag_name) || github.sha }}
          fetch-depth: 0

      - name: Dump Platform Info
        working-directory: .github/workflows/tools/rustc-info
        run: cargo run --locked --quiet
        env:
          CARGO_BUILD_TARGET: ${{ matrix.platform.target }}
          CARGO_PROFILE_RELEASE_DEBUG: true
          RUST_BACKTRACE: 1

      - name: Test and Build Application
        run: make
        env:
          CARGO_BUILD_TARGET: ${{ matrix.platform.target }}
          CARGO_PROFILE_RELEASE_DEBUG: true
          RUST_BACKTRACE: 1

  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Audit
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  audit:
    name: Audit
    needs: build

    runs-on: ubuntu-26.04
    steps:
      - name: Install Rust Toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v2
        with:
          toolchain: 1.99.1
          components: llvm-tools-preview
          cache: false

      - name: Install Cargo Audit
        uses: taiki-e/install-action@cargo-audit

      - name: Checkout
        uses: actions/checkout@v7
        with:
          ref: ${{ github.event.release.tag_name && format('refs/tags/{0}', github.event.release.tag_name) || github.sha }}
          fetch-depth: 0

      - name: Cargo Audit
        run: make audit
        env:
          CARGO_PROFILE_RELEASE_DEBUG: true
          RUST_BACKTRACE: 1

  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Code coverage
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  codecov:
    name: Codecov
    needs: build

    runs-on: ubuntu-26.04
    steps:
      - name: Install Rust Toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v2
        with:
          toolchain: 1.99.1
          components: llvm-tools-preview
          cache: false

      - name: Install Cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Checkout
        uses: actions/checkout@v7
        with:
          ref: ${{ github.event.release.tag_name && format('refs/tags/{0}', github.event.release.tag_name) || github.sha }}
          fetch-depth: 0

      - name: Code Coverage Analysis
        run: make codecov
        env:
          CARGO_PROFILE_RELEASE_DEBUG: true
          RUST_BACKTRACE: 1

      - name: Upload to Codecov
        uses: codecov/codecov-action@v7
        with:
          files: target/codecov-output.info
          verbose: true
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}

  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # Publish to crates.io
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  publish:
    name: Publish
    needs: [audit, codecov]
    if: ${{ github.event_name == 'release' }}

    runs-on: ubuntu-26.04
    steps:
      - name: Install Rust Toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v2
        with:
          toolchain: 1.99.1
          cache: false

      - name: Checkout
        uses: actions/checkout@v7
        with:
          ref: ${{ github.event.release.tag_name && format('refs/tags/{0}', github.event.release.tag_name) || github.sha }}
          fetch-depth: 0

      - name: Publish Application to crates.io
        run: make publish
        env:
          CARGO_PROFILE_RELEASE_DEBUG: true
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
          RUST_BACKTRACE: 1