Skip to content

Commit

Permalink
Move crypto3 derivation into a separate file, and clean it up
Browse files Browse the repository at this point in the history
This diff introduces the following changes:

- crypto3 derivation moved into a separate file, as per usual Nix guidelines
- enableDebug parameter added to crypto3 to switch debug modes on and off
- enableDebug will build boost with debug symbols
- flake-utils used to enumerate systems (as we do in nix-3rdparty)
- devShells dropped from the toplevel. please use shellHoook in crypto3.nix instead

This is all a set of standard practices to make your life easier and
code cleaner.

What still remains is to remove the hardcoding of test sets in the
flake.nix. This usually is not recommended to program a lot of
logic. The best place to do this would be in a shell script.
  • Loading branch information
knazarov committed Jul 9, 2024
1 parent 3bd5b8d commit ec75b39
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 628 deletions.
55 changes: 1 addition & 54 deletions .github/workflows/crypto3-testing-linux.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
name: Crypto3 Build and Test on Linux Platforms

on:
workflow_call:
inputs:
submodules-refs:
type: string
description: "Lines with submodules' repo names and refs (e.g. `org/repo: ref`)"
required: false

env:
TESTS_ARTIFACT_NAME: "test-results-linux"

jobs:
build-and-test:
name: "Build and test Linux"
Expand All @@ -24,7 +13,6 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Checkout submodules to specified refs
if: inputs.submodules-refs != ''
Expand All @@ -37,49 +25,8 @@ jobs:
!${{ github.workspace }}/**/.git/**
- name: Run checks
run: nix flake -L check .?submodules=1#
run: nix flake -L check
env:
NIX_CONFIG: |
cores = 6
max-jobs = 4
- name: Copy test results
run: |
check_names=(
"algebra-clang"
"containers-clang"
"hash-clang"
"marshalling-algebra-clang"
"marshalling-core-clang"
"marshalling-zk-clang"
"math-clang"
"pubkey-clang"
"zk-clang"
"algebra-gcc"
"containers-gcc"
"hash-gcc"
"marshalling-algebra-gcc"
"marshalling-core-gcc"
"marshalling-zk-gcc"
"math-gcc"
"pubkey-gcc"
"zk-gcc"
)
results_dir="./results"
mkdir -p "$results_dir"
for check_name in "${check_names[@]}"; do
# This completes immediately since results are in cache
nix build -L .?submodules=1#checks.x86_64-linux.$check_name
cp -r ./result/* "$results_dir/$check_name"
rm result
done
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
with:
check_name: "Linux Test Results"
files: "results/**/*.xml"
comment_mode: ${{ github.event.pull_request.head.repo.fork && 'off' || 'always' }} # Don't create PR comment from fork runs
action_fail_on_inconclusive: true # fail, if no reports
56 changes: 1 addition & 55 deletions .github/workflows/crypto3-testing-mac.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
name: Crypto3 Build and Test on macOS Platforms

on:
workflow_call:
inputs:
submodules-refs:
type: string
description: "Lines with submodules' repo names and refs (e.g. `org/repo: ref`)"
required: false

env:
TESTS_ARTIFACT_NAME: "test-results-mac"

jobs:
build-and-test:
name: "Build and test macOS"
Expand All @@ -20,58 +9,15 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Checkout submodules to specified refs
if: inputs.submodules-refs != ''
uses: NilFoundation/ci-cd/actions/[email protected]
with:
refs: ${{ inputs.submodules-refs }}
paths: |
${{ github.workspace }}/**
!${{ github.workspace }}/
!${{ github.workspace }}/**/.git/**

# From https://github.com/DeterminateSystems/magic-nix-cache-action
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main

- name: Run checks
run: nix flake -L check .?submodules=1#
run: nix flake -L check
env:
NIX_CONFIG: |
cores = 0
max-jobs = 1
- name: Copy test results
run: |
check_names=(
"algebra-clang"
"containers-clang"
"hash-clang"
"marshalling-algebra-clang"
"marshalling-core-clang"
"marshalling-zk-clang"
"math-clang"
"pubkey-clang"
"zk-clang"
)
results_dir="./results"
mkdir -p "$results_dir"
for check_name in "${check_names[@]}"; do
# This completes immediately since results are in cache
nix build -L .?submodules=1#checks.aarch64-darwin.$check_name
cp -r ./result/* "$results_dir/$check_name"
rm result
done
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
with:
check_name: "Mac Test Results"
files: "results/**/*.xml"
comment_mode: ${{ github.event.pull_request.head.repo.fork && 'off' || 'always' }} # Don't create PR comment from fork runs
action_fail_on_inconclusive: true # fail, if no reports
103 changes: 0 additions & 103 deletions .github/workflows/deploy_docs.yaml

This file was deleted.

18 changes: 2 additions & 16 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,20 @@ concurrency:
cancel-in-progress: true

jobs:
handle-syncwith:
if: github.event_name == 'pull_request'
name: Call Reusable SyncWith Handler
uses: NilFoundation/ci-cd/.github/workflows/[email protected]
with:
ci-cd-ref: 'v1.1.2'
secrets: inherit

test-linux:
name: Linux Crypto3 Testing
uses: ./.github/workflows/crypto3-testing-linux.yml
needs:
- handle-syncwith
if: |
always() && !cancelled() &&
(needs.handle-syncwith.result == 'success' || needs.handle-syncwith.result == 'skipped')
always() && !cancelled()
secrets: inherit
with:
submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }}

test-mac:
name: macOS Crypto3 Testing
uses: ./.github/workflows/crypto3-testing-mac.yml
needs:
- handle-syncwith
if: |
always() && !cancelled() &&
(needs.handle-syncwith.result == 'success' || needs.handle-syncwith.result == 'skipped')
always() && !cancelled()
secrets: inherit
with:
submodules-refs: ${{ needs.handle-syncwith.outputs.prs-refs }}
97 changes: 0 additions & 97 deletions .github/workflows/reusable-submodule-testing-linux.yml

This file was deleted.

Loading

0 comments on commit ec75b39

Please sign in to comment.