From 8b207d0824f1d3b8c2226a394af3439dc6ddce90 Mon Sep 17 00:00:00 2001 From: Ivan Zatevakhin Date: Wed, 16 Sep 2026 12:39:33 +0100 Subject: [PATCH] feat: add linear GitHub Actions CI Run format, clippy, tests, release-bin smoke, and nix develop tests in a single needs chain. Pin flake.lock so the nix job is reproducible. --- .github/workflows/ci.yml | 125 +++++++++++++++++++++++++++++++++++++++ flake.lock | 96 ++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 flake.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4f1c195 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,125 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + format: + name: Check formatting + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Check formatting + run: cargo fmt --all -- --check + + clippy: + name: Clippy lints + runs-on: ubuntu-latest + timeout-minutes: 20 + needs: [format] + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: Cache Cargo dependencies + uses: swatinem/rust-cache@v2 + + - name: Run Clippy + run: cargo clippy --all-targets --all-features -- -D warnings + + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 20 + needs: [clippy] + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache Cargo dependencies + uses: swatinem/rust-cache@v2 + + - name: Run tests + run: cargo test --all-targets --all-features + + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 20 + needs: [test] + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache Cargo dependencies + uses: swatinem/rust-cache@v2 + + - name: Build release binary + run: cargo build --release --bin qmtacp + + - name: Smoke CLI help + run: ./target/release/qmtacp --help + + nix: + name: Nix + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: [build] + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Enable Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + use-flakehub: false + + - name: Check Nix formatting + run: nix run nixpkgs#alejandra -- --check . + + - name: Test in flake devShell + run: nix develop --command cargo test --all-targets --all-features diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a6670a1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1788450739, + "narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1789426278, + "narHash": "sha256-GnotcvKtbTMnoVx6G4E7ZdUX6487Dky74dqq3pU7iRk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "efe6f071ede9d21c37462d2d6682d5e670099684", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1788057806, + "narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1789543870, + "narHash": "sha256-45ikFmtfgBZgMePIm4GevJ9VjDSWO3PGQgOuuwHDpes=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "35ca0490d13a3d38c4602d0eb9600a30fa63a367", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +}