-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
647 lines (613 loc) · 27.2 KB
/
main.yml
File metadata and controls
647 lines (613 loc) · 27.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# 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
# Language linting (typos, link-check) runs on every push; Rust jobs are gated behind path checks
name: CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
# 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
# CARGO_PROFILE_DEV_PACKAGE_STAR_STRIP: debuginfo # strip debug info from deps to shrink cache
RUST_BACKTRACE: 1
rust_nightly: nightly-2025-10-05
jobs:
# ---------------------------------------------------------------------------
# Path gate — determines whether Rust jobs should run
# ---------------------------------------------------------------------------
check-paths:
runs-on: warp-ubuntu-latest-x64-4x
outputs:
rust: ${{ steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- 'packages/**'
- 'examples/**'
- 'docs/guide/**'
- 'src/**'
- '.github/**'
- 'lib.rs'
- 'Cargo.toml'
- 'Makefile.toml'
# ---------------------------------------------------------------------------
# Language linting — runs on every push
# ---------------------------------------------------------------------------
typos:
if: github.event.pull_request.draft == false
name: "Lint | Typos"
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v5
- name: Check for typos
uses: crate-ci/typos@master
link-check:
if: github.event.pull_request.draft == false
name: "Lint | Links"
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v5
- name: Restore lychee cache
uses: actions/cache@v5
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Run lychee
uses: lycheeverse/lychee-action@v2
with:
args: --config ./lychee.toml './**/*.md'
fail: true
# ---------------------------------------------------------------------------
# Rust jobs — only run when relevant paths change
# ---------------------------------------------------------------------------
lint:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Lint | Clippy, fmt, schema, msrv"
runs-on: warp-ubuntu-latest-x64-4x
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.94.0
with:
components: rustfmt, clippy
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-msrv
run: cargo binstall cargo-msrv -y --force
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Rustfmt
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
- name: Check schema
run: cargo run -p dioxus-cli -- config schema --out packages/cli/schema.json
- name: Verify schema is up to date
run: |
if ! git diff --exit-code packages/cli/schema.json; then
echo "::error::Schema is out of date. Run 'dx config schema --out packages/cli/schema.json' and commit the changes."
exit 1
fi
- name: Verify MSRV
run: cargo msrv --output-format json verify -- cargo check
- name: Find MSRV on verify failure
if: ${{ failure() }}
run: cargo msrv --output-format json -- cargo check
docs:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Docs | Build"
runs-on: warp-ubuntu-latest-x64-4x
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"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "doc --lib --all-features"
run: |
cargo doc --workspace --no-deps --all-features --document-private-items
env:
RUSTDOCFLAGS: -Dwarnings --document-private-items
test-docs:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Docs | Test"
runs-on: warp-ubuntu-latest-x64-4x
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"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "doc --lib --all-features"
run: |
cargo test --doc --workspace --all-features
bundle-linux-smoke:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Bundle | Linux"
runs-on: warp-ubuntu-latest-x64-4x
timeout-minutes: 45
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 patchelf desktop-file-utils librsvg2-dev
version: 1.0
- uses: dtolnay/rust-toolchain@1.92.0
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Bundle hotdog as Linux packages
working-directory: ./examples/01-app-demos/hotdog
run: cargo run --manifest-path ../../../Cargo.toml -p dioxus-cli -- bundle --platform desktop --package-types appimage --package-types deb --package-types rpm
- name: Verify Linux bundle outputs
run: |
find target -name '*.AppImage' -print
find target -name '*.deb' -print
find target -name '*.rpm' -print
test -n "$(find target -name '*.AppImage' -print -quit)"
test -n "$(find target -name '*.deb' -print -quit)"
test -n "$(find target -name '*.rpm' -print -quit)"
- uses: actions/upload-artifact@v6
if: failure()
with:
name: hotdog-linux-bundles
path: |
target/**/*.AppImage
target/**/*.deb
target/**/*.rpm
if-no-files-found: ignore
retention-days: 7
bundle-macos-smoke:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Bundle | macOS"
runs-on: warp-macos-latest-arm64-6x
timeout-minutes: 45
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@1.92.0
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Bundle hotdog as macOS packages
working-directory: ./examples/01-app-demos/hotdog
run: cargo run --manifest-path ../../../Cargo.toml -p dioxus-cli -- bundle --platform desktop --package-types macos --package-types dmg
- name: Verify macOS bundle outputs
run: |
find target -type d -name '*.app' -print
find target -type f -name '*.dmg' -print
test -n "$(find target -type d -name '*.app' -print -quit)"
test -n "$(find target -type f -name '*.dmg' -print -quit)"
- uses: actions/upload-artifact@v6
if: failure()
with:
name: hotdog-macos-bundles
path: |
target/**/*.app
target/**/*.dmg
if-no-files-found: ignore
retention-days: 7
windows-bundle-smoke:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Bundle | Windows"
runs-on: warp-windows-2025-x64-8x
timeout-minutes: 45
steps:
- uses: actions/checkout@v5
- name: Setup Dev Drive
run: ${{ github.workspace }}/.github/workflows/setup-dev-drive.ps1
- name: Copy Repo to Dev Drive
run: Copy-Item -Path "${{ github.workspace }}" -Destination "$env:DIOXUS_WORKSPACE" -Recurse
- name: Install Rust
uses: dtolnay/rust-toolchain@1.92.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
key: "windows-bundle-${{ runner.os }}"
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
workspaces: ${{ env.DIOXUS_WORKSPACE }}
- name: Bundle hotdog as Windows packages
working-directory: ${{ env.DIOXUS_WORKSPACE }}/examples/01-app-demos/hotdog
run: cargo run --release --manifest-path ..\..\..\Cargo.toml -p dioxus-cli -- bundle --platform desktop --package-types msi --package-types nsis
- name: Verify Windows bundle outputs
working-directory: ${{ env.DIOXUS_WORKSPACE }}
shell: pwsh
run: |
$msi = Get-ChildItem -Path .\target\dx -Recurse -File -Include "*.msi"
$nsis = Get-ChildItem -Path .\target\dx -Recurse -File -Include "*-setup.exe"
$msi | ForEach-Object { $_.FullName }
$nsis | ForEach-Object { $_.FullName }
if (-not $msi) { throw "Expected MSI artifact was not produced." }
if (-not $nsis) { throw "Expected NSIS artifact was not produced." }
- name: Target dir size by extension
shell: pwsh
run: |
Get-ChildItem -Path "$env:DIOXUS_WORKSPACE\target" -Recurse -File |
Group-Object Extension |
Sort-Object { ($_.Group | Measure-Object Length -Sum).Sum } -Descending |
Select-Object -First 20 @{N='Ext';E={$_.Name}}, Count, @{N='SizeMB';E={[math]::Round(($_.Group | Measure-Object Length -Sum).Sum / 1MB, 1)}} |
Format-Table -AutoSize
# - name: Clean Windows artifacts before cache save
# shell: pwsh
# run: |
# Get-ChildItem -Path "$env:DIOXUS_WORKSPACE\target" -Recurse -Include "*.pdb","*.exe","*.dll" | Remove-Item -Force
- uses: actions/upload-artifact@v6
if: failure()
with:
name: hotdog-windows-bundles-smoke
path: |
${{ env.DIOXUS_WORKSPACE }}/target/**/*.msi
${{ env.DIOXUS_WORKSPACE }}/target/**/*-setup.exe
if-no-files-found: ignore
retention-days: 7
windows:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Playwright | Windows"
runs-on: warp-windows-2025-x64-8x
timeout-minutes: 60
steps:
- uses: actions/checkout@v5
- name: Setup Dev Drive
run: ${{ github.workspace }}/.github/workflows/setup-dev-drive.ps1
- name: Copy Repo to Dev Drive
run: Copy-Item -Path "${{ github.workspace }}" -Destination "$env:DIOXUS_WORKSPACE" -Recurse
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Install Rust
uses: dtolnay/rust-toolchain@1.92.0
with:
targets: wasm32-unknown-unknown
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
workspaces: ${{ env.DIOXUS_WORKSPACE }}
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Playwright
working-directory: ${{ env.DIOXUS_WORKSPACE }}/packages/playwright-tests
env:
CARGO_INCREMENTAL: 1
run: |
npm ci
npm install -D @playwright/test
npx playwright install
npx playwright test
# - name: Clean Windows artifacts before cache save
# if: always()
# shell: pwsh
# run: |
# Get-ChildItem -Path "$env:DIOXUS_WORKSPACE\target" -Recurse -Include "*.pdb","*.exe","*.dll" | Remove-Item -Force
- uses: actions/upload-artifact@v6
if: failure()
with:
name: playwright-report-windows
path: ${{ env.DIOXUS_WORKSPACE }}/packages/playwright-tests/playwright-report/
retention-days: 7
playwright:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Playwright | ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
matrix:
include:
- { os: warp-ubuntu-latest-x64-8x, name: "Linux (stable)", toolchain: "1.92.0" }
- { os: warp-ubuntu-latest-x64-8x, name: "Linux (beta)", toolchain: beta }
steps:
# Do our best to cache the toolchain and node install steps
- uses: actions/checkout@v5
- name: Free Disk Space
if: runner.os == 'Linux'
uses: ./.github/actions/free-disk-space
- uses: awalsh128/cache-apt-pkgs-action@latest
if: runner.os == 'Linux'
with:
packages: glib-networking glib-networking-common glib-networking-services libaa1 libabsl20220623t64 libass9 libasyncns0 libavc1394-0 libavcodec60 libavfilter9 libavformat60 libavtp0 libavutil58 libblas3 libbluray2 libbs2b0 libcaca0 libcairo-script-interpreter2 libcdparanoia0 libchromaprint1 libcjson1 libcodec2-1.2 libdav1d7 libdc1394-25 libdca0 libdecor-0-0 libdirectfb-1.7-7t64 libdv4t64 libdvdnav4 libdvdread8t64 libfaad2 libflac12t64 libfluidsynth3 libfreeaptx0 libgav1-1 libgme0 libgraphene-1.0-0 libgsm1 libgssdp-1.6-0 libgstreamer-plugins-good1.0-0 libgtk-4-common libgupnp-1.6-0 libgupnp-igd-1.6-0 libhwy1t64 libiec61883-0 libimath-3-1-29t64 libinstpatch-1.0-2 libjack-jackd2-0 libjxl0.7 liblapack3 liblc3-1 libldacbt-enc2 liblilv-0-0 liblrdf0 libltc11 libmbedcrypto7t64 libmfx1 libmjpegutils-2.1-0t64 libmodplug1 libmp3lame0 libmpcdec6 libmpeg2encpp-2.1-0t64 libmpg123-0t64 libmplex2-2.1-0t64 libmysofa1 libneon27t64 libnice10 libogg0 libopenal-data libopenal1 libopenexr-3-1-30 libopenh264-7 libopenmpt0t64 libopenni2-0 liborc-0.4-0t64 libpipewire-0.3-0t64 libplacebo338 libpocketsphinx3 libpostproc57 libproxy1v5 libpulse0 libqrencode4 libraptor2-0 librav1e0 libraw1394-11 librist4 librubberband2 libsamplerate0 libsbc1 libsdl2-2.0-0 libsecret-common libserd-0-0 libshine3 libshout3 libsndfile1 libsndio7.0 libsord-0-0 libsoundtouch1 libsoup-3.0-0 libsoup-3.0-common libsoxr0 libspa-0.2-modules libspandsp2t64 libspeex1 libsphinxbase3t64 libsratom-0-0 libsrt1.5-gnutls libsrtp2-1 libssh-gcrypt-4 libsvtav1enc1d1 libswresample4 libswscale7 libtag1v5 libtag1v5-vanilla libtheora0 libtwolame0 libudfread0 libunibreak5 libv4l-0t64 libv4lconvert0t64 libva-drm2 libva-x11-2 libva2 libvdpau1 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvorbis0a libvorbisenc2 libvorbisfile3 libvpl2 libwavpack1 libwebrtc-audio-processing1 libwildmidi2 libx265-199 libxcb-xkb1 libxkbcommon-x11-0 libcups2t64 libxml2 libxml2-dev libxvidcore4 libyuv0 libzbar0t64 libzimg2 libzix-0-0 libzvbi-common libzvbi0t64 libzxing3 ocl-icd-libopencl1 timgm6mb-soundfont xfonts-encodings xfonts-utils binutils lld binutils-devel binutils-gold fonts-freefont-ttf fonts-ipafont-gothic fonts-tlwg-loma-otf fonts-unifont fonts-wqy-zenhei gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-good libavif16 libevent-2.1-7t64 libgstreamer-plugins-bad1.0-0 libharfbuzz-icu0 libhyphen0 libmanette-0.2-0 libsecret-1-0 libwoff1 xfonts-cyrillic xfonts-scalable fonts-ipafont-mincho fonts-tlwg-loma gstreamer1.0-x
version: 1.0
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
key: "playwright-${{ matrix.toolchain }}-${{ runner.os }}"
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Wipe dx cache
if: runner.os == 'Linux'
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
npx playwright test
- uses: actions/upload-artifact@v6
if: failure()
with:
name: playwright-report-${{ matrix.toolchain }}-${{ runner.os }}
path: ./packages/playwright-tests/playwright-report/
retention-days: 7
test:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Test | Linux"
runs-on: warp-ubuntu-latest-x64-8x
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.92.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: browser-actions/setup-firefox@latest
- run: cargo test --lib --bins --tests --examples --workspace --exclude dioxus-desktop
release-test:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Test | Linux (Release)"
runs-on: warp-ubuntu-latest-x64-8x
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.92.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: browser-actions/setup-firefox@latest
- run: cargo test --lib --bins --tests --examples --workspace --exclude dioxus-desktop --profile release-unoptimized
matrix_test:
needs: check-paths
runs-on: ${{ matrix.platform.os }}
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Cross | ${{ matrix.platform.target }}"
env:
RUST_CARGO_COMMAND: ${{ matrix.platform.cross == true && 'cross' || 'cargo' }}
strategy:
matrix:
platform:
- {
target: aarch64-apple-darwin,
os: warp-macos-latest-arm64-6x,
toolchain: "1.92.0",
cross: false,
command: "test",
args: "--all --tests",
platform: "desktop",
}
- {
target: aarch64-apple-ios,
os: warp-macos-latest-arm64-6x,
toolchain: "1.92.0",
cross: false,
command: "build",
args: "--package dioxus-desktop",
platform: "ios",
}
- {
target: aarch64-unknown-linux-gnu,
os: warp-ubuntu-latest-arm64-4x,
toolchain: "1.92.0",
cross: false,
command: "build",
args: "--all --tests",
platform: "desktop",
}
- {
target: aarch64-linux-android,
os: warp-ubuntu-latest-x64-4x,
toolchain: "1.92.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.92.0",
# cross: false,
# command: "build",
# args: "--all --tests",
# platform: "desktop",
# }
steps:
- uses: actions/checkout@v5
- name: Free Disk Space
if: runner.os == 'Linux'
uses: ./.github/actions/free-disk-space
- uses: awalsh128/cache-apt-pkgs-action@latest
if: ${{ runner.os == 'Linux' && matrix.platform.target != 'aarch64-unknown-linux-gnu' }}
with:
packages: pkg-config 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 Linux desktop dependencies for ARM
if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev
- name: Verify GLib pkg-config metadata on ARM Linux
if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }}
run: pkg-config --modversion glib-2.0
- name: Configure pkg-config for ARM Linux desktop deps
if: ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' }}
run: |
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig" >> "$GITHUB_ENV"
echo "PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig" >> "$GITHUB_ENV"
- 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)1
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"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: test
run: |
${{ env.RUST_CARGO_COMMAND }} ${{ matrix.platform.command }} ${{ matrix.platform.args }} --target ${{ matrix.platform.target }}
# Verify that declared minimum dependency versions actually compile.
# Catches issues like https://github.com/DioxusLabs/dioxus/issues/5433 where
# the code uses APIs not available in the declared minimum version.
min-deps:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Check | Minimum dependency versions"
runs-on: warp-ubuntu-latest-x64-4x
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@nightly
with:
toolchain: ${{ env.rust_nightly }}
- uses: dtolnay/rust-toolchain@1.92.0
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-workspace-crates: "true"
cache-provider: "warpbuild"
- name: Generate minimal-version lockfile
run: cargo +${{ env.rust_nightly }} update -Zdirect-minimal-versions
- name: Check workspace with minimum versions
run: cargo +1.92.0 check --workspace
nix:
needs: check-paths
if: github.event.pull_request.draft == false && needs.check-paths.outputs.rust == 'true'
name: "Nix | ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- { os: warp-ubuntu-latest-x64-8x, name: Linux }
- { os: warp-macos-latest-arm64-6x, name: macOS }
steps:
- uses: actions/checkout@v5
- uses: nixbuild/nix-quick-install-action@master
- uses: jkelleyrtp/cache-nix-action@jk/use-warpbuild
with:
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.nix', 'flake.lock') }}-${{ hashFiles('Cargo.lock') }}
restore-prefixes-first-match: |
nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.nix', 'flake.lock') }}-
nix-${{ runner.os }}-${{ runner.arch }}-
backend: warpbuild
- name: Build dioxus-cli from the flake
run: nix build .#dioxus-cli
- name: Smoke test devShell
shell: bash
run: |
nix develop .#default -c bash -lc '
cargo --version
rustc --version
pkg-config --modversion openssl
if [[ "${{ runner.os }}" == "Linux" ]]; then
pkg-config --modversion gtk+-3.0
pkg-config --modversion webkit2gtk-4.1
fi
'