Fix compile + format code #726
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Openmina CI | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
ledger-tests: | |
runs-on: ubuntu-20.04 | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
run: | | |
# Nightly to be able to use `--report-time` below | |
rustup install nightly | |
rustup override set nightly | |
- name: Download circuits files | |
run: | | |
git clone --depth 1 https://github.com/openmina/circuit-blobs.git | |
ln -s -b $PWD/circuit-blobs/* ledger/ | |
- name: Build ledger tests | |
run: | | |
cd ledger | |
cargo build --release --tests | |
- name: Run ledger tests | |
run: | | |
cd ledger | |
cargo test --release -- -Z unstable-options --report-time | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
run: | | |
rustup install 1.75 | |
rustup override set 1.75 | |
rustup component add clippy rustfmt | |
# - name: Check | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: check | |
# - name: Clippy | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: clippy | |
# # don't fail the job until clippy is fixed | |
# continue-on-error: true | |
- name: Setup Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "ver-0" | |
- name: Release build | |
run: | | |
cargo build --release --bin openmina | |
- name: Upload binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bin | |
path: target/release/openmina | |
- name: Build tests | |
run: | | |
mkdir target/release/tests | |
cargo build --release --features=scenario-generators --package=openmina-node-testing --tests | |
cargo build --release --features=scenario-generators --package=openmina-node-testing --tests --message-format=json > cargo-build-test.json | |
jq -r '. | select(.executable != null and (.target.kind | (contains(["test"])))) | [.target.name, .executable ] | @tsv' cargo-build-test.json > tests.tsv | |
while read NAME FILE; do cp -a $FILE target/release/tests/$NAME; done < tests.tsv | |
cargo build --release --features=scenario-generators,p2p-webrtc --package=openmina-node-testing --tests | |
cargo build --release --features=scenario-generators,p2p-webrtc --package=openmina-node-testing --tests --message-format=json > cargo-build-test.json | |
jq -r '. | select(.executable != null and (.target.kind | (contains(["test"])))) | [.target.name, .executable ] | @tsv' cargo-build-test.json > tests.tsv | |
while read NAME FILE; do cp -a $FILE target/release/tests/webrtc_$NAME; done < tests.tsv | |
cargo build --release --features=scenario-generators,p2p-libp2p --package=openmina-node-testing --tests | |
cargo build --release --features=scenario-generators,p2p-libp2p --package=openmina-node-testing --tests --message-format=json > cargo-build-test.json | |
jq -r '. | select(.executable != null and (.target.kind | (contains(["test"])))) | [.target.name, .executable ] | @tsv' cargo-build-test.json > tests.tsv | |
while read NAME FILE; do cp -a $FILE target/release/tests/libp2p_$NAME; done < tests.tsv | |
tar cf tests.tar -C target/release/tests . | |
- name: Upload tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tests | |
path: tests.tar | |
p2p-tests: | |
needs: [ build ] | |
runs-on: ubuntu-20.04 | |
container: | |
image: minaprotocol/mina-daemon:2.0.0berkeley-rc1-1551e2f-focal-berkeley | |
strategy: | |
matrix: | |
test: [p2p_basic_connections, p2p_basic_incoming, p2p_basic_outgoing] | |
libp2p: ['external', 'internal'] | |
fail-fast: false | |
env: | |
TEST: ${{ matrix.libp2p == 'external' && format('libp2p_{0}', matrix.test) || matrix.test }} | |
steps: | |
- name: Download tests | |
uses: actions/download-artifact@v3 | |
with: | |
name: tests | |
- name: Unpack tests | |
run: | | |
tar xf tests.tar ./${{ env.TEST }} | |
- name: Run the test | |
run: | | |
./${{ env.TEST }} --nocapture --test-threads=1 | |
scenario-tests: | |
needs: [ build ] | |
runs-on: ubuntu-20.04 | |
container: | |
image: minaprotocol/mina-daemon:2.0.0berkeley-rc1-1551e2f-focal-berkeley | |
strategy: | |
matrix: | |
test: [single_node, multi_node, connection_discovery, webrtc_single_node, webrtc_multi_node] | |
fail-fast: false | |
steps: | |
- name: Download tests | |
uses: actions/download-artifact@v3 | |
with: | |
name: tests | |
- name: Unpack tests | |
run: | | |
tar xf tests.tar ./${{ matrix.test }} | |
- name: Run the test | |
run: | | |
./${{ matrix.test }} --nocapture --test-threads=1 |