Skip to content

Commit

Permalink
cargo test
Browse files Browse the repository at this point in the history
  • Loading branch information
SashaZezulinsky committed Jan 22, 2024
1 parent 0e498e8 commit 408b3cd
Showing 1 changed file with 2 additions and 163 deletions.
165 changes: 2 additions & 163 deletions .github/workflows/cross-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,91 +6,13 @@ env:
CARGO_TERM_COLOR: always

jobs:
build-tests:
name: building ${{ matrix.job.target }} (${{ matrix.job.os }}) / ${{ matrix.archive.name }}
runs-on: ${{ matrix.job.os }}
timeout-minutes: 60
strategy:
fail-fast: false
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
job:
# The OS is used for the runner
# The target is used by Cargo
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
toolchain: 1.73.0
- uses: Swatinem/rust-cache@v2
- name: Install nextest
uses: taiki-e/install-action@nextest

# Required for spark commands that use git
- name: Setup git
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: Apple M1 setup
if: ${{ matrix.job.target == 'aarch64-apple-darwin' }}
run: |
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Linux ARM setup
if: ${{ matrix.job.target == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
# For some reason the FFI cheatcode uses WSL bash instead of Git bash, so we need to install a WSL distribution
- name: Windows setup
if: ${{ matrix.job.target == 'x86_64-pc-windows-msvc' }}
uses: Vampire/setup-wsl@v1
with:
distribution: Ubuntu-20.04
set-as-default: true

- name: Build archive (unit tests)
run: |
cargo nextest archive --locked ${{ matrix.job.flags }} --archive-file ${{ matrix.job.target }}-${{ matrix.archive.file }}
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.job.target }}-${{ matrix.archive.name }}
path: ${{ matrix.job.target }}-${{ matrix.archive.file }}

unit:
name: unit tests ${{ matrix.job.target }} (${{ matrix.job.os }}) / ${{ matrix.archive.name }} / ${{ matrix.nextest.name }}
runs-on: ${{ matrix.job.os }}
needs: build-tests
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
archive:
- name: unit-tests
file: nextest-unit.tar.zst
job:
# The OS is used for the runner
# The target is used by Cargo
Expand All @@ -114,89 +36,6 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
- uses: taiki-e/install-action@nextest
- name: Download archives
uses: actions/download-artifact@v3
with:
name: ${{ matrix.job.target }}-${{ matrix.archive.name }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
- name: cargo nextest
shell: bash
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 ${{ matrix.job.target }}-${{ matrix.archive.file }} -E '${{ matrix.nextest.filter }}'
integration:
name:
integration tests ${{ matrix.job.target }} (${{ matrix.job.os }}) / ${{
matrix.archive.name }} / ${{ matrix.nextest.name }}
runs-on: ${{ matrix.job.os }}
timeout-minutes: 60
needs: build-tests
strategy:
fail-fast: false
matrix:
archive:
- name: integration-tests
file: nextest-integration.tar.zst
job:
# The OS is used for the runner
# The target is used by Cargo
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
nextest:
- name: non-forking
# skip fork,verify,forge-std and script tests that use heavy simulation
filter: "!test(~fork) & !test(~live) & !test(~spark_std) & !test(~deploy_and_simulate)"
# the aarch64-apple-darwin runner is particularly slow with script related tests
macos-aarch-filter: "!test(~fork) & !test(~live) & !test(~spark_std) & !test(~deploy_)"
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: ${{ matrix.job.target }}-${{ matrix.archive.name }}

- name: Forge RPC cache
uses: actions/cache@v3
if: matrix.nextest.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
if: ${{ matrix.job.target == 'aarch64-apple-darwin' }}
shell: bash
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 ${{ matrix.job.target }}-${{ matrix.archive.file }} -E '${{ matrix.nextest.macos-aarch-filter }}'
- name: cargo nextest
if: ${{ matrix.job.target != 'aarch64-apple-darwin' }}
- name: cargo test
shell: bash
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 ${{ matrix.job.target }}-${{ matrix.archive.file }} -E '${{ matrix.nextest.filter }}'
run: test --all --all-features

0 comments on commit 408b3cd

Please sign in to comment.