mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add `build-args` input in CI and try_parser job definition so we can pass own build args to `./mach build` Testing: There are tests for try parser and I tested CI in my fork. Fixes: partial fix #36823 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
225 lines
8.3 KiB
YAML
225 lines
8.3 KiB
YAML
name: Windows
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
profile:
|
|
required: false
|
|
default: "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:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
github-release-id:
|
|
required: false
|
|
type: string
|
|
force-github-hosted-runner:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
bencher:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
workflow_dispatch:
|
|
inputs:
|
|
profile:
|
|
required: false
|
|
default: "release"
|
|
options: ["release", "debug", "production"]
|
|
type: choice
|
|
unit-tests:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
build-libservo:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
upload:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
force-github-hosted-runner:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
bencher:
|
|
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:
|
|
uses: ./.github/workflows/self-hosted-runner-select.yml
|
|
secrets: inherit
|
|
with:
|
|
github-hosted-runner-label: windows-2022
|
|
self-hosted-image-name: servo-windows10
|
|
force-github-hosted-runner: ${{ inputs.force-github-hosted-runner }}
|
|
runner-timeout:
|
|
needs:
|
|
- runner-select
|
|
uses: ./.github/workflows/self-hosted-runner-timeout.yml
|
|
secrets: inherit
|
|
with:
|
|
unique-id: ${{ needs.runner-select.outputs.unique-id }}
|
|
is-self-hosted: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
|
|
|
|
build:
|
|
needs:
|
|
- runner-select
|
|
name: Windows Build [${{ needs.runner-select.outputs.unique-id }}]
|
|
runs-on: ${{ needs.runner-select.outputs.selected-runner-label }}
|
|
steps:
|
|
- if: ${{ runner.environment != 'self-hosted' && github.event_name != 'pull_request_target' }}
|
|
uses: actions/checkout@v4
|
|
- if: ${{ runner.environment != 'self-hosted' && github.event_name == 'pull_request_target' }}
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
fetch-depth: 1
|
|
|
|
# Faster checkout for self-hosted runner that uses prebaked repo.
|
|
- if: ${{ runner.environment == 'self-hosted' && github.event_name != 'pull_request_target' }}
|
|
run: git fetch --depth=1 origin $env:GITHUB_SHA
|
|
- if: ${{ runner.environment == 'self-hosted' && github.event_name == 'pull_request_target' }}
|
|
run: git fetch --depth=1 origin ${{ github.event.pull_request.head.sha }}
|
|
- if: ${{ runner.environment == 'self-hosted' }}
|
|
# Same as `git switch --detach FETCH_HEAD`, but fixes up dirty working
|
|
# trees, in case the runner image was baked with a dirty working tree.
|
|
run: |
|
|
git switch --detach
|
|
git reset --hard FETCH_HEAD
|
|
|
|
- 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.
|
|
# Workaround for https://github.com/actions/runner-images/issues/10001:
|
|
- name: Upgrade llvm
|
|
if: ${{ runner.environment != 'self-hosted' }}
|
|
run: choco upgrade llvm
|
|
- name: Install wixtoolset
|
|
if: ${{ runner.environment != 'self-hosted' }}
|
|
run: |
|
|
choco install wixtoolset
|
|
echo "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
- 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
|
|
# For some reason WiX isn't currently on the GitHub runner path. This is a
|
|
# temporary workaround until that is fixed.
|
|
- name: Add WiX to Path
|
|
if: ${{ runner.environment != 'self-hosted' }}
|
|
run: |
|
|
"$env:WIX\bin" >> $env:GITHUB_PATH
|
|
|
|
# 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 }})
|
|
run: |
|
|
.\mach build --use-crown --locked --${{ inputs.profile }} ${{ inputs.build-args }}
|
|
cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows -Recurse
|
|
- name: Copy resources
|
|
if: ${{ runner.environment != 'self-hosted' }}
|
|
# GitHub-hosted runners check out the repo on D: drive.
|
|
run: cp D:\a\servo\servo\resources C:\a\servo\servo -Recurse
|
|
- name: Smoketest
|
|
run: .\mach smoketest --${{ inputs.profile }}
|
|
- name: Unit tests
|
|
if: ${{ inputs.unit-tests }}
|
|
uses: nick-fields/retry@v3
|
|
with:
|
|
timeout_minutes: 30
|
|
max_attempts: 3 # https://github.com/servo/servo/issues/30683
|
|
command: .\mach test-unit --${{ inputs.profile }} -- -- --test-threads=1
|
|
- name: Build libservo with examples
|
|
if: ${{ inputs.build-libservo }}
|
|
continue-on-error: true
|
|
run: cargo build -p libservo --all-targets
|
|
- name: Archive build timing
|
|
uses: actions/upload-artifact@v4
|
|
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-*
|
|
- name: Build mach package
|
|
run: .\mach package --${{ inputs.profile }}
|
|
- name: Upload artifact for mach package
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ inputs.profile }}-binary-windows
|
|
# 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\Servo.exe
|
|
# Zip: C:\a\servo\servo\target\${{ inputs.profile }}\msi\Servo.zip
|
|
path: C:\\a\\servo\\servo\\target\\${{ inputs.profile }}\\msi\\Servo.exe
|
|
- name: Upload nightly
|
|
if: ${{ inputs.upload }}
|
|
run: |
|
|
.\mach upload-nightly windows-msvc --secret-from-environment `
|
|
--github-release-id ${{ inputs.github-release-id }}
|
|
env:
|
|
S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }}
|
|
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
|
|
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
|
|
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/Servo.exe
|
|
file-size: true
|
|
speedometer: false
|
|
dromaeo: false
|
|
secrets: inherit
|