mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-20 06:00:06 +08:00
217 lines
7.7 KiB
YAML
217 lines
7.7 KiB
YAML
name: Windows MSVC
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- windows
|
|
- "pull-request/[0-9]+"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# sccache cannot cache incremental Rust compilations, and rust-cache removes
|
|
# incremental artifacts before saving the target directory.
|
|
CARGO_INCREMENTAL: "0"
|
|
|
|
jobs:
|
|
pr_metadata:
|
|
name: Resolve PR metadata
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
outputs:
|
|
should_run: ${{ github.ref == 'refs/heads/windows' || steps.gate.outputs.should_run == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- id: gate
|
|
if: github.ref != 'refs/heads/windows'
|
|
uses: ./.github/actions/pr-gate
|
|
with:
|
|
required_label: test:windows
|
|
|
|
pr-check:
|
|
name: PR lint and test (${{ matrix.arch }})
|
|
needs: pr_metadata
|
|
if: >-
|
|
needs.pr_metadata.outputs.should_run == 'true' &&
|
|
github.ref != 'refs/heads/windows' &&
|
|
github.event_name != 'workflow_dispatch'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
runner: windows-2025
|
|
rust_target: x86_64-pc-windows-msvc
|
|
- arch: arm64
|
|
runner: windows-11-arm
|
|
rust_target: aarch64-pc-windows-msvc
|
|
runs-on: ${{ matrix.runner }}
|
|
env:
|
|
READ_ONLY_GITHUB_TOKEN: ${{ github.token }}
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
SCCACHE_GHA_VERSION: windows-msvc-${{ matrix.arch }}
|
|
SCCACHE_CLIENT_SIDE: "1"
|
|
SCCACHE_BASEDIRS: ${{ github.workspace }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0
|
|
with:
|
|
install: false
|
|
experimental: true
|
|
- name: Configure GHA sccache backend
|
|
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
|
|
- name: Isolate Rust toolchains
|
|
# rust-cache hashes every installed toolchain, including unused runner defaults.
|
|
run: '"RUSTUP_HOME=$env:RUNNER_TEMP/openshell-rustup" >> $env:GITHUB_ENV'
|
|
- name: Install Rust toolchain
|
|
# GitHub-hosted runners include rustup. With no toolchain argument,
|
|
# rustup installs the checked-in rust-toolchain.toml configuration:
|
|
# https://github.com/dtolnay/rust-toolchain/issues/133#issuecomment-2610825530
|
|
run: |
|
|
rustup set profile minimal
|
|
rustup toolchain install
|
|
rustup component add clippy
|
|
rustup target add ${{ matrix.rust_target }}
|
|
- name: Install cargo-nextest
|
|
run: mise install --locked github:nextest-rs/nextest
|
|
- name: Cache Rust target and registry
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
env:
|
|
# Keep rust-cache's cargo metadata calls independent of the compiler
|
|
# wrapper; build steps still inherit sccache from the job.
|
|
RUSTC_WRAPPER: ""
|
|
with:
|
|
shared-key: windows-msvc-${{ matrix.arch }}
|
|
cache-targets: "true"
|
|
cache-on-failure: "true"
|
|
cache-bin: "false"
|
|
- name: Lint Windows-supported crates
|
|
run: mise run --skip-tools windows:lint:${{ matrix.arch }}
|
|
- name: Test
|
|
run: mise run --skip-tools windows:test:${{ matrix.arch }}
|
|
- name: sccache stats
|
|
if: always()
|
|
run: sccache --show-stats
|
|
|
|
cache-seed:
|
|
name: Seed cache (${{ matrix.arch }})
|
|
# Keep release-branch Windows validation advisory while the lane matures.
|
|
continue-on-error: true
|
|
needs: pr_metadata
|
|
if: >-
|
|
needs.pr_metadata.outputs.should_run == 'true' &&
|
|
github.ref == 'refs/heads/windows'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
runner: windows-2025
|
|
rust_target: x86_64-pc-windows-msvc
|
|
- arch: arm64
|
|
runner: windows-11-arm
|
|
rust_target: aarch64-pc-windows-msvc
|
|
runs-on: ${{ matrix.runner }}
|
|
env:
|
|
READ_ONLY_GITHUB_TOKEN: ${{ github.token }}
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
SCCACHE_GHA_VERSION: windows-msvc-${{ matrix.arch }}
|
|
SCCACHE_CLIENT_SIDE: "1"
|
|
SCCACHE_BASEDIRS: ${{ github.workspace }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0
|
|
with:
|
|
install: false
|
|
experimental: true
|
|
- name: Configure GHA sccache backend
|
|
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
|
|
- name: Isolate Rust toolchains
|
|
run: '"RUSTUP_HOME=$env:RUNNER_TEMP/openshell-rustup" >> $env:GITHUB_ENV'
|
|
- name: Install Rust toolchain
|
|
run: |
|
|
rustup set profile minimal
|
|
rustup toolchain install
|
|
rustup component add clippy
|
|
rustup target add ${{ matrix.rust_target }}
|
|
- name: Install cargo-nextest
|
|
run: mise install --locked github:nextest-rs/nextest
|
|
- name: Cache Rust target and registry
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
env:
|
|
RUSTC_WRAPPER: ""
|
|
with:
|
|
shared-key: windows-msvc-${{ matrix.arch }}
|
|
cache-targets: "true"
|
|
cache-on-failure: "true"
|
|
cache-bin: "false"
|
|
- name: Lint Windows-supported crates
|
|
# Keep the seed workload identical to the pull-request workload so the
|
|
# windows-branch cache reflects the same lint and test commands.
|
|
run: mise run --skip-tools windows:lint:${{ matrix.arch }}
|
|
- name: Test
|
|
run: mise run --skip-tools windows:test:${{ matrix.arch }}
|
|
- name: sccache stats
|
|
if: always()
|
|
run: sccache --show-stats
|
|
|
|
build:
|
|
name: Build binaries (${{ matrix.arch }})
|
|
continue-on-error: true
|
|
needs: cache-seed
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
runner: windows-2025
|
|
rust_target: x86_64-pc-windows-msvc
|
|
- arch: arm64
|
|
runner: windows-11-arm
|
|
rust_target: aarch64-pc-windows-msvc
|
|
runs-on: ${{ matrix.runner }}
|
|
env:
|
|
READ_ONLY_GITHUB_TOKEN: ${{ github.token }}
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
SCCACHE_GHA_VERSION: windows-msvc-${{ matrix.arch }}
|
|
SCCACHE_CLIENT_SIDE: "1"
|
|
SCCACHE_BASEDIRS: ${{ github.workspace }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0
|
|
with:
|
|
install: false
|
|
experimental: true
|
|
- name: Configure GHA sccache backend
|
|
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
|
|
- name: Isolate Rust toolchains
|
|
run: '"RUSTUP_HOME=$env:RUNNER_TEMP/openshell-rustup" >> $env:GITHUB_ENV'
|
|
- name: Install Rust toolchain
|
|
run: |
|
|
rustup set profile minimal
|
|
rustup toolchain install
|
|
rustup target add ${{ matrix.rust_target }}
|
|
- name: Cache Rust target and registry
|
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
env:
|
|
RUSTC_WRAPPER: ""
|
|
with:
|
|
shared-key: windows-msvc-${{ matrix.arch }}
|
|
cache-targets: "true"
|
|
cache-on-failure: "true"
|
|
cache-bin: "false"
|
|
- name: Build release binaries
|
|
run: mise run --skip-tools windows:build:${{ matrix.arch }}
|
|
- name: sccache stats
|
|
if: always()
|
|
run: sccache --show-stats
|