CI tests #75
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: CI | |
on: | |
merge_group: | |
push: | |
branches: [main] | |
pull_request: | |
branches: ["*"] | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
compile: | |
name: Compile | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Rustup toolchain install | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: wasm32-unknown-unknown | |
- name: Run cargo check | |
run: cd tests && cargo check | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
run: cd tests && cargo fmt --all -- --check | |
- name: Run clippy | |
run: cd tests && cargo clippy --all-targets --all-features -- -D warnings | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: "era-test-node: setup" | |
run: make setup | |
- name: "era-test-node: Copy our precompiles to the system-contracts" | |
run: cp -r precompiles/ submodules/era-test-node/etc/system-contracts/contracts/precompiles | |
- name: "era-test-node: build precompiles" | |
working-directory: submodules/era-test-node | |
run: make build-precompiles | |
- name: "era-test-node: start" | |
working-directory: submodules/era-test-node | |
# The usage of `nohup ... &` guarantees that the server will keep on | |
# running after | |
run: nohup cargo run -- --show-calls=all --resolve-hashes run > era-test-node.log 2>&1 & | |
- name: "era-test-node: Sleep before server is ready" | |
run: sleep 1m # Yes, this is a duck-tape solution. | |
- name: "Run tests" | |
working-directory: tests | |
run: cargo test | |
# Make the Era logs available us. | |
- name: "era-test-node: logs" | |
# Yes, I'm aware that using `always()` will execute this step regardless of | |
# whether the job was canceled. However, this is not an issue since it's | |
# just a `cat` command. | |
if: always() | |
working-directory: submodules/era-test-node | |
run: cat era-test-node.log |