mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-04-12 22:23:11 +00:00
275 lines
7.3 KiB
YAML
275 lines
7.3 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "!.github/workflows/*.yml"
|
|
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "!.github/workflows/*.yml"
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
name: General
|
|
|
|
jobs:
|
|
fmt-rs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- name: Install nightly toolchain for rustfmt
|
|
run: rustup install nightly --profile minimal --component rustfmt
|
|
|
|
- name: Check Rust files are formatted
|
|
run: cargo +nightly fmt --check
|
|
|
|
fmt-toml:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- name: Install taplo-cli
|
|
run: cargo install --locked taplo-cli
|
|
|
|
- name: Check TOML files are formatted
|
|
run: taplo fmt --check .
|
|
|
|
machete:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- name: Install active toolchain
|
|
run: rustup install
|
|
|
|
- name: Install cargo-machete
|
|
run: cargo install cargo-machete
|
|
|
|
- name: Check for unused dependencies
|
|
run: cargo machete
|
|
|
|
deny:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- name: Install cargo-deny
|
|
run: cargo install --locked cargo-deny
|
|
|
|
- name: Check licenses and advisories
|
|
run: cargo deny check
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
|
|
name: lint
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- uses: ./.github/actions/install-system-deps
|
|
|
|
- uses: ./.github/actions/install-risc0
|
|
|
|
- uses: ./.github/actions/install-logos-blockchain-circuits
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install active toolchain
|
|
run: rustup install
|
|
|
|
- name: Lint workspace
|
|
env:
|
|
RISC0_SKIP_BUILD: "1"
|
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
|
|
- name: Lint programs
|
|
env:
|
|
RISC0_SKIP_BUILD: "1"
|
|
run: cargo clippy -p "*programs" -- -D warnings
|
|
|
|
unit-tests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- uses: ./.github/actions/install-system-deps
|
|
|
|
- uses: ./.github/actions/install-risc0
|
|
|
|
- uses: ./.github/actions/install-logos-blockchain-circuits
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install active toolchain
|
|
run: rustup install
|
|
|
|
- name: Install nextest
|
|
run: cargo install --locked cargo-nextest
|
|
|
|
- name: Run tests
|
|
env:
|
|
RISC0_DEV_MODE: "1"
|
|
RUST_LOG: "info"
|
|
run: cargo nextest run --workspace --exclude integration_tests
|
|
|
|
integration-tests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- uses: ./.github/actions/install-system-deps
|
|
|
|
- uses: ./.github/actions/install-risc0
|
|
|
|
- uses: ./.github/actions/install-logos-blockchain-circuits
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install active toolchain
|
|
run: rustup install
|
|
|
|
- name: Install nextest
|
|
run: cargo install --locked cargo-nextest
|
|
|
|
- name: Run tests
|
|
env:
|
|
RISC0_DEV_MODE: "1"
|
|
RUST_LOG: "info"
|
|
run: cargo nextest run -p integration_tests -- --skip tps_test --skip indexer
|
|
|
|
integration-tests-indexer:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- uses: ./.github/actions/install-system-deps
|
|
|
|
- uses: ./.github/actions/install-risc0
|
|
|
|
- uses: ./.github/actions/install-logos-blockchain-circuits
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install active toolchain
|
|
run: rustup install
|
|
|
|
- name: Install nextest
|
|
run: cargo install --locked cargo-nextest
|
|
|
|
- name: Start container log capture
|
|
run: |
|
|
mkdir -p /tmp/container-logs
|
|
(
|
|
seen=""
|
|
while true; do
|
|
for c in $(docker ps -q 2>/dev/null); do
|
|
case " $seen " in
|
|
*" $c "*) ;;
|
|
*)
|
|
name=$(docker inspect -f '{{.Name}}' "$c" 2>/dev/null | sed 's|^/||')
|
|
docker logs -f "$c" >"/tmp/container-logs/${name}.log" 2>&1 &
|
|
seen="$seen $c"
|
|
;;
|
|
esac
|
|
done
|
|
sleep 1
|
|
done
|
|
) &
|
|
echo $! > /tmp/log-watcher.pid
|
|
|
|
- name: Run tests
|
|
env:
|
|
RISC0_DEV_MODE: "1"
|
|
RUST_LOG: "info"
|
|
run: cargo nextest run -p integration_tests indexer -- --skip tps_test
|
|
|
|
- name: Dump captured container logs on failure
|
|
if: failure()
|
|
run: |
|
|
kill "$(cat /tmp/log-watcher.pid)" 2>/dev/null || true
|
|
for f in /tmp/container-logs/*.log; do
|
|
[ -e "$f" ] || continue
|
|
echo "=== $f (lines: $(wc -l < $f)) ==="
|
|
echo "--- proposed-block events with removals ---"
|
|
grep -B 200 -A 5 -E '\([1-9][0-9]* removed\)' "$f" | tail -3000 || true
|
|
echo "--- mempool/tx/inscribe activity ---"
|
|
grep -i -E 'mempool|inscrib|verif|reject|invalid|gas|validate|removed' "$f" | tail -1000 || true
|
|
done
|
|
|
|
valid-proof-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- uses: ./.github/actions/install-system-deps
|
|
|
|
- uses: ./.github/actions/install-risc0
|
|
|
|
- uses: ./.github/actions/install-logos-blockchain-circuits
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install active toolchain
|
|
run: rustup install
|
|
|
|
- name: Test valid proof
|
|
env:
|
|
RUST_LOG: "info"
|
|
run: cargo test -p integration_tests -- --exact private::private_transfer_to_owned_account
|
|
|
|
artifacts:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
|
|
name: artifacts
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.head_ref }}
|
|
|
|
- uses: ./.github/actions/install-risc0
|
|
|
|
- name: Install just
|
|
run: cargo install just
|
|
|
|
- name: Build artifacts
|
|
run: just build-artifacts
|
|
|
|
- name: Check if artifacts match repository
|
|
run: |
|
|
if ! git diff --exit-code artifacts/; then
|
|
echo "❌ Artifacts in the repository are out of date!"
|
|
echo "Please run 'just build-artifacts' and commit the changes."
|
|
exit 1
|
|
fi
|
|
echo "✅ Artifacts are up to date"
|