Skip to content

Commit

Permalink
ci: test
Browse files Browse the repository at this point in the history
  • Loading branch information
metaclips committed Sep 29, 2023
1 parent 8554b4e commit 29f8884
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
8 changes: 5 additions & 3 deletions .github/actions/nix_installer_and_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ runs:
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@3ebd1aebb47f95493b62de6eec0cac3cd74e50a9

- name: Cache Nix Store
uses: actions/cache@67b839edb68371cc5014f6cea11c9aa77238de78
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
id: nix-cache
with:
path: /tmp/nixcache
key: cache-nix-${{ github.workflow }}-${{ github.job }}-${{ hashFiles('**/flake.lock') }}

- name: Restore Nix Cache
shell: bash
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: nix-store --import < /tmp/nixcache
if: steps.nix-cache.outputs.cache-hit == 'true'
run: nix copy --from /tmp/nixcache
7 changes: 6 additions & 1 deletion .github/actions/upload_nix_store/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Nix Store Upload
description: Nix Store Upload
inputs:
flake_nix_path:
description: Flake Nix Path
required: true

runs:
using: composite
steps:
- name: Cache Nix store
run: nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache
shell: bash
run: nix copy --to /tmp/nixcache ${{ inputs.flake_nix_path }}
2 changes: 1 addition & 1 deletion .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ jobs:
- run: make lint
working-directory: implementations/elixir
- uses: ./.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}
32 changes: 24 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ jobs:

- name: Upload Nix Store
uses: ./.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}


build:
Expand Down Expand Up @@ -123,7 +125,9 @@ jobs:
run: make -f implementations/rust/Makefile ${{ matrix.make_name }}

- uses: ./.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}


test:
Expand Down Expand Up @@ -160,7 +164,9 @@ jobs:
run: make -f implementations/rust/Makefile test

- uses: ./.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}


check:
Expand Down Expand Up @@ -196,10 +202,14 @@ jobs:
key: "${{ github.job }}-${{ matrix.check_projects }}"

- name: Run check on ${{ matrix.check_projects }}
run: make -f implementations/rust/Makefile check${{ matrix.check_projects != 'nightly' && format('_{0}', matrix.check_projects) || '' }}
run: |
make -f implementations/rust/Makefile check${{ matrix.check_projects != 'nightly' && format('_{0}', matrix.check_projects) || '' }}
echo "kkddkk ${{ steps.nix-installer.outputs.cache-hit }}"
- uses: ./.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}


test_ockam_command:
Expand Down Expand Up @@ -260,7 +270,9 @@ jobs:
BATS_TEST_RETRIES: 2

- uses: ./ockam_bats/.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}

ockam_command_cross_build:
name: Rust - ockam_command_cross_build
Expand Down Expand Up @@ -348,7 +360,9 @@ jobs:
run: cargo test -p hello_ockam

- uses: ./ockam_library/.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}

lint_docs_ockam_io_rust_examples:
name: Rust - lint_docs_ockam_io_rust_examples
Expand Down Expand Up @@ -381,5 +395,7 @@ jobs:
CHECK_MD_DIR="ockam-documentation/reference/libraries/rust" CHECK_MD_DIR_RUST_EXAMPLE="ockam/examples/rust/get_started" OCKAM_HOME="ockam" ockam/tools/docs/check_documentation.sh
- uses: ./ockam/.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit == 'false' }}
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}

0 comments on commit 29f8884

Please sign in to comment.