Merge branch 'main' into liquidity-orderbook-develop #2076
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: Rust | |
on: [push] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
find-contracts: # Job that list subdirectories | |
runs-on: ubuntu-latest | |
outputs: | |
dir: ${{ steps.set-dirs.outputs.dir }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: set-dirs | |
run: echo "::set-output name=dir::$(find ./contracts -name Cargo.toml | jq -R -s -c 'split("\n")[:-1]')" | |
build-contracts: | |
runs-on: ubuntu-latest | |
needs: [find-contracts] # Depends on previous job | |
strategy: | |
matrix: | |
dir: ${{fromJson(needs.find-contracts.outputs.dir)}} # List matrix strategy from directories dynamically | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: wasm32-unknown-unknown | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install toolchain | |
run: rustup target add wasm32-unknown-unknown | |
- uses: actions-rs/[email protected] | |
with: | |
command: build | |
args: --release --target wasm32-unknown-unknown --manifest-path=${{matrix.dir}} | |
find-packages: # Job that list subdirectories | |
runs-on: ubuntu-latest | |
outputs: | |
dir: ${{ steps.set-dirs.outputs.dir }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: set-dirs | |
run: echo "::set-output name=dir::$(find ./packages/ -name Cargo.toml | jq -R -s -c 'split("\n")[:-1]')" | |
check-packages: | |
runs-on: ubuntu-latest | |
needs: [find-packages] # Depends on previous job | |
strategy: | |
matrix: | |
dir: ${{fromJson(needs.find-packages.outputs.dir)}} # List matrix strategy from directories dynamically | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: wasm32-unknown-unknown | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions-rs/[email protected] | |
with: | |
command: check | |
coverage: | |
name: Collect test coverage | |
runs-on: ubuntu-latest | |
# nightly rust might break from time to time | |
continue-on-error: true | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: wasm32-unknown-unknown | |
components: llvm-tools-preview | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Collect coverage data | |
run: cargo llvm-cov nextest --lcov --output-path lcov.info --ignore-filename-regex network_integration\|network_tester\|secretcli\|contract_harness | |
- name: Upload coverage data to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: lcov.info |