Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/actions/rust-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ runs:
echo "PACKAGE_FLAGS=-p fidget" >> $GITHUB_ENV
fi
shell: bash
- name: Check
run: cargo check --target=${{ inputs.target }} $PACKAGE_FLAGS --verbose
shell: bash
# We just use `cargo clippy` because it's a superset of`cargo check`, and it
# accepts the `-D warnings` flag.
- name: Clippy
run: cargo clippy --target=${{ inputs.target }} $PACKAGE_FLAGS --verbose
run: cargo clippy --target=${{ inputs.target }} $PACKAGE_FLAGS --verbose -- -D warnings
shell: bash
- name: Check format
run: cargo fmt -- --check || exit 1
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/check-aarch64.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/check-docs.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/check-wasm.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/check-x86_64.yml

This file was deleted.

182 changes: 182 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
check-aarch64:
strategy:
matrix:
include:
- target: "aarch64-apple-darwin"
native: true
- target: "aarch64-pc-windows-msvc"
native: false
- target: "aarch64-unknown-linux-gnu"
native: false
runs-on: macos-14
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/rust-cache
with:
cache-key: check-aarch64
- uses: ./.github/actions/rust-check
with:
target: ${{ matrix.target }}
native: ${{ matrix.native }}

check-x86_64:
strategy:
matrix:
include:
- target: "x86_64-unknown-linux-gnu"
native: true
- target: "x86_64-pc-windows-msvc"
native: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/rust-cache
with:
cache-key: check-x86_64
- uses: ./.github/actions/rust-check
with:
target: ${{ matrix.target }}

check-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/rust-cache
with:
cache-key: check-wasm
- name: Install wasm target
run: rustup target add wasm32-unknown-unknown
- name: Check
# `cargo check` doesn't find MIR diagnostics (rust#49292), so we have to
# compile instead. We're using `cargo rustc` instead of `cargo build` to
# pass `-Dwarnings`; we don't want to use `RUSTFLAGS` because that will
# override customization in `.cargo/config.toml`
run: cargo rustc --target=wasm32-unknown-unknown -pfidget --no-default-features --features="rhai" -- -Dwarnings
- name: Clippy
run: cargo clippy --target=wasm32-unknown-unknown -pfidget --no-default-features --features="rhai" -- -Dwarnings

# We test documentation using nightly to match docs.rs.
check-docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: '--cfg docsrs -D warnings'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/rust-cache
with:
cache-key: check-docs
- name: Install nightly Rust
run: rustup default nightly
- name: Check docs
run: cargo doc --workspace --no-deps --document-private-items

build-constraints-demo:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./demos/constraints
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/rust-cache
with:
cache-key: constraints
- name: Install wasm target
run: rustup target add wasm32-unknown-unknown
- name: Install trunk
run: |
wget -qO- https://github.com/trunk-rs/trunk/releases/download/v0.20.2/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
- name: Build wasm-demo
run: ./trunk build --release

build-wasm-demo:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./demos/web-editor/web
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/rust-cache
with:
cache-key: wasm-demo
- name: Install wasm target
run: rustup target add wasm32-unknown-unknown
- name: Install wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install npm dependencies
run: npm install
- name: Check Prettier
run: npx prettier . --check
- name: Build wasm-demo
run: npm run dist
- name: Check `git` cleanliness
run: |
if [[ -n $(git status --porcelain ../crate/Cargo.lock) ]]; then
echo "Error: demos/web-editor/crate/Cargo.lock needs to be updated"
git diff ../crate/Cargo.lock
exit 1
fi

workspace-hack-check:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- name: Install cargo-hakari
uses: taiki-e/install-action@v2
with:
tool: cargo-hakari
- name: Check workspace-hack Cargo.toml is up-to-date
run: cargo hakari generate --diff
- name: Check all crates depend on workspace-hack
run: cargo hakari manage-deps --dry-run

test:
strategy:
matrix:
os: ["ubuntu-latest", "macos-14", "windows-latest"]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- uses: taiki-e/install-action@nextest
- uses: ./.github/actions/rust-cache
with:
cache-key: test
- name: Run crate tests
run: cargo nextest run --verbose --cargo-verbose --retries 2
- name: Run doc tests
run: cargo test --verbose --doc

finish:
name: CI finished
runs-on: ubuntu-slim
permissions: {}
needs:
- check-aarch64
- check-x86_64
- check-wasm
- check-docs
- build-constraints-demo
- build-wasm-demo
- workspace-hack-check
- test
if: "${{ !cancelled() }}"
steps:
- name: Calculate the correct exit status
run: echo $needs | jq --exit-status 'all(.result == "success" or .result == "skipped")'
env:
needs: ${{ toJson(needs) }}
29 changes: 0 additions & 29 deletions .github/workflows/constraints-demo.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/hakari.yml

This file was deleted.

Loading
Loading