/
githubmirror
/
servo
Обзор
Документация
Войти
/
githubmirror
/
servo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/windows.yml
306 строк
12 KB
Martin Robinson
Use `ci-runners/actions/checkout` consistently (#46725)
23 июл 2026, 12:07
Не верифицирован
23 июл 2026, 12:07
b895d3d
Код
Авторство
О чём код?
name: Windows on: workflow_call: inputs: profile: required: false default: "checked-release" type: string build-args: default: "" required: false type: string unit-tests: required: false default: false type: boolean build-libservo: required: false default: false type: boolean upload_zip: required: false default: false type: boolean force-github-hosted-runner: required: false type: boolean default: false bencher: required: false default: false type: boolean capi: required: false default: false type: boolean outputs: artifact_ids: value: ${{ jobs.build.outputs.release_artifact_ids }} description: Comma-separated list of artifact IDs for the release artifacts workflow_dispatch: inputs: profile: required: false default: "checked-release" options: ["checked-release", "release", "debug", "production"] type: choice unit-tests: required: false default: false type: boolean build-libservo: required: false default: false type: boolean force-github-hosted-runner: required: false type: boolean default: false bencher: required: false default: false type: boolean capi: required: false default: false type: boolean env: RUST_BACKTRACE: 1 SHELL: /bin/bash CARGO_TARGET_DIR: C:\\a\\servo\\servo\\target # clang_sys will search msys path before Program Files\LLVM # so we need to override this behaviour until we update clang-sys # https://github.com/KyleMayes/clang-sys/issues/150 LIBCLANG_PATH: C:\Program Files\LLVM\bin RUSTUP_WINDOWS_PATH_ADD_BIN: 1 jobs: # Runs the underlying job (“workload”) on a self-hosted runner if available, # with the help of a `runner-select` job and a `runner-timeout` job. runner-select: runs-on: ubuntu-24.04 outputs: unique-id: ${{ steps.select.outputs.unique-id }} selected-runner-label: ${{ steps.select.outputs.selected-runner-label }} runner-type-label: ${{ steps.select.outputs.runner-type-label }} is-self-hosted: ${{ steps.select.outputs.is-self-hosted }} steps: - name: Runner select id: select uses: servo/ci-runners/actions/runner-select@a05e7e830e3f4d4c71bdc5a38f003f052b72668c with: GITHUB_TOKEN: ${{ github.token }} github-hosted-runner-label: windows-2022 self-hosted-image-name: servo-windows10 # You can disable self-hosted runners globally by creating a repository variable named # NO_SELF_HOSTED_RUNNERS with any non-empty value. # <https://github.com/servo/servo/settings/variables/actions> NO_SELF_HOSTED_RUNNERS: ${{ vars.NO_SELF_HOSTED_RUNNERS }} # Any other boolean conditions that disable self-hosted runners go here. force-github-hosted-runner: ${{ inputs.force-github-hosted-runner }} build: needs: - runner-select name: Windows Build [${{ needs.runner-select.outputs.unique-id }}] runs-on: ${{ needs.runner-select.outputs.selected-runner-label }} outputs: release_artifact_ids: ${{ steps.artifact_ids.outputs.release_artifact_ids }} steps: - uses: servo/ci-runners/actions/checkout@a05e7e830e3f4d4c71bdc5a38f003f052b72668c - name: ccache # FIXME: “Error: Restoring cache failed: Error: Unable to locate executable file: sh.” if: ${{ runner.environment != 'self-hosted' }} uses: hendrikmuhs/ccache-action@v1.2 - if: ${{ runner.environment != 'self-hosted' }} run: | echo CCACHE=ccache >> $GITHUB_ENV # Install missing tools in a GitHub-hosted runner. - name: Install Winget if: ${{ runner.environment != 'self-hosted' }} shell: powershell run: | Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force Repair-WinGetPackageManager -Latest -Force -AllUsers env: # Authenticated requests have a higher rate limit. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install WiX if: ${{ runner.environment != 'self-hosted' }} shell: powershell run: | winget install --silent --exact WiXToolset.WiXCLI --version 7.0.0.0 --accept-source-agreements # The WiX installer sets the WIX7 environment variable to the install directory, so add it # to the GITHUB_PATH so that it is available in subsequent steps. $wixBin = [System.Environment]::GetEnvironmentVariable("WIX7", "Machine") $wixBin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Configure NuGet source for WiX shell: powershell run: | $config = @( '<?xml version="1.0" encoding="utf-8"?>' '<configuration>' ' <packageSources>' ' <clear />' ' <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />' ' </packageSources>' '</configuration>' ) Set-Content -Path "NuGet.config" -Value $config -Encoding ascii - name: Setup Python if: ${{ runner.environment != 'self-hosted' }} uses: ./.github/actions/setup-python - name: Bootstrap if: ${{ runner.environment != 'self-hosted' }} run: | .\mach fetch .\mach bootstrap-gstreamer # Always install crown, even on self-hosted runners, because it is tightly # coupled to the rustc version, and we may have the wrong version if the # commit we are building uses a different rustc version. - name: Install crown run: cargo install --path support/crown --force - name: Debug logging for incremental builds if: ${{ runner.environment == 'self-hosted' }} run: | cat C:\init\incremental_build_debug.txt echo "`$env:LIBCLANG_PATH now = $env:LIBCLANG_PATH" echo "`$env:PATH now = $env:PATH" - name: Build (${{ inputs.profile }}) env: RUSTFLAGS: ${{ inputs.profile == 'checked-release' && '-D warnings' || '' }} run: | .\mach build --use-crown --locked --profile ${{ inputs.profile }} ${{ inputs.build-args }} mv C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows - name: Copy resources # GitHub-hosted runners sometimes check out the repo on D: drive. if: ${{ runner.environment != 'self-hosted' && startsWith(github.workspace, 'D:\') }} run: cp D:\a\servo\servo\resources C:\a\servo\servo -Recurse - name: Smoketest run: .\mach smoketest --profile ${{ inputs.profile }} - name: Install cargo nextest if: ${{ runner.environment != 'self-hosted' && inputs.unit-tests }} uses: taiki-e/install-action@v2 with: tool: nextest@0.9.140 # On self-hosted windows runners the install-action fails - name: Install cargo nextest (self-hosted) if: ${{ runner.environment == 'self-hosted' && inputs.unit-tests }} run: cargo install cargo-nextest --locked # On self-hosted windows runners sometimes OOM for Unit tests - name: Set CARGO_BUILD_JOBS for self-hosted runner if: ${{ runner.environment == 'self-hosted' }} shell: bash run: echo "CARGO_BUILD_JOBS=-2" >> $GITHUB_ENV - name: Unit tests if: ${{ inputs.unit-tests }} id: run_unit_tests env: NEXTEST_RETRIES: 3 # https://github.com/servo/servo/issues/30683 run: ./mach test-unit --profile ${{ inputs.profile }} --nextest-profile ci # We upload the test-results to Codecov to help us identify flaky unit-tests. - name: Upload test results to Codecov # Upload test results to Codecov, also for failed unit-tests, but only # if unit-tests were supposed to run, and not if they were skipped (e.g., due # to an earlier failure). if: ${{ !cancelled() && steps.run_unit_tests.conclusion != 'skipped' }} uses: codecov/codecov-action@v6 with: report_type: test_results files: target/nextest/ci/junit.xml disable_search: true flags: unittests,unittests-windows,unittests-windows-${{ inputs.profile }} token: ${{ secrets.CODECOV_TOKEN }} - name: Archive build timing uses: actions/upload-artifact@v7 with: name: cargo-timings-windows-${{ inputs.profile }} # Using a wildcard here ensures that the archive includes the path. path: C:\\a\\servo\\servo\\target\\cargo-timings-* if-no-files-found: error - name: Build mach package run: .\mach package --profile ${{ inputs.profile }} # These files are available # MSI Installer: C:\a\servo\servo\target\${{ inputs.profile }}\msi\Installer.msi # Bundle: C:\a\servo\servo\target\${{ inputs.profile }}\msi\ServoShell.exe # Zip: C:\a\servo\servo\target\${{ inputs.profile }}\msi\ServoShell.zip - name: Upload artifact for mach package uses: actions/upload-artifact@v7 id: upload-exe with: name: ${{ inputs.profile }}-binary-windows path: C:\\a\\servo\\servo\\target\\${{ inputs.profile }}\\msi\\ServoShell.exe if-no-files-found: error - name: Upload artifact for mach package (zip) uses: actions/upload-artifact@v7 id: upload-zip if: ${{ inputs.upload_zip }} with: name: ${{ inputs.profile }}-binary-windows-zip path: C:\\a\\servo\\servo\\target\\${{ inputs.profile }}\\msi\\ServoShell.zip if-no-files-found: error - name: Collect artifact IDs needed by the release workflow id: artifact_ids shell: bash run: | ARTIFACT_IDS="${{steps.upload-exe.outputs.artifact-id}}" if [[ -n "${{steps.upload-zip.outputs.artifact-id}}" ]]; then ARTIFACT_IDS="${ARTIFACT_IDS},${{steps.upload-zip.outputs.artifact-id}}" fi echo "release_artifact_ids=${ARTIFACT_IDS}" >> $GITHUB_OUTPUT bencher: needs: ["build"] if: ${{ inputs.bencher && inputs.profile != 'debug' && github.event_name != 'workflow_dispatch' && github.event_name != 'merge_group' }} uses: ./.github/workflows/bencher.yml with: target: 'windows' profile: ${{ inputs.profile }} compressed-file-path: '' binary-path: ${{ inputs.profile }}-binary-windows/ServoShell.exe file-size: true speedometer: false dromaeo: false secrets: inherit build-libservo: if: ${{ inputs.build-libservo }} name: Build libservo and MSRV check runs-on: windows-2022 steps: - uses: servo/ci-runners/actions/checkout@a05e7e830e3f4d4c71bdc5a38f003f052b72668c - name: Setup Python uses: ./.github/actions/setup-python - name: Determine MSRV id: msrv uses: ./.github/actions/parse_msrv - name: Install MSRV uses: dtolnay/rust-toolchain@master with: toolchain: ${{ steps.msrv.outputs.rust_version }} - name: Compile libservo with MSRV run: | cargo +${{ steps.msrv.outputs.rust_version }} build -p servo --locked capi: if: ${{ inputs.capi }} name: Build and test Servo's C API runs-on: windows-2022 steps: - uses: servo/ci-runners/actions/checkout@a05e7e830e3f4d4c71bdc5a38f003f052b72668c - name: Install cargo-c # required by servo-capi-tests's build.rs uses: taiki-e/install-action@v2 with: tool: cargo-c@0.10.23 - name: Build and test servo-capi-tests env: CC: "clang-cl.exe" CXX: "clang-cl.exe" run: cargo test -p servo-capi-tests --locked