From 37e4b153bd5d6df376832022386835b8058ddf33 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 30 Oct 2023 20:35:08 +0000 Subject: [PATCH] chore: cleanup CI workflows to be more consistent --- .github/workflows/test-abi_wasm.yml | 14 ++---- .github/workflows/test-acvm-js.yml | 13 ++--- .github/workflows/test-integration.yml | 69 +++----------------------- .github/workflows/test-noir_wasm.yml | 14 ++---- cspell.json | 1 + 5 files changed, 22 insertions(+), 89 deletions(-) diff --git a/.github/workflows/test-abi_wasm.yml b/.github/workflows/test-abi_wasm.yml index 7fecb66fd7f..adc229b6b88 100644 --- a/.github/workflows/test-abi_wasm.yml +++ b/.github/workflows/test-abi_wasm.yml @@ -15,23 +15,17 @@ concurrency: jobs: build: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v3 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build noirc_abi_wasm run: | diff --git a/.github/workflows/test-acvm-js.yml b/.github/workflows/test-acvm-js.yml index c69f4995198..9e17be5a26f 100644 --- a/.github/workflows/test-acvm-js.yml +++ b/.github/workflows/test-acvm-js.yml @@ -19,15 +19,12 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v20 + - name: Setup Nix + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-22.11 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build acvm-js run: | diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index ad0caf15f47..3def7442f96 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -45,40 +45,22 @@ jobs: build-wasm: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v4 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build wasm package run: | nix build -L .#noir_wasm - - name: Export cache from nix store - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - run: | - nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd¶llel-compression=true" .#noir-wasm-cargo-artifacts - - - uses: actions/cache/save@v3 - # Don't create cache entries for the merge queue. - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - with: - path: ${{ env.CACHED_PATH }} - key: ${{ steps.cache.outputs.cache-primary-key }} - - name: Dereference symlink run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV @@ -91,40 +73,17 @@ jobs: build-noirc: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v3 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - - name: Restore nix store cache - uses: actions/cache/restore@v3 - id: cache - with: - path: ${{ env.CACHED_PATH }} - key: ${{ runner.os }}-flake-abi-wasm-${{ hashFiles('*.lock') }} - - # Based on https://github.com/marigold-dev/deku/blob/b5016f0cf4bf6ac48db9111b70dd7fb49b969dfd/.github/workflows/build.yml#L26 - - name: Copy cache into nix store - if: steps.cache.outputs.cache-hit == 'true' - # We don't check the signature because we're the one that created the cache - run: | - for narinfo in ${{ env.CACHED_PATH }}/*.narinfo; do - path=$(head -n 1 "$narinfo" | awk '{print $2}') - nix copy --no-check-sigs --from "file://${{ env.CACHED_PATH }}" "$path" - done + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build noirc_abi_wasm run: | @@ -132,18 +91,6 @@ jobs: cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm - - name: Export cache from nix store - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - run: | - nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd¶llel-compression=true" .#noirc-abi-wasm-cargo-artifacts - - - uses: actions/cache/save@v3 - # Don't create cache entries for the merge queue. - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - with: - path: ${{ env.CACHED_PATH }} - key: ${{ steps.cache.outputs.cache-primary-key }} - - name: Dereference symlink run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV diff --git a/.github/workflows/test-noir_wasm.yml b/.github/workflows/test-noir_wasm.yml index 900ca5872ff..caafe6b91db 100644 --- a/.github/workflows/test-noir_wasm.yml +++ b/.github/workflows/test-noir_wasm.yml @@ -49,23 +49,17 @@ jobs: build-wasm: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v4 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build wasm package run: | diff --git a/cspell.json b/cspell.json index 4df858ffcfa..9c5de0c8d40 100644 --- a/cspell.json +++ b/cspell.json @@ -15,6 +15,7 @@ "bitand", "blackbox", "brillig", + "cachix", "callsite", "callsites", "canonicalize",