diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e9bce0..b396526 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,11 @@ jobs: build: name: ${{ matrix.config.variant }} ${{ matrix.config.target }} ${{ matrix.config.v8_enable_pointer_compression && 'ptrcomp' || '' }} ${{ matrix.config.v8_enable_multi_cage && 'multicage' || '' }} runs-on: ${{ matrix.config.os }} - timeout-minutes: 180 + # Standard runners have fewer cores than the larger runners this matrix + # used to run on, so a cold-cache build takes considerably longer: the + # debug riscv64 cross build no longer fits in 180 minutes, and the debug + # aarch64 one only just did. 360 is the ceiling GitHub allows. + timeout-minutes: 360 strategy: # Always run main branch builds to completion. This allows the cache to # stay mostly up-to-date in situations where a single job fails due to @@ -27,25 +31,25 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'no-fail-fast') }} matrix: config: - - os: macos-15-large + - os: macos-15 target: x86_64-apple-darwin variant: debug v8_enable_pointer_compression: false cargo: cargo - - os: macos-15-large + - os: macos-15 target: x86_64-apple-darwin variant: release v8_enable_pointer_compression: false cargo: cargo - - os: macos-15-large + - os: macos-15 target: x86_64-apple-darwin variant: debug v8_enable_pointer_compression: true cargo: cargo - - os: macos-15-large + - os: macos-15 target: x86_64-apple-darwin variant: release v8_enable_pointer_compression: true @@ -91,25 +95,25 @@ jobs: v8_enable_pointer_compression: false cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu variant: debug v8_enable_pointer_compression: false cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu variant: release v8_enable_pointer_compression: false cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu variant: debug v8_enable_pointer_compression: true cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu variant: release v8_enable_pointer_compression: true @@ -119,7 +123,7 @@ jobs: # `v8::IsolateGroup::create()` works. Built and tested here so the # isolate group code stays honest, but deliberately not published: # embedders that want it build this crate from source. - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu variant: release v8_enable_pointer_compression: true @@ -131,7 +135,7 @@ jobs: # Release only for now, like the iOS targets: V8's debug-only # execinfo backtrace path (external-reference-table.cc) assumes glibc # and doesn't compile against musl. - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: x86_64-unknown-linux-musl variant: release v8_enable_pointer_compression: false @@ -140,7 +144,7 @@ jobs: # aarch64 musl: cross-compiled on the x64 glibc runner (host + snapshot # toolchains stay glibc; only the arm64 target objects are musl). - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: aarch64-unknown-linux-musl variant: release v8_enable_pointer_compression: false @@ -153,25 +157,25 @@ jobs: v8_enable_pointer_compression: false cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: aarch64-unknown-linux-gnu variant: debug v8_enable_pointer_compression: false cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: aarch64-unknown-linux-gnu variant: release v8_enable_pointer_compression: false cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: riscv64gc-unknown-linux-gnu variant: debug v8_enable_pointer_compression: false cargo: cargo - - os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + - os: ubuntu-22.04 target: riscv64gc-unknown-linux-gnu variant: release v8_enable_pointer_compression: false @@ -270,6 +274,16 @@ jobs: if: contains(matrix.config.target, 'ios') run: rustup target add ${{ matrix.config.target }} + # x86_64 macOS is cross-compiled on the free arm64 macOS runner (the + # x86_64 "large" runner is billed even on public repos). Unlike the iOS + # and musl cross builds, the test suite still runs here: the x86_64 test + # binaries execute under Rosetta 2. + - name: Install x86_64 macOS target and Rosetta 2 + if: matrix.config.target == 'x86_64-apple-darwin' + run: | + rustup target add x86_64-apple-darwin + softwareupdate --install-rosetta --agree-to-license + - name: Install musl cross compilation toolchain if: contains(matrix.config.target, '-linux-musl') run: | @@ -346,7 +360,9 @@ jobs: run: | $version = "v0.8.2" $platform = - @{ "x86_64-apple-darwin" = "x86_64-apple-darwin" + @{ # x86_64 macOS cross-compiles on the arm64 macOS runner, so use + # the host sccache binary. + "x86_64-apple-darwin" = "aarch64-apple-darwin" "aarch64-apple-darwin" = "aarch64-apple-darwin" "x86_64-unknown-linux-gnu" = "x86_64-unknown-linux-musl" "x86_64-unknown-linux-musl" = "x86_64-unknown-linux-musl" @@ -682,7 +698,7 @@ jobs: publish: needs: [build, build-windows-arm64] - runs-on: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }} + runs-on: ubuntu-22.04 if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/') steps: - name: Configure git diff --git a/build.rs b/build.rs index e2c6baa..15d31eb 100644 --- a/build.rs +++ b/build.rs @@ -520,6 +520,14 @@ fn build_v8(is_asan: bool) { maybe_install_sysroot("amd64"); } } + // Without this, GN defaults target_cpu to host_cpu, which the Apple Silicon + // block above pins to "arm64". An x86_64 macOS build hosted on arm64 (as CI + // does, to stay on the free standard runner) would then silently produce an + // arm64 V8 for an x86_64 Rust target. On an x86_64 host this matches GN's + // own default and is a no-op. + if target_arch == "x86_64" { + gn_args.push(r#"target_cpu="x64""#.to_string()); + } if target_arch == "arm" { gn_args.push(r#"target_cpu="arm""#.to_string()); gn_args.push(r#"v8_target_cpu="arm""#.to_string());