Skip to content
Open
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
87 changes: 74 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,17 @@ jobs:
name: Build Windows tests
runs-on: namespace-profile-linux-x64-default
env:
WINDOWS_ARCH: x64
WINDOWS_TARGET: x86_64-pc-windows-msvc
WINDOWS_CACHE_KEY: windows-cross
XWIN_ACCEPT_LICENSE: '1'
# The MSVC STL from xwin's VS17 manifest static-asserts a minimum Clang
# version newer than what runner images ship. Microsoft's documented
# escape hatch lets Detours (the only C++ in the workspace, and far older
# than any STL/clang concern here) compile with the system clang-cl.
# cargo-xwin folds a pre-set CXXFLAGS into the env it generates.
CXXFLAGS: -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
steps:
steps: &build-windows-steps
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2

- name: Update submodules
Expand All @@ -233,10 +236,10 @@ jobs:
- uses: oxc-project/setup-rust@3d6fb132fbe7cdcb66bf8ec193911c2945369d12 # v1.0.17
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: windows-cross
cache-key: ${{ env.WINDOWS_CACHE_KEY }}
components: llvm-tools

- run: rustup target add x86_64-pc-windows-msvc
- run: rustup target add "$WINDOWS_TARGET"

- uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 # v2.87.22
with:
Expand All @@ -256,19 +259,29 @@ jobs:
run: |
# cargo-xwin resolves the rustflags configured in .cargo/config.toml,
# appends its -Lnative Windows SDK paths, and re-exports the result as
# CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS, so the plain cargo
# CARGO_TARGET_*_PC_WINDOWS_MSVC_RUSTFLAGS, so the plain cargo
# that nextest invokes cross-compiles exactly like `cargo xwin` would.
eval "$(cargo xwin env --target x86_64-pc-windows-msvc | grep '^export ')"
eval "$(cargo xwin env --target "$WINDOWS_TARGET" | grep '^export ')"
# `cargo xwin env` renders its intended *removal* of RUSTFLAGS as
# `export RUSTFLAGS="";` — actually remove it so it cannot shadow the
# target-specific rustflags set above.
unset RUSTFLAGS
cargo nextest archive --workspace --target x86_64-pc-windows-msvc --archive-file windows-tests.tar.zst
if [[ "$WINDOWS_TARGET" == "aarch64-pc-windows-msvc" ]]; then
# ring's build script switches from clang-cl to plain clang on
# Windows ARM64, which rejects clang-cl's `/imsvc`. Using plain
# clang for C with `-idirafter` keeps MSVC SDK headers after
# Clang's builtin headers (so `arm64_neon.h` resolves to Clang's
# intrinsics for zstd-sys) while keeping `CXX` as `clang-cl` for
# Detours.
export CC_aarch64_pc_windows_msvc="clang"
export CFLAGS_aarch64_pc_windows_msvc="${CFLAGS_aarch64_pc_windows_msvc//\/imsvc/-idirafter}"
fi
cargo nextest archive --workspace --target "$WINDOWS_TARGET" --archive-file "windows-${WINDOWS_ARCH}-tests.tar.zst"

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: windows-test-archive
path: windows-tests.tar.zst
name: windows-${{ env.WINDOWS_ARCH }}-test-archive
path: windows-${{ env.WINDOWS_ARCH }}-tests.tar.zst
retention-days: 7

- uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
Expand All @@ -277,6 +290,21 @@ jobs:
path: ~/.cache/cargo-xwin
key: cargo-xwin-msvc-17

# Separate job from `build-windows-tests` so x64 and ARM64 build/test
# pipelines run independently and a failure in one does not skip the other.
build-windows-arm64-tests:
needs: detect-changes
if: needs.detect-changes.outputs.code-changed == 'true'
name: Build Windows tests (arm64)
runs-on: namespace-profile-linux-x64-default
env:
WINDOWS_ARCH: arm64
WINDOWS_TARGET: aarch64-pc-windows-msvc
WINDOWS_CACHE_KEY: windows-cross-arm64
XWIN_ACCEPT_LICENSE: '1'
CXXFLAGS: -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
steps: *build-windows-steps

test-windows:
needs: build-windows-tests
name: Test (${{ matrix.shard }})
Expand All @@ -295,8 +323,9 @@ jobs:
mode: ignored
runs-on: namespace-profile-windows-4c-8g
Comment thread
wan9chi marked this conversation as resolved.
Resolved
env:
WINDOWS_ARCH: x64
PARTITION: ${{ matrix.partition }}
steps:
steps: &test-windows-steps
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2

# The Detours submodule is needed at run time: fspy_detours_sys's
Expand All @@ -307,7 +336,7 @@ jobs:

- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: windows-test-archive
name: windows-${{ env.WINDOWS_ARCH }}-test-archive

- uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 # v2.87.22
with:
Expand All @@ -319,18 +348,48 @@ jobs:
# job never depends on the runner's Rust toolchain.
- name: Run tests
if: matrix.mode == 'default'
run: cargo-nextest nextest run --archive-file windows-tests.tar.zst --workspace-remap . --partition "$PARTITION"
run: cargo-nextest nextest run --archive-file "windows-${WINDOWS_ARCH}-tests.tar.zst" --workspace-remap . --partition "$PARTITION"

- uses: oxc-project/setup-node@f46a72f95efdc55273fcd042d61c84e723b2892c # v1.4.1
if: matrix.mode == 'ignored'

- name: Install runtime binaries
if: matrix.mode == 'ignored'
run: pnpm --filter vite-task-tools rebuild --pending
run: |
if [[ "$WINDOWS_ARCH" == "arm64" ]]; then
# Playwright has no Windows ARM64 Chromium build (it would download
# x64); `vitest_browser_cache` uses pre-installed native ARM64
# Microsoft Edge on Windows ARM64, so skip downloading an unusable
# browser binary.
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
fi
pnpm --filter vite-task-tools rebuild --pending

- name: Run ignored tests
if: matrix.mode == 'ignored'
run: cargo-nextest nextest run --archive-file windows-tests.tar.zst --workspace-remap . --run-ignored ignored-only
run: cargo-nextest nextest run --archive-file "windows-${WINDOWS_ARCH}-tests.tar.zst" --workspace-remap . --run-ignored ignored-only

test-windows-arm64:
needs: build-windows-arm64-tests
name: Test (${{ matrix.shard }})
strategy:
fail-fast: false
matrix:
include:
- shard: windows-arm64-1
partition: count:1/2
mode: default
- shard: windows-arm64-2
partition: count:2/2
mode: default
- shard: windows-arm64-ignored
partition: ''
mode: ignored
runs-on: windows-11-arm
env:
WINDOWS_ARCH: arm64
PARTITION: ${{ matrix.partition }}
steps: *test-windows-steps

# Building without a Rust cache inside the Alpine container makes this one of
# the slowest jobs, so pull requests run it only with the `ci: full` label.
Expand Down Expand Up @@ -443,7 +502,9 @@ jobs:
- test-macos-x64
- test-musl
- build-windows-tests
- build-windows-arm64-tests
- test-windows
- test-windows-arm64
- fmt
steps:
- run: exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ class NoTestSummaryReporter extends DefaultReporter {
reportTestSummary() {}
}

// Playwright does not ship a Windows ARM64 Chromium build (it downloads x64
// `chrome-headless-shell-win64`), which a native ARM64 preload DLL cannot
// inject into. Use pre-installed native ARM64 Microsoft Edge instead.
const playwrightOptions =
process.platform === 'win32' && process.arch === 'arm64'
? { launchOptions: { channel: 'msedge' } }
: undefined;

export default defineConfig({
plugins: [
{
Expand All @@ -31,7 +39,7 @@ export default defineConfig({
browser: {
enabled: true,
headless: true,
provider: playwright(),
provider: playwright(playwrightOptions),
instances: [{ browser: 'chromium' }],
},
},
Expand Down
Loading