Skip to content

Merge pull request #280 from redbadger/update-tests #1321

Merge pull request #280 from redbadger/update-tests

Merge pull request #280 from redbadger/update-tests #1321

Workflow file for this run

name: build
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group:
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RUSTFLAGS: "-D warnings"
RUST_BACKTRACE: short
NEXTEST_PROFILE: ci
CI: 1
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build:
runs-on: ubuntu-latest
if: |
${{ github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name !=
github.event.pull_request.base.repo.full_name }}
steps:
- uses: actions/checkout@v4
- name: Remove rust-toolchain.toml
shell: bash
run: |
# so we don't add tooling for all targets
rm rust-toolchain.toml
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- uses: pnpm/action-setup@v4
with:
version: latest
- name: Build crux
shell: bash
run: cargo build --workspace
- name: Install nextest
shell: bash
run: |
set -euxo pipefail
curl -LsSf https://get.nexte.st/0.9/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Run tests
shell: bash
run: |
./scripts/test.sh
find-examples:
runs-on: ubuntu-latest
if: |
${{ github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name !=
github.event.pull_request.base.repo.full_name }}
outputs:
examples: ${{ steps.find.outputs.examples }}
steps:
- uses: actions/checkout@v4
- id: find
run: |
EXAMPLES=$(ls -d examples/*/ | xargs -L 1 basename | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')
echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT
examples:
runs-on: ubuntu-latest
container: ivangabriele/tauri:debian-bookworm-18
if: |
${{ github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name !=
github.event.pull_request.base.repo.full_name }}
needs: find-examples
strategy:
matrix:
example: ${{ fromJson(needs.find-examples.outputs.examples) }}
defaults:
run:
working-directory: examples/${{ matrix.example }}
steps:
- uses: actions/checkout@v4
- name: Remove rust-toolchain.toml
shell: bash
run: |
# so we don't add tooling for all targets
rm ../../rust-toolchain.toml
- name: Install rustfmt
shell: bash
run: rustup component add rustfmt
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install nextest
shell: bash
run: |
set -euxo pipefail
curl -LsSf https://get.nexte.st/0.9/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Check formatting
shell: bash
run: cargo fmt --all --check
- name: Build ${{ matrix.example }}
shell: bash
run: cargo build
- name: Run tests
shell: bash
run: |
cargo nextest run --all-features
- name: Build & run doctests
shell: bash
run: |
cargo test --doc --no-fail-fast