improve build times by extracting asset opt into its own crate (#3273)
* improve build types by extracing asset opt as a dylib * dont use dylib, but let regular workspace caching do the heavy lifting * add prebuild to cli for better lock contention * hoist deps * disable slow tests * re-enable sequential, debug=0 for dev * use vfs for windows * dont cache on failure, fix windows vfs caceh * free disk space re-order * add clippy + fmt to windows channel * yoink makefile * proper rustfmt/clippy on toolchain * set incremental to zero since cargo-cache disables it
This commit is contained in:
1 parent
79a2f023e7
commit
1cbfcde6cd
25 files changed
+550
-554
No files matched your search
+63
-44
@@ -37,7 +37,7 @@ concurrency:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_INCREMENTAL: "1"
|
||||
CARGO_INCREMENTAL: 0 # todo(jon): cargo-cache wipes incremental artifacts, but we eventually want to cache them
|
||||
RUST_BACKTRACE: 1
|
||||
rust_nightly: nightly-2024-10-20
|
||||
|
||||
@@ -48,11 +48,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@1.79.0
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
# https://github.com/foresterre/cargo-msrv/blob/4345edfe3f4fc91cc8ae6c7d6804c0748fae92ae/.github/workflows/msrv.yml
|
||||
- name: install_cargo_msrv
|
||||
run: cargo install cargo-msrv --all-features
|
||||
@@ -78,15 +77,14 @@ jobs:
|
||||
swap-storage: false
|
||||
- run: sudo apt-get update
|
||||
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@1.79.0
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
- uses: davidB/rust-cargo-make@v1
|
||||
- uses: browser-actions/setup-firefox@latest
|
||||
- uses: jetli/wasm-pack-action@v0.4.0
|
||||
- run: cargo make tests
|
||||
- run: cargo test --lib --bins --tests --examples --workspace --exclude dioxus-desktop --exclude dioxus-mobile
|
||||
|
||||
release-test:
|
||||
if: github.event.pull_request.draft == false
|
||||
@@ -94,23 +92,22 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: sudo apt-get update
|
||||
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
- uses: davidB/rust-cargo-make@v1
|
||||
- uses: browser-actions/setup-firefox@latest
|
||||
- uses: jetli/wasm-pack-action@v0.4.0
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with: # speed things up a bit
|
||||
large-packages: false
|
||||
docker-images: false
|
||||
swap-storage: false
|
||||
- run: cargo test --profile release-unoptimized --lib --bins --tests --examples --workspace --exclude dioxus-desktop --exclude dioxus-mobile
|
||||
- run: sudo apt-get update
|
||||
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
|
||||
- uses: dtolnay/rust-toolchain@1.79.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 --exclude dioxus-mobile --profile release-unoptimized
|
||||
|
||||
fmt:
|
||||
if: github.event.pull_request.draft == false
|
||||
@@ -118,13 +115,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@1.79.0
|
||||
with:
|
||||
components: rustfmt
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
typos:
|
||||
@@ -151,7 +147,6 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
- name: "doc --lib --all-features"
|
||||
run: |
|
||||
cargo doc --workspace --no-deps --all-features --document-private-items
|
||||
@@ -189,11 +184,10 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- run: sudo apt-get update
|
||||
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@1.79.0
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
- run: cargo check --workspace --all-features --all-targets
|
||||
|
||||
clippy:
|
||||
@@ -204,13 +198,12 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- run: sudo apt-get update
|
||||
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@1.79.0
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
- run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
|
||||
|
||||
nix:
|
||||
@@ -237,6 +230,12 @@ jobs:
|
||||
steps:
|
||||
# Do our best to cache the toolchain and node install steps
|
||||
- uses: actions/checkout@v4
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with: # speed things up a bit
|
||||
large-packages: false
|
||||
docker-images: false
|
||||
swap-storage: false
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
@@ -248,13 +247,9 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
cache-on-failure: "true"
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with: # speed things up a bit
|
||||
large-packages: false
|
||||
docker-images: false
|
||||
swap-storage: false
|
||||
- name: Prebuild CLI
|
||||
run: |
|
||||
cargo build --package dioxus-cli --release
|
||||
- name: Playwright
|
||||
working-directory: ./packages/playwright-tests
|
||||
run: |
|
||||
@@ -277,14 +272,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- {
|
||||
target: x86_64-pc-windows-msvc,
|
||||
os: windows-latest,
|
||||
toolchain: "1.79.0",
|
||||
cross: false,
|
||||
command: "test",
|
||||
args: "--all --tests",
|
||||
}
|
||||
- {
|
||||
target: aarch64-apple-darwin,
|
||||
os: macos-latest,
|
||||
@@ -340,19 +327,51 @@ jobs:
|
||||
|
||||
- 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"
|
||||
cache-on-failure: "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@v4
|
||||
- name: Create Dev Drive using ReFS
|
||||
run: ${{ github.workspace }}/.github/workflows/setup-dev-drive.ps1
|
||||
|
||||
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
|
||||
- name: Copy Git Repo to Dev Drive
|
||||
run: |
|
||||
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.UV_WORKSPACE }}" -Recurse
|
||||
|
||||
- uses: dtolnay/rust-toolchain@1.79.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
|
||||
|
||||
# Only run semver checks if the PR is not a draft and does not have the breaking label
|
||||
# Breaking PRs don't need to follow semver since they are breaking changes
|
||||
# However, this means we won't attempt to backport them, so you should be careful about using this label, as it will
|
||||
@@ -369,7 +388,7 @@ jobs:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: dtolnay/rust-toolchain@stable
|
||||
# - uses: dtolnay/rust-toolchain@1.79.0
|
||||
# - uses: Swatinem/rust-cache@v2
|
||||
# with:
|
||||
# cache-all-crates: "true"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# This creates a 20GB dev drive, and exports all required environment
|
||||
# variables so that rustup, uv and others all use the dev drive as much
|
||||
# as possible.
|
||||
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 20GB |
|
||||
Mount-VHD -Passthru |
|
||||
Initialize-Disk -Passthru |
|
||||
New-Partition -AssignDriveLetter -UseMaximumSize |
|
||||
Format-Volume -FileSystem ReFS -Confirm:$false -Force
|
||||
|
||||
Write-Output $Volume
|
||||
|
||||
$Drive = "$($Volume.DriveLetter):"
|
||||
$Tmp = "$($Drive)/uv-tmp"
|
||||
|
||||
# Create the directory ahead of time in an attempt to avoid race-conditions
|
||||
New-Item $Tmp -ItemType Directory
|
||||
|
||||
Write-Output `
|
||||
"DEV_DRIVE=$($Drive)" `
|
||||
"TMP=$($Tmp)" `
|
||||
"TEMP=$($Tmp)" `
|
||||
"RUSTUP_HOME=$($Drive)/.rustup" `
|
||||
"CARGO_HOME=$($Drive)/.cargo" `
|
||||
"UV_WORKSPACE=$($Drive)/uv" `
|
||||
>> $env:GITHUB_ENV
|
||||
Reference in new issue
Block a user