Skip to content

Commit

Permalink
Merge pull request #48 from Nukesor/refactor_test_workflow
Browse files Browse the repository at this point in the history
ci: Simplify test workflow for different targets
  • Loading branch information
Nukesor committed Aug 11, 2021
2 parents e40d2fc + 2c1d4f9 commit 961b28f
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,33 @@ on:

jobs:
test:
name: Tests on ${{ matrix.os }} for ${{ matrix.toolchain }}
name: Test target ${{ matrix.target }} on ${{ matrix.os }} for ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- wasm32-wasi
toolchain: [stable, nightly]
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
minimal_setup: false
- target: wasm32-wasi
os: ubuntu-latest
minimal_setup: true
- target: x86_64-pc-windows-msvc
os: windows-latest
minimal_setup: false
- target: x86_64-apple-darwin
os: macos-latest
minimal_setup: false

# minimal_setup: This is needed for targets that don't support our dev dependencies.
# It also excludes the default features, i.e. [tty].
# For instance, "wasm32-wasi" is such a target.

steps:
- name: Checkout code
Expand All @@ -33,6 +54,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
override: true
components: rustfmt, clippy
Expand All @@ -41,32 +63,19 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --target=${{ matrix.target }}
if: ${{ !matrix.minimal_setup }}

- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
wasm:
name: Check wasm32-wasi support with ${{ matrix.toolchain }} toolchain
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: [stable, nightly]

steps:
- name: Checkout code
uses: actions/checkout@v2
args: --target=${{ matrix.target }}
if: ${{ !matrix.minimal_setup }}

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-wasi
toolchain: ${{ matrix.toolchain }}
override: true

- name: cargo build
- name: cargo build without default features and without dev dependencies
uses: actions-rs/cargo@v1
with:
command: build
args: --release --no-default-features --target wasm32-wasi
args: --release --target=${{ matrix.target }} --no-default-features
if: ${{ matrix.minimal_setup }}

0 comments on commit 961b28f

Please sign in to comment.