overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
393 lines
14 KiB
YAML
393 lines
14 KiB
YAML
# Whenever an open PR is updated, the workflow will be triggered
|
|
#
|
|
# This can get expensive, so we do a lot of caching and checks to prevent unnecessary runs
|
|
|
|
name: Rust CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- packages/**
|
|
- examples/**
|
|
- docs/guide/**
|
|
- src/**
|
|
- .github/**
|
|
- lib.rs
|
|
- Cargo.toml
|
|
- Makefile.toml
|
|
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
branches:
|
|
- main
|
|
paths:
|
|
- packages/**
|
|
- examples/**
|
|
- src/**
|
|
- .github/**
|
|
- lib.rs
|
|
- Cargo.toml
|
|
|
|
# workflow_dispatch:
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: 0 # todo(jon): cargo-cache wipes incremental artifacts, but we eventually want to cache them
|
|
RUST_BACKTRACE: 1
|
|
rust_nightly: nightly-2025-04-07
|
|
|
|
jobs:
|
|
check-msrv:
|
|
if: github.event.pull_request.draft == false
|
|
name: Check MSRV
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: dtolnay/rust-toolchain@1.86.0
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
# https://github.com/foresterre/cargo-msrv/blob/4345edfe3f4fc91cc8ae6c7d6804c0748fae92ae/.github/workflows/msrv.yml
|
|
- name: install_cargo_msrv
|
|
run: cargo install cargo-msrv --all-features --version 0.16.3 --locked
|
|
- name: version_of_cargo_msrv
|
|
run: cargo msrv --version
|
|
- name: run_cargo_msrv
|
|
run: cargo msrv --output-format json verify -- cargo check
|
|
- name: run_cargo_msrv_on_verify_failure
|
|
if: ${{ failure() }}
|
|
run: cargo msrv --output-format json -- cargo check
|
|
|
|
test:
|
|
if: github.event.pull_request.draft == false
|
|
name: Test Suite
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Free Disk Space
|
|
uses: ./.github/actions/free-disk-space
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
|
|
version: 1.0
|
|
- uses: dtolnay/rust-toolchain@1.86.0
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
- uses: browser-actions/setup-firefox@latest
|
|
- run: cargo test --lib --bins --tests --examples --workspace --exclude dioxus-desktop
|
|
|
|
release-test:
|
|
if: github.event.pull_request.draft == false
|
|
name: Test Suite with Optimizations
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Free Disk Space
|
|
uses: ./.github/actions/free-disk-space
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
|
|
version: 1.0
|
|
- uses: dtolnay/rust-toolchain@1.86.0
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
- uses: browser-actions/setup-firefox@latest
|
|
- run: cargo test --lib --bins --tests --examples --workspace --exclude dioxus-desktop --profile release-unoptimized
|
|
|
|
fmt:
|
|
if: github.event.pull_request.draft == false
|
|
name: Rustfmt
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: dtolnay/rust-toolchain@1.86.0
|
|
with:
|
|
components: rustfmt
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
- run: cargo fmt --all -- --check
|
|
|
|
docs:
|
|
if: github.event.pull_request.draft == false
|
|
name: Docs
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
|
|
version: 1.0
|
|
- name: Install Rust ${{ env.rust_nightly }}
|
|
uses: dtolnay/rust-toolchain@nightly
|
|
with:
|
|
toolchain: ${{ env.rust_nightly }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
- name: "doc --lib --all-features"
|
|
run: |
|
|
cargo doc --workspace --no-deps --all-features --document-private-items
|
|
env:
|
|
RUSTDOCFLAGS: -Dwarnings --document-private-items
|
|
|
|
test-docs:
|
|
if: github.event.pull_request.draft == false
|
|
name: Test Docs
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
|
|
version: 1.0
|
|
- name: Install Rust ${{ env.rust_nightly }}
|
|
uses: dtolnay/rust-toolchain@nightly
|
|
with:
|
|
toolchain: ${{ env.rust_nightly }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
- name: "doc --lib --all-features"
|
|
run: |
|
|
cargo test --doc --workspace --all-features
|
|
|
|
check:
|
|
if: github.event.pull_request.draft == false
|
|
name: Check
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
|
|
version: 1.0
|
|
- uses: dtolnay/rust-toolchain@1.86.0
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
- run: cargo check --workspace --all-features --all-targets
|
|
|
|
clippy:
|
|
if: github.event.pull_request.draft == false
|
|
name: Clippy
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
|
|
version: 1.0
|
|
- uses: dtolnay/rust-toolchain@1.86.0
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-all-crates: "true"
|
|
- run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
|
|
|
|
nix:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [blacksmith-4vcpu-ubuntu-2404, macos-latest]
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: nixbuild/nix-quick-install-action@master
|
|
- uses: nix-community/cache-nix-action@main
|
|
with:
|
|
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
|
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}
|
|
- name: Install omnix
|
|
run: nix --accept-flake-config profile install "github:juspay/omnix"
|
|
- name: Build all flake outputs
|
|
run: om ci
|
|
- name: Ensure devShell has all build deps
|
|
run: nix develop -c cargo build -p dioxus-cli --features no-downloads
|
|
|
|
playwright:
|
|
if: github.event.pull_request.draft == false
|
|
name: Playwright Tests
|
|
runs-on: blacksmith-8vcpu-ubuntu-2404
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- { toolchain: 1.86.0 }
|
|
- { toolchain: beta }
|
|
steps:
|
|
# Do our best to cache the toolchain and node install steps
|
|
- uses: actions/checkout@v5
|
|
- name: Free Disk Space
|
|
if: ${{ matrix.platform.os == 'ubuntu-24.04' || matrix.platform.os == 'ubuntu-24.04-arm' || matrix.platform.os == 'blacksmith-4vcpu-ubuntu-2404' || matrix.platform.os == 'blacksmith-4vcpu-ubuntu-2404-arm' }}
|
|
uses: ./.github/actions/free-disk-space
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.platform.toolchain }}
|
|
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: "playwright-${{ matrix.platform.toolchain }}-${{ runner.os }}"
|
|
cache-all-crates: "true"
|
|
cache-on-failure: "true"
|
|
- name: Wipe dx cache
|
|
run: |
|
|
rm -rf ./target/dx
|
|
- name: Playwright
|
|
working-directory: ./packages/playwright-tests
|
|
env:
|
|
# The hot patch test requires incremental compilation
|
|
CARGO_INCREMENTAL: 1
|
|
run: |
|
|
npm ci
|
|
npm install -D @playwright/test
|
|
npx playwright install --with-deps
|
|
npx playwright test
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report-${{ matrix.platform.toolchain }}-${{ runner.os }}
|
|
path: ./packages/playwright-tests/playwright-report/
|
|
retention-days: 30
|
|
|
|
matrix_test:
|
|
runs-on: ${{ matrix.platform.os }}
|
|
if: github.event.pull_request.draft == false
|
|
env:
|
|
RUST_CARGO_COMMAND: ${{ matrix.platform.cross == true && 'cross' || 'cargo' }}
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- {
|
|
target: aarch64-apple-darwin,
|
|
os: macos-latest,
|
|
toolchain: "1.86.0",
|
|
cross: false,
|
|
command: "test",
|
|
args: "--all --tests",
|
|
platform: "desktop",
|
|
}
|
|
- {
|
|
target: x86_64-apple-darwin,
|
|
os: macos-13,
|
|
toolchain: "1.86.0",
|
|
cross: false,
|
|
command: "test",
|
|
args: "--all --tests",
|
|
platform: "desktop",
|
|
}
|
|
- {
|
|
target: aarch64-apple-ios,
|
|
os: macos-latest,
|
|
toolchain: "1.86.0",
|
|
cross: false,
|
|
command: "build",
|
|
args: "--package dioxus-desktop",
|
|
platform: "ios",
|
|
}
|
|
- {
|
|
target: aarch64-unknown-linux-gnu,
|
|
os: blacksmith-4vcpu-ubuntu-2404-arm,
|
|
toolchain: "1.86.0",
|
|
cross: false,
|
|
command: "build",
|
|
args: "--all --tests",
|
|
platform: "desktop",
|
|
}
|
|
- {
|
|
target: aarch64-linux-android,
|
|
os: blacksmith-4vcpu-ubuntu-2404,
|
|
toolchain: "1.86.0",
|
|
cross: true,
|
|
command: "build",
|
|
args: "--package dioxus-desktop",
|
|
platform: "android",
|
|
}
|
|
# commented out because it's having issues with space on the device, but we already test it above
|
|
# - {
|
|
# target: x86_64-unknown-linux-gnu,
|
|
# os: ubuntu-24.04,
|
|
# toolchain: "1.86.0",
|
|
# cross: false,
|
|
# command: "build",
|
|
# args: "--all --tests",
|
|
# platform: "desktop",
|
|
# }
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Free Disk Space
|
|
if: ${{ matrix.platform.os == 'ubuntu-24.04' || matrix.platform.os == 'ubuntu-24.04-arm' || matrix.platform.os == 'blacksmith-4vcpu-ubuntu-2404' || matrix.platform.os == 'blacksmith-4vcpu-ubuntu-2404-arm' }}
|
|
uses: ./.github/actions/free-disk-space
|
|
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
if: ${{ matrix.platform.os == 'ubuntu-24.04' || matrix.platform.os == 'ubuntu-24.04-arm' || matrix.platform.os == 'blacksmith-4vcpu-ubuntu-2404' || matrix.platform.os == 'blacksmith-4vcpu-ubuntu-2404-arm' }}
|
|
with:
|
|
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
|
|
version: ${{ matrix.platform.target }}-${{ matrix.platform.os }} # disambiguate since we're in a matrix and this caching action doesn't factor in these variables
|
|
|
|
- name: install stable
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.platform.toolchain }}
|
|
targets: ${{ matrix.platform.target }}
|
|
components: rustfmt
|
|
|
|
- name: Install nasm for windows (tls)
|
|
if: ${{ matrix.platform.target == 'x86_64-pc-windows-msvc' }}
|
|
uses: ilammy/setup-nasm@v1
|
|
|
|
- name: Install cross
|
|
if: ${{ matrix.platform.cross == true }}
|
|
uses: taiki-e/install-action@cross
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: "matrix-${{ matrix.platform.target }}"
|
|
cache-all-crates: "true"
|
|
|
|
- name: test
|
|
run: |
|
|
${{ env.RUST_CARGO_COMMAND }} ${{ matrix.platform.command }} ${{ matrix.platform.args }} --target ${{ matrix.platform.target }}
|
|
|
|
# borrowed from uv
|
|
# https://raw.githubusercontent.com/astral-sh/uv/refs/heads/main/.github/workflows/ci.yml
|
|
cargo-test-windows:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on:
|
|
labels: "windows-latest"
|
|
name: "cargo test | windows"
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: dtolnay/rust-toolchain@1.86.0
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: ${{ env.UV_WORKSPACE }}
|
|
cache-all-crates: "true"
|
|
|
|
- name: "Install Rust toolchain"
|
|
working-directory: ${{ env.UV_WORKSPACE }}
|
|
run: rustup show
|
|
|
|
- name: "Cargo test"
|
|
working-directory: ${{ env.UV_WORKSPACE }}
|
|
run: |
|
|
cargo test --workspace --tests
|