Skip to content

Commit

Permalink
PoC for running PrivateKey generation in Github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Jan 14, 2025
1 parent 32c2439 commit 8f848a0
Show file tree
Hide file tree
Showing 9 changed files with 287 additions and 375 deletions.
264 changes: 132 additions & 132 deletions .github/workflows/build+test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,111 +11,111 @@ on:

jobs:

rustfmt:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check

check:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected] # Also test our Rust MSRV here.
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-features --tests --benches

test:
runs-on: ubuntu-22.04

steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
large-packages: false
- uses: actions/checkout@v4
- name: "Check for duplicate message IDs"
run: "! grep -rEoh --exclude-dir tests --exclude-dir target 'TYPE_ID: u16 = [^;]+;' | sort | uniq -d | grep '^'"
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
# Coverage is disabled for now since at the moment it has a considerable performance impact in the CI
#- name: Install cargo-llvm-cov
# run: cargo install cargo-llvm-cov
#- name: Remove possible stale artifacts
# run: cargo llvm-cov clean --workspace
#- name: Run test with coverage instrumentation
# run: cargo llvm-cov nextest --features=nimiq-zkp-component/test-prover
# Fixme: --doctest is not supported in stable. See:
# https://github.com/taiki-e/cargo-llvm-cov/tree/7448e48b438797efb446a98ebd8ff22d3fae5ebe#known-limitations
# run: cargo llvm-cov --features=nimiq-zkp-component/test-prover --doctests
#- name: Generate coverage report
# run: cargo llvm-cov report --lcov --output-path coverage.lcov
#- name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# files: coverage.lcov
# fail_ci_if_error: false
# flags: unittests
# name: Nimiq code coverage
# verbose: true
- name: Run tests
run: cargo nextest run --features=nimiq-zkp-component/test-prover
# Currently `nextest` doesn't support doctest so we have to run them apart
- name: Run doctest
run: cargo test --doc

clippy:
if: github.event_name != 'push' || github.event.pusher.name != 'dependabot[bot]'
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1
with:
name: Clippy Report
token: ${{ secrets.GITHUB_TOKEN }}
args: --release --all-features

web-client:
runs-on: ubuntu-22.04

steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
swap-storage: true
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Execute wasm unittests
working-directory: ./web-client
run: wasm-pack test --chrome --headless
# rustfmt:
# runs-on: ubuntu-22.04

# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@nightly
# with:
# components: rustfmt
# - run: cargo fmt --all -- --check

# check:
# runs-on: ubuntu-22.04

# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/[email protected] # Also test our Rust MSRV here.
# - uses: Swatinem/rust-cache@v2
# - run: cargo check --all-features --tests --benches

# test:
# runs-on: ubuntu-22.04

# steps:
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: true
# large-packages: false
# - uses: actions/checkout@v4
# - name: "Check for duplicate message IDs"
# run: "! grep -rEoh --exclude-dir tests --exclude-dir target 'TYPE_ID: u16 = [^;]+;' | sort | uniq -d | grep '^'"
# - uses: dtolnay/rust-toolchain@stable
# with:
# components: llvm-tools-preview
# - uses: Swatinem/rust-cache@v2
# - name: Install cargo-nextest
# run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
# # Coverage is disabled for now since at the moment it has a considerable performance impact in the CI
# #- name: Install cargo-llvm-cov
# # run: cargo install cargo-llvm-cov
# #- name: Remove possible stale artifacts
# # run: cargo llvm-cov clean --workspace
# #- name: Run test with coverage instrumentation
# # run: cargo llvm-cov nextest --features=nimiq-zkp-component/test-prover
# # Fixme: --doctest is not supported in stable. See:
# # https://github.com/taiki-e/cargo-llvm-cov/tree/7448e48b438797efb446a98ebd8ff22d3fae5ebe#known-limitations
# # run: cargo llvm-cov --features=nimiq-zkp-component/test-prover --doctests
# #- name: Generate coverage report
# # run: cargo llvm-cov report --lcov --output-path coverage.lcov
# #- name: Upload coverage to Codecov
# # uses: codecov/codecov-action@v3
# # with:
# # files: coverage.lcov
# # fail_ci_if_error: false
# # flags: unittests
# # name: Nimiq code coverage
# # verbose: true
# - name: Run tests
# run: cargo nextest run --features=nimiq-zkp-component/test-prover
# # Currently `nextest` doesn't support doctest so we have to run them apart
# - name: Run doctest
# run: cargo test --doc

# clippy:
# if: github.event_name != 'push' || github.event.pusher.name != 'dependabot[bot]'
# runs-on: ubuntu-22.04

# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# with:
# components: clippy
# - uses: Swatinem/rust-cache@v2
# - uses: actions-rs/clippy-check@v1
# with:
# name: Clippy Report
# token: ${{ secrets.GITHUB_TOKEN }}
# args: --release --all-features

# web-client:
# runs-on: ubuntu-22.04

# steps:
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# # this might remove tools that are actually needed,
# # if set to "true" but frees about 6 GB
# tool-cache: true

# # all of these default to true, but feel free to set to
# # "false" if necessary for your workflow
# android: true
# dotnet: true
# haskell: true
# large-packages: false
# swap-storage: true
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Install wasm-pack
# run: cargo install wasm-pack
# - name: Execute wasm unittests
# working-directory: ./web-client
# run: wasm-pack test --chrome --headless

web-client-lib:
runs-on: ubuntu-22.04
Expand All @@ -139,30 +139,30 @@ jobs:
run: yarn install
- name: Execute unittests
working-directory: ./web-client/extras
run: yarn test

reconnect-test:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install python dependencies
run: pip install scripts/devnet
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build the code
run: cargo build
- name: Executes the 4 validators reconnecting scenario
run: |
python3 scripts/devnet/devnet.py -t .github/devnet_topologies/four_validators.toml -r 1
- name: Archive test results
if: always()
uses: actions/upload-artifact@v4
with:
name: reconnect-test-logs
path: |
temp-logs/
run: yarn test PrivateKey

# reconnect-test:
# runs-on: ubuntu-22.04

# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.8'
# - name: Install python dependencies
# run: pip install scripts/devnet
# - name: Set up Rust toolchain
# uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Build the code
# run: cargo build
# - name: Executes the 4 validators reconnecting scenario
# run: |
# python3 scripts/devnet/devnet.py -t .github/devnet_topologies/four_validators.toml -r 1
# - name: Archive test results
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: reconnect-test-logs
# path: |
# temp-logs/
Loading

0 comments on commit 8f848a0

Please sign in to comment.