Skip to content

Commit

Permalink
ci: test
Browse files Browse the repository at this point in the history
  • Loading branch information
metaclips committed Oct 2, 2023
1 parent 29f8884 commit de3ec75
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
11 changes: 8 additions & 3 deletions .github/actions/nix_installer_and_cache/action.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
5 changes: 4 additions & 1 deletion .github/actions/upload_nix_store/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 15 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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' }}

0 comments on commit de3ec75

Please sign in to comment.