Skip to content

ci: initialize rust ci #6

ci: initialize rust ci

ci: initialize rust ci #6

Workflow file for this run

name: test
# This is the main CI workflow that runs the test suite on all pushes to main
# and all pull requests. It runs the following jobs:
# - required: runs the test suite on ubuntu with stable and beta rust
# toolchains.
# - os-check: runs the test suite on mac and windows.
# - coverage: runs the test suite and collects coverage information.
# See `check.yml` for information about how the concurrency cancellation and
# workflow triggering works.
permissions:
contents: read
on:
push:
branches: [ main ]
paths-ignore:
- "**.ts"
pull_request:
paths-ignore:
- "**.ts"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
required:
runs-on: ubuntu-latest
name: ubuntu / ${{ matrix.toolchain }}
strategy:
matrix:
# Run on stable and beta to ensure that tests won't break on the next
# version of the rust toolchain.
toolchain: [ stable, beta ]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: cargo generate-lockfile
# Enable this ci template to run regardless of whether the lockfile is
# checked in or not.
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
# https://twitter.com/jonhoo/status/1571290371124260865
- name: cargo test --locked
run: cargo test --locked --all-targets
# https://github.com/rust-lang/cargo/issues/6669
- name: cargo test --doc
run: cargo test --locked --doc
os-check:
# Run cargo test on MacOS and Windows.
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / stable
strategy:
fail-fast: false
matrix:
os: [ macos-latest ]
# Windows fails because of `stylus-proc`.
# os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo test
run: cargo test --locked --all-targets