Skip to content

chore: update dependencies, fix optional deps #488

chore: update dependencies, fix optional deps

chore: update dependencies, fix optional deps #488

Workflow file for this run

name: Rust
on:
merge_group:
push:
branches:
- "dev"
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Detect changes in each light client crate
changes:
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'packages' output variable
packages: ${{ steps.filter.outputs.changes }}
aptos: ${{ steps.filter.outputs.aptos }}
ethereum: ${{ steps.filter.outputs.ethereum }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
aptos:
- 'aptos/**'
ethereum:
- 'ethereum/**'
test:
needs: changes
runs-on: buildjet-16vcpu-ubuntu-2204
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
strategy:
matrix:
# Parse JSON array containing names of all changed light client packages
# e.g. ['aptos', 'ethereum'] if both directories contain changes
package: ${{ fromJSON(needs.changes.outputs.packages) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
repository: argumentcomputer/ci-workflows
- uses: ./.github/actions/ci-env
- uses: actions/checkout@v4
- name: Setup CI
uses: ./.github/actions/setup
# make sure benches don't bit-rot
- name: build benches
run: |
cargo check --benches --all-features
working-directory: ${{ github.workspace }}/${{ matrix.package }}/light-client
- name: Run cargo test in workspace
run: |
cargo nextest run --workspace --release --profile ci --all-features
working-directory: ${{ github.workspace }}/${{ matrix.package }}
clippy:
needs: changes
runs-on: buildjet-16vcpu-ubuntu-2204
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
strategy:
matrix:
# Parse JSON array containing names of all changed light client packages
# e.g. ['aptos', 'ethereum'] if both directories contain changes
package: ${{ fromJSON(needs.changes.outputs.packages) }}
steps:
- uses: actions/checkout@v4
with:
repository: argumentcomputer/ci-workflows
- uses: ./.github/actions/ci-env
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.REPO_TOKEN }}
- name: Setup CI
uses: ./.github/actions/setup
# See '.cargo/config' for list of enabled/disabled clippy lints
- name: rustfmt
run: cargo fmt --all --check
working-directory: ${{ github.workspace }}/${{ matrix.package }}
- name: cargo clippy
run: cargo xclippy -D warnings
working-directory: ${{ github.workspace }}/${{ matrix.package }}
- name: Doctests
run: |
cargo test --doc
working-directory: ${{ github.workspace }}/${{ matrix.package }}
- run: cargo install --locked cargo-deny
- name: Cargo-deny check
run: |
cargo deny --manifest-path ${{ matrix.package }}/Cargo.toml check
- name: Cargo-deny check programs
run: |
find ${{ matrix.package }}/programs -type d -name "target" -prune -o -type f -name "Cargo.toml" -exec cargo deny --manifest-path {} check \;
solidity-unit-tests:
needs: changes
runs-on: buildjet-16vcpu-ubuntu-2204
if: needs.changes.outputs.aptos == 'true'
steps:
- uses: actions/checkout@v4
with:
repository: argumentcomputer/ci-workflows
- uses: ./.github/actions/ci-env
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.REPO_TOKEN }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Check formatting
run: |
forge fmt --check
working-directory: ${{ github.workspace }}/aptos/solidity/contracts/
- name: Run Forge build
run: |
forge --version
forge build
working-directory: ${{ github.workspace }}/aptos/solidity/contracts/
- name: Run Forge tests
run: |
forge test
working-directory: ${{ github.workspace }}/aptos/solidity/contracts/
move-tests:
needs: changes
runs-on: buildjet-16vcpu-ubuntu-2204
if: needs.changes.outputs.ethereum == 'true'
steps:
- uses: actions/checkout@v4
with:
repository: argumentcomputer/ci-workflows
- uses: ./.github/actions/ci-env
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.REPO_TOKEN }}
- name: Install Move
run: |
python3 --version
curl -fsSL "https://aptos.dev/scripts/install_cli.py" | python3
echo "PATH=$HOME/.local/bin:$PATH" | tee -a $GITHUB_ENV
- name: Check Aptos account balance
id: check_balance
run: |
balance_output=$(aptos account balance --profile testnet)
echo "Balance output: $balance_output"
balance=$(echo $balance_output | jq '.Result[0].balance')
echo "Balance value: $balance"
if [ "$balance" -lt 100000000 ]; then
echo "Balance is below threshold. Funding the account..."
aptos account fund-with-faucet --profile testnet
else
echo "Balance is sufficient. No action needed."
fi
working-directory: ${{ github.workspace }}/ethereum/move
- name: Run unit tests
run: |
aptos move test --named-addresses plonk_verifier_addr=devnet
working-directory: ${{ github.workspace }}/ethereum/move
- name: Test verifier contract
run: |
aptos move create-resource-account-and-publish-package --address-name plonk_verifier_addr --profile testnet --seed $(openssl rand -hex 32) --assume-yes
for file in $(find "sources/fixtures" -name "fixture_*.json"); do
aptos move run-script --compiled-script-path build/plonk-verifier/bytecode_scripts/run_verification.mv --json-file $file --profile testnet --local --assume-yes >> out.txt
done
for outcome in $(grep "success" out.txt | awk '{ print $2 }'); do
if [[ "${outcome%?}" != "true" ]]; then
echo "Verification failed, exiting..."
exit 1
fi
done
working-directory: ${{ github.workspace }}/ethereum/move
cycle-count-regression:
needs: changes
runs-on: warp-ubuntu-latest-x64-32x
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
strategy:
matrix:
# Parse JSON array containing names of all changed light client packages
# e.g. ['aptos', 'ethereum'] if both directories contain changes
package: ${{ fromJSON(needs.changes.outputs.packages) }}
steps:
- uses: actions/checkout@v4
with:
repository: argumentcomputer/ci-workflows
- uses: ./.github/actions/ci-env
- uses: actions/checkout@v4
- name: Setup CI
uses: ./.github/actions/setup
- name: Set env
run: |
if [[ "${{ matrix.package }}" == "aptos" ]]; then
TESTS="test_execute_inclusion test_execute_epoch_change test_execute_sig"
FEATURES="--features aptos"
elif [[ "${{ matrix.package }}" == "ethereum" ]]; then
TESTS="test_execute_inclusion test_execute_committee_change"
FEATURES="--features ethereum"
fi
echo "TESTS=$TESTS" | tee -a $GITHUB_ENV
echo "FEATURES=$FEATURES" | tee -a $GITHUB_ENV
- name: Get cycle counts for PR
id: get_cycles_pr
run: |
CYCLE_COUNTS='[]'
set -o pipefail
for test_name in ${{ env.TESTS }}; do
cargo nextest run --verbose --release --profile ci ${{ env.FEATURES }} --package ${{ matrix.package }}-lc --no-capture -E "test($test_name)" 2>&1 | tee out.txt
num_cycles=$(cat out.txt | grep -o 'finished execution clk = [0-9]\+' | awk -F'= ' '{ print $2 }')
CYCLE_COUNTS=$(echo $CYCLE_COUNTS | jq -c ". += [{\"${test_name}\": \"$num_cycles\"}]")
done
set +o pipefail
echo "CYCLE_COUNTS=$CYCLE_COUNTS" | tee -a "$GITHUB_OUTPUT"
working-directory: ${{ github.workspace }}/${{ matrix.package }}/light-client
env:
RUST_LOG: debug
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Get cycle counts for base branch
id: regression-check
run: |
counter=0
CYCLE_COUNTS='${{ steps.get_cycles_pr.outputs.CYCLE_COUNTS }}'
echo "$CYCLE_COUNTS"
FAILING_TESTS=""
REGRESSION="false"
set -o pipefail
# TODO: Remove hardcoded test names
for test_name in ${{ env.TESTS }}; do
cargo nextest run --verbose --release --profile ci ${{ env.FEATURES }} --package ${{ matrix.package }}-lc --no-capture -E "test($test_name)" 2>&1 | tee out.txt
num_cycles_base=$(cat out.txt | grep -o 'finished execution clk = [0-9]\+' | awk -F'= ' '{ print $2 }')
num_cycles_pr=$(echo "$CYCLE_COUNTS" | jq ".[$counter] | to_entries | .[0].value")
echo "$test_name summary"
echo "Base = $num_cycles_base cycles, PR = ${num_cycles_pr:1:-1} cycles"
if [[ "$num_cycles_pr" > "$num_cycles_base" ]]; then
echo "Performance regression for test ${test_name}"
REGRESSION="true"
FAILING_TESTS+="\`${test_name}\`\n"
FAILING_TESTS+="Cycles before: ${num_cycles_base//\"/}\n"
FAILING_TESTS+="Cycles after: ${num_cycles_pr//\"/}\n"
fi
counter=$((counter + 1))
done
set +o pipefail
echo "regression=$REGRESSION" | tee -a $GITHUB_OUTPUT
echo "failing-tests<<EOF" >> $GITHUB_OUTPUT
echo -e "$FAILING_TESTS" | tee -a $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "WORKFLOW_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | tee -a $GITHUB_ENV
working-directory: ${{ github.workspace }}/${{ matrix.package }}/light-client
env:
RUST_LOG: debug
- uses: actions/checkout@v4
- name: Comment on failing run
if: steps.regression-check.outputs.regression == 'true' && github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Benchmark cycle count regression check failed :x:
${{ steps.regression-check.outputs.failing-tests }}
${{ env.WORKFLOW_URL }}
- uses: JasonEtco/create-an-issue@v2
if: steps.regression-check.outputs.regression == 'true' && github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_URL: ${{ env.WORKFLOW_URL }}
FAILING_TESTS: ${{ steps.regression-check.outputs.failing-tests }}
with:
update_existing: true
filename: .github/BENCH_CYCLE_REGRESSION.md