Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ self-hosted-runner:
- depot-ubuntu-24.04-4
- depot-ubuntu-24.04-8
- namespace-profile-macos-15
- namespace-profile-windows-2022-x86-64-16x32
- github-windows-2025-x86_64-8
- github-windows-2025-x86_64-16
40 changes: 39 additions & 1 deletion .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:

windows:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }}
runs-on: windows-latest
runs-on: ${{ github.repository == 'astral-sh/ty' && matrix.platform.target == 'x86_64-pc-windows-msvc' && 'namespace-profile-windows-2022-x86-64-16x32' || 'windows-latest' }}
strategy:
matrix:
platform:
Expand All @@ -209,17 +209,55 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: ${{ matrix.platform.arch }}
- name: "Install uv for PGO training"
if: ${{ matrix.platform.target == 'x86_64-pc-windows-msvc' }}
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: "Install LLVM profiling tools"
id: pgo-toolchain
if: ${{ matrix.platform.target == 'x86_64-pc-windows-msvc' }}
working-directory: ruff
shell: bash
run: |
rustup component add llvm-tools-preview
echo "toolchain=$(rustc --version | cut -d ' ' -f2)" >> "$GITHUB_OUTPUT"
- name: "Train PGO ty"
if: ${{ matrix.platform.target == 'x86_64-pc-windows-msvc' }}
shell: bash
run: |
export RUSTFLAGS="${RUSTFLAGS:+${RUSTFLAGS} }-C target-feature=+crt-static"

python scripts/build_ty_pgo.py \
--target "${{ matrix.platform.target }}" \
--target-dir "${{ github.workspace }}/ruff/target/ty-pgo" \
--train-only

PROFILE_HOT_COUNT="$(cat "${{ github.workspace }}/ruff/target/ty-pgo/ty.profile-hot-count")"
echo "RUSTFLAGS=${RUSTFLAGS:+${RUSTFLAGS} }-Cprofile-use=${{ github.workspace }}/ruff/target/ty-pgo/ty.profdata -Cllvm-args=--profile-summary-hot-count=$PROFILE_HOT_COUNT" >> "$GITHUB_ENV"
- name: "Prep README.md"
run: python scripts/transform_readme.py
- name: "Build wheels"
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
maturin-version: v1.14.1
target: ${{ matrix.platform.target }}
rust-toolchain: ${{ steps.pgo-toolchain.outputs.toolchain }}
args: --release --locked --out dist --compatibility pypi
env:
# aarch64 build fails, see https://github.com/PyO3/maturin/issues/2110
XWIN_VERSION: 16
- name: "Verify static Windows runtime"
if: ${{ matrix.platform.target == 'x86_64-pc-windows-msvc' }}
working-directory: ruff
shell: bash
run: |
LLVM_READOBJ="$(rustc --print sysroot)/lib/rustlib/${{ matrix.platform.target }}/bin/llvm-readobj.exe"
IMPORTS_FILE="$RUNNER_TEMP/ty-coff-imports.txt"
"$LLVM_READOBJ" --coff-imports "target/${{ matrix.platform.target }}/release/ty.exe" > "$IMPORTS_FILE"

if grep -Eiq 'vcruntime[[:digit:]_]*\.dll|api-ms-win-crt-' "$IMPORTS_FILE"; then
echo "ty must not dynamically link the Visual C++ runtime" >&2
exit 1
fi
- name: "Test wheel"
if: ${{ !startsWith(matrix.platform.target, 'aarch64') }}
shell: bash
Expand Down