From 8a7a161677d6012b635b2621a8db0fa34ce33ed3 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 1 Jun 2023 19:50:23 +0200 Subject: [PATCH] nix ci --- .github/workflows/ci.yaml | 80 +++++++++++++++++---------------------- flake.nix | 2 +- 2 files changed, 36 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9e0ecdb..1a0d5f3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,69 +7,59 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - uses: icewind1991/attic-action@v1 with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 + name: ci + instance: https://cache.icewind.me + authToken: '${{ secrets.ATTIC_TOKEN }}' + - uses: Swatinem/rust-cache@v1 + - uses: lriesebos/nix-develop-command@6f5f4830884d1957767e920c51d6118c9b0ac828 with: - command: check + command: "cargo check" fmt: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - uses: icewind1991/attic-action@v1 with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 + name: ci + instance: https://cache.icewind.me + authToken: '${{ secrets.ATTIC_TOKEN }}' + - uses: Swatinem/rust-cache@v1 + - uses: lriesebos/nix-develop-command@6f5f4830884d1957767e920c51d6118c9b0ac828 with: - command: fmt - args: --all -- --check + command: "cargo fmt" clippy: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - uses: icewind1991/attic-action@v1 with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 + name: ci + instance: https://cache.icewind.me + authToken: '${{ secrets.ATTIC_TOKEN }}' + - uses: Swatinem/rust-cache@v1 + - uses: lriesebos/nix-develop-command@6f5f4830884d1957767e920c51d6118c9b0ac828 with: - command: clippy - args: -- -D warnings + command: "cargo clippy -D warnings" build: name: Build - runs-on: ubuntu-20.04 - + runs-on: ubuntu-latest steps: - - name: musl-tools - run: | - sudo apt-get install musl-tools - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - uses: icewind1991/attic-action@v1 with: - profile: minimal - toolchain: stable - override: true - target: x86_64-unknown-linux-musl - - uses: Swatinem/rust-cache@v1 - - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --target x86_64-unknown-linux-musl - - uses: actions/upload-artifact@v2 - with: - name: backup - path: target/x86_64-unknown-linux-musl/release/backup \ No newline at end of file + name: ci + instance: https://cache.icewind.me + authToken: '${{ secrets.ATTIC_TOKEN }}' + - run: nix build .#${{ matrix.target }} \ No newline at end of file diff --git a/flake.nix b/flake.nix index 6491830..7c1abbd 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ defaultApp = apps.demobackup; # `nix develop` - devShell = pkgs.mkShell { + devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ rustc cargo ]; }; }