From 27f491b94ea1806d7e3f8f6ad8ab2773dd7823a2 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Tue, 24 Oct 2023 11:01:04 +0200 Subject: [PATCH] init: ci --- .github/workflows/ci.yml | 63 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 1 + 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4588d1e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: "ci" + +on: + workflow_dispatch: # allows manual triggering + pull_request: + branches: [ main ] + paths-ignore: + - '**.md' + push: + branches: [ main ] + paths-ignore: + - '**.md' + merge_group: + +jobs: + develop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Nix Flakes doesn't work on shallow clones + - uses: cachix/install-nix-action@v23 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - uses: cachix/cachix-action@v12 + with: + name: kenji + # If you chose API tokens for write access OR if you have a private cache + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - uses: DeterminateSystems/magic-nix-cache-action@v2 + with: + diagnostic-endpoint: "" + # rust-cache needs rust version in scope + - name: "develop" + run: nix develop --command bash + - uses: Swatinem/rust-cache@v2 + with: + # To only cache runs from `main`: + save-if: ${{ github.ref == 'refs/heads/main' }} + - name: "build" + run: nix develop --command cargo build --all + + nix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Nix Flakes doesn't work on shallow clones + - uses: cachix/install-nix-action@v23 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - uses: cachix/cachix-action@v12 + with: + name: kenji + # If you chose API tokens for write access OR if you have a private cache + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - uses: DeterminateSystems/magic-nix-cache-action@v2 + with: + diagnostic-endpoint: "" + - name: "flake check" + run: nix flake check -Lvv --no-update-lock-file diff --git a/flake.nix b/flake.nix index a383559..a0dd959 100644 --- a/flake.nix +++ b/flake.nix @@ -111,6 +111,7 @@ }; checks.${system} = { inherit (self.outputs.packages.${system}) default index-git-repositories; + shell = self.outputs.devShells.${system}.default; inherit cargoClippy; }; };