Skip to content

Merge pull request #42 from bchainhub/github-actions #21

Merge pull request #42 from bchainhub/github-actions

Merge pull request #42 from bchainhub/github-actions #21

Workflow file for this run

on:
push:
branches:
- master
pull_request:
name: test
env:
CARGO_TERM_COLOR: always
jobs:
build-tests:
name: build tests / ${{ matrix.archive.name }}
runs-on: ubuntu-latest
strategy:
matrix:
archive:
- name: unit-tests
file: nextest-unit.tar.zst
flags: --workspace --all-features --lib --bins
- name: integration-tests
file: nextest-integration.tar.zst
flags: --workspace
- name: external-integration-tests
file: nextest-external-integration.tar.zst
flags: -p foxar-cli --features external-integration-tests
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@nextest
- name: Build archive (unit tests)
run: |
cargo nextest archive \
--locked \
--archive-file ${{ matrix.archive.file }} \
${{ matrix.archive.flags }}
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.archive.name }}
path: ${{ matrix.archive.file }}
install-svm-solc:
name: install svm and solidity / ${{ matrix.job.name }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Install svm
run: cargo install svm-rs
- name: Install Solidity 0.8.19
run: svm install 0.8.19
- name: Install Solidity 0.8.20
run: svm install 0.8.20
- name: Use Solidity 0.8.19
run: svm use 0.8.19
unit:
name: unit tests / ${{ matrix.job.name }}
runs-on: ubuntu-latest
needs: build-tests
timeout-minutes: 60
strategy:
matrix:
job:
- name: non-forking
filter: "!test(~fork) & !test(~live)"
- name: forking
filter: "test(~fork) & !test(~live)"
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@nextest
- uses: dtolnay/rust-toolchain@stable
- name: Download archives
uses: actions/download-artifact@v3
with:
name: unit-tests
- name: cargo nextest
run: |
# see https://github.com/foxar-rs/foxar/pull/3959
export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib"
cargo nextest run --retries 3 --archive-file nextest-unit.tar.zst -E '${{ matrix.job.filter }}'
issue-repros-tests:
name: issue reproduction tests / ${{ matrix.job.name }} / ${{ matrix.job.partition }}
runs-on: ubuntu-latest
needs: build-tests
strategy:
matrix:
job:
- name: issue-repros
filter: "test(~issue)"
partition: [1, 2]
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- name: Download archives
uses: actions/download-artifact@v3
with:
name: integration-tests
- name: Forge RPC cache
uses: actions/cache@v3
if: matrix.job.name != 'issue-repros'
with:
path: "$HOME/.foxar/cache"
key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: cargo nextest
run: |
# see https://github.com/foxar-rs/foxar/pull/3959
export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib"
cargo nextest run --partition count:${{ matrix.partition }}/2 --retries 3 --archive-file nextest-integration.tar.zst -E '${{ matrix.job.filter }}'
forge-std-tests:
name: spark std tests / ${{ matrix.job.name }}
runs-on: ubuntu-latest
needs: build-tests
strategy:
matrix:
job:
- name: forge-std-test
filter: "test(~spark_std)"
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@nextest
- uses: dtolnay/rust-toolchain@stable
- name: Download archives
uses: actions/download-artifact@v3
with:
name: integration-tests
- name: Forge RPC cache
uses: actions/cache@v3
if: matrix.job.name != 'forge-std-test'
with:
path: "$HOME/.foxar/cache"
key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: cargo nextest
run: |
# see https://github.com/foxar-rs/foxar/pull/3959
export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib"
cargo nextest run --retries 3 --archive-file nextest-integration.tar.zst -E '${{ matrix.job.filter }}'
integration:
name: integration tests / ${{ matrix.job.name }}
runs-on: ubuntu-latest
needs: build-tests
strategy:
matrix:
job:
- name: non-forking
filter: "!test(~fork) & !test(~live) & !test(~issue) & !test(~spark_std)"
- name: forking
filter: "test(~fork) & !test(~live)"
partition: [1, 2]
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@nextest
- uses: dtolnay/rust-toolchain@stable
- name: Download archives
uses: actions/download-artifact@v3
with:
name: integration-tests
- name: Forge RPC cache
uses: actions/cache@v3
if: matrix.job.name != 'non-forking'
with:
path: "$HOME/.foxar/cache"
key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: cargo nextest
run: |
# see https://github.com/foxar-rs/foxar/pull/3959
export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib"
cargo nextest run --partition count:${{ matrix.partition }}/2 --retries 3 --archive-file nextest-integration.tar.zst -E '${{ matrix.job.filter }}'
external-integration:
name: external integration tests / ${{ matrix.job.name }}
runs-on: ubuntu-latest
needs: build-tests
strategy:
matrix:
job:
- name: non-forking
filter: "!test(~fork_integration) & !test(~live)"
- name: forking
filter: "test(~fork_integration) & !test(~live)"
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@nextest
- uses: dtolnay/rust-toolchain@stable
- name: Download archives
uses: actions/download-artifact@v3
with:
name: external-integration-tests
- name: Forge RPC cache
uses: actions/cache@v3
if: matrix.job.name != 'non-forking'
with:
path: "$HOME/.foxar/cache"
key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: Force use of HTTPS for submodules
run: git config --global url."https://github.com/".insteadOf "[email protected]:"
- name: cargo nextest
run: |
# see https://github.com/foxar-rs/foxar/pull/3959
export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib"
cargo nextest run --retries 3 --archive-file nextest-external-integration.tar.zst -E '${{ matrix.job.filter }}'
doctests:
name: doc tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: cargo test --locked --workspace --all-features --doc
cross-platform:
name: Cross-platform tests
if: github.event_name != 'pull_request'
needs: [unit, integration, doctests]
uses: ./.github/workflows/cross-platform.yml

Check failure on line 260 in .github/workflows/test.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/test.yml

Invalid workflow file

error parsing called workflow ".github/workflows/test.yml" -> "./.github/workflows/cross-platform.yml" (source branch with sha:a38366ab5d801b1e569532058f1ebd332293ca21) : workflow is not reusable as it is missing a `on.workflow_call` trigger
clippy:
name: clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@clippy
- run: cargo clippy --workspace --all-targets --all-features
env:
RUSTFLAGS: -Dwarnings
fmt:
name: fmt
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all --check
spark-fmt:
name: spark fmt
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: spark fmt
run: cargo run --bin spark -- fmt --check testdata/