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 b02feb0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 76 deletions.
36 changes: 22 additions & 14 deletions .github/actions/nix_installer_and_cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
name: Nix Installer
description: Nix Installer
outputs:
cache-hit:
description: "Indicate if cache is hit"
value: ${{ steps.nix-cache.outputs.cache-hit }}

runs:
using: composite
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@3ebd1aebb47f95493b62de6eec0cac3cd74e50a9
- name: Set Permission
run: |
# Create with liberal rights, otherwise cache action will complain
# about permission errors.
sudo mkdir -p /nix/store
sudo chmod -R 777 /nix
- name: Cache Nix Store
- name: Cache nix env take N+1
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
id: nix-cache
with:
path: /tmp/nixcache
key: cache-nix-${{ github.workflow }}-${{ github.job }}-${{ hashFiles('**/flake.lock') }}
path: |
# See https://github.com/actions/cache/pull/726
/nix/store/**
# Missing something?
/nix/var/nix/*/*
/nix/var/nix/db/*
/nix/var/nix/db/*/**
!/nix/var/nix/daemon-socket/socket
!/nix/var/nix/userpool/*
!/nix/var/nix/gc.lock
!/nix/var/nix/db/big-lock
!/nix/var/nix/db/reserved
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
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@3ebd1aebb47f95493b62de6eec0cac3cd74e50a9
13 changes: 0 additions & 13 deletions .github/actions/upload_nix_store/action.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ jobs:
with:
ref: ${{ github.event.inputs.commit_sha }}
- uses: ./.github/actions/nix_installer_and_cache
id: nix-installer
- uses: ./.github/actions/elixir_cache
- run: make test
working-directory: implementations/elixir
- run: make lint
working-directory: implementations/elixir
- uses: ./.github/actions/upload_nix_store
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}
2 changes: 1 addition & 1 deletion .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
ref: ${{ github.event.inputs.commit_sha }}
- uses: ./.github/actions/nix_installer
- uses: ./.github/actions/nix_installer_and_cache
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
- uses: ./.github/actions/elixir_cache
- run: make
44 changes: 0 additions & 44 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,13 @@ jobs:

- name: Install Nix
uses: ./.github/actions/nix_installer_and_cache
id: nix-installer

- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
key: "${{ github.job }}-${{ matrix.lint_projects }}"

- name: Run lint ${{ matrix.lint_projects }}
run: make -f implementations/rust/Makefile lint_${{ matrix.lint_projects }}

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


build:
Expand Down Expand Up @@ -115,7 +108,6 @@ jobs:

- name: Install Nix
uses: ./.github/actions/nix_installer_and_cache
id: nix-installer

- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
Expand All @@ -124,11 +116,6 @@ jobs:
- name: Run build ${{ matrix.build_projects }}
run: make -f implementations/rust/Makefile ${{ matrix.make_name }}

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


test:
name: Rust - test${{ matrix.test_projects != 'stable' && format('_{0}', matrix.test_projects) || '' }}
Expand All @@ -154,7 +141,6 @@ jobs:

- name: Install Nix
uses: ./.github/actions/nix_installer_and_cache
id: nix-installer

- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
Expand All @@ -163,11 +149,6 @@ jobs:
- name: Run test on ${{ matrix.test_projects }}
run: make -f implementations/rust/Makefile test

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


check:
name: Rust - check_${{ matrix.check_projects }}
Expand Down Expand Up @@ -195,7 +176,6 @@ jobs:

- name: Install Nix
uses: ./.github/actions/nix_installer_and_cache
id: nix-installer

- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
Expand All @@ -204,12 +184,6 @@ jobs:
- name: Run check on ${{ 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
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}
test_ockam_command:
Expand Down Expand Up @@ -243,7 +217,6 @@ jobs:

- name: Install Nix
uses: ./ockam_bats/.github/actions/nix_installer_and_cache
id: nix-installer

- name: Build Binary
working-directory: ockam_cli
Expand All @@ -269,11 +242,6 @@ jobs:
OCKAM_DISABLE_UPGRADE_CHECK: 1
BATS_TEST_RETRIES: 2

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

ockam_command_cross_build:
name: Rust - ockam_command_cross_build
strategy:
Expand Down Expand Up @@ -344,7 +312,6 @@ jobs:

- name: Install Nix
uses: ./ockam_library/.github/actions/nix_installer_and_cache
id: nix-installer

- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
Expand All @@ -359,11 +326,6 @@ jobs:
shell: nix develop ./tools/nix#rust --keep CI --ignore-environment --command bash {0}
run: cargo test -p hello_ockam

- uses: ./ockam_library/.github/actions/upload_nix_store
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
runs-on: ubuntu-22.04
Expand All @@ -383,7 +345,6 @@ jobs:

- name: Install Nix
uses: ./ockam/.github/actions/nix_installer_and_cache
id: nix-installer

- name: Build Example Blocks
working-directory: ockam
Expand All @@ -393,9 +354,4 @@ jobs:
- name: Check Rust Documentation
run: |
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
with:
flake_nix_path: ./tools/nix
if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }}
2 changes: 1 addition & 1 deletion .github/workflows/shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
ref: ${{ github.event.inputs.commit_sha }}

- name: Install Nix
uses: ./.github/actions/nix_installer
uses: ./.github/actions/nix_installer_and_cache

- name: Run Shfmt Check
run: nix run ./tools/nix#shfmt-all

0 comments on commit b02feb0

Please sign in to comment.