Skip to content

Commit

Permalink
Move nix related changes from crypto3 to parallel-crypto3.
Browse files Browse the repository at this point in the history
  • Loading branch information
martun committed Aug 1, 2024
1 parent bcaebf3 commit 8c0a9b0
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 304 deletions.
44 changes: 3 additions & 41 deletions .github/workflows/crypto3-testing-linux.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
name: Crypto3 Build and Test on Linux Platforms
name: Parallel-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:
Expand All @@ -20,11 +12,10 @@ jobs:
- name: Clean up after previous checkout
run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*;

- name: Checkout Crypto3
- name: Checkout parallel-Crypto3
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Checkout submodules to specified refs
if: inputs.submodules-refs != ''
Expand All @@ -37,37 +28,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=(
"containers-clang"
"math-clang"
"zk-clang"
"containers-gcc"
"math-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
51 changes: 3 additions & 48 deletions .github/workflows/crypto3-testing-mac.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,26 @@
name: Crypto3 Build and Test on macOS Platforms
name: Parallel-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"
runs-on: [macos-14]
steps:
- name: Checkout Crypto3
- name: Checkout Parallel-Crypto3
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=(
"containers-clang"
"math-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
26 changes: 4 additions & 22 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,16 @@ 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
name: Linux Parallel-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
name: macOS Parallel-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 }}
73 changes: 65 additions & 8 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8c0a9b0

Please sign in to comment.