From de3ec75899e4b2ae43623377fdd2404aef000d34 Mon Sep 17 00:00:00 2001 From: Michael Uti Date: Mon, 2 Oct 2023 13:49:01 +0100 Subject: [PATCH] ci: test --- .../actions/nix_installer_and_cache/action.yml | 11 ++++++++--- .github/actions/upload_nix_store/action.yml | 5 ++++- .github/workflows/rust.yml | 16 +++++++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/actions/nix_installer_and_cache/action.yml b/.github/actions/nix_installer_and_cache/action.yml index a7da03f61b0..17632c4c091 100644 --- a/.github/actions/nix_installer_and_cache/action.yml +++ b/.github/actions/nix_installer_and_cache/action.yml @@ -1,5 +1,10 @@ name: Nix Installer description: Nix Installer +inputs: + flake_nix_path: + description: Flake Nix Path + required: true + outputs: cache-hit: description: "Indicate if cache is hit" @@ -16,9 +21,9 @@ runs: id: nix-cache with: path: /tmp/nixcache - key: cache-nix-${{ github.workflow }}-${{ github.job }}-${{ hashFiles('**/flake.lock') }} + key: cache-nix-${{ hashFiles('**/flake.lock') }} - name: Restore Nix Cache shell: bash - if: steps.nix-cache.outputs.cache-hit == 'true' - run: nix copy --from /tmp/nixcache + if: "steps.nix-cache.outputs.cache-hit == 'true'" + run: nix copy --from file:///tmp/nixcache ${{ inputs.flake_nix_path }}#devShells.x86_64-linux.default --no-check-sigs diff --git a/.github/actions/upload_nix_store/action.yml b/.github/actions/upload_nix_store/action.yml index 7a207628242..07b77bf766b 100644 --- a/.github/actions/upload_nix_store/action.yml +++ b/.github/actions/upload_nix_store/action.yml @@ -10,4 +10,7 @@ runs: steps: - name: Cache Nix store shell: bash - run: nix copy --to /tmp/nixcache ${{ inputs.flake_nix_path }} + run: | + for o in $(nix-build --no-out-link -A deps); do + nix copy --to file:///tmp/nixcache ${{ inputs.flake_nix_path }}#devShells.x86_64-linux.default --no-check-sigs $o + done diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d1e6cca0269..2fae945e6e9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -72,6 +72,8 @@ jobs: - name: Install Nix uses: ./.github/actions/nix_installer_and_cache + with: + flake_nix_path: ./tools/nix id: nix-installer - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 @@ -115,6 +117,8 @@ jobs: - name: Install Nix uses: ./.github/actions/nix_installer_and_cache + with: + flake_nix_path: ./tools/nix id: nix-installer - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 @@ -154,6 +158,8 @@ jobs: - name: Install Nix uses: ./.github/actions/nix_installer_and_cache + with: + flake_nix_path: ./tools/nix id: nix-installer - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 @@ -195,6 +201,8 @@ jobs: - name: Install Nix uses: ./.github/actions/nix_installer_and_cache + with: + flake_nix_path: ./tools/nix id: nix-installer - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 @@ -243,6 +251,8 @@ jobs: - name: Install Nix uses: ./ockam_bats/.github/actions/nix_installer_and_cache + with: + flake_nix_path: ./ockam_bats/tools/nix id: nix-installer - name: Build Binary @@ -344,6 +354,8 @@ jobs: - name: Install Nix uses: ./ockam_library/.github/actions/nix_installer_and_cache + with: + flake_nix_path: ./ockam_library/tools/nix id: nix-installer - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 @@ -383,6 +395,8 @@ jobs: - name: Install Nix uses: ./ockam/.github/actions/nix_installer_and_cache + with: + flake_nix_path: ./ockam/tools/nix id: nix-installer - name: Build Example Blocks @@ -396,6 +410,6 @@ jobs: - uses: ./ockam/.github/actions/upload_nix_store with: - flake_nix_path: ./tools/nix + flake_nix_path: ./ockam/tools/nix if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }} \ No newline at end of file