roc/.github/workflows/windows_release_build.yml
2025-03-21 16:39:03 +01:00

71 lines
2.5 KiB
YAML

on:
workflow_call:
name: windows - release build
# Do not add permissions here! Configure them at the job level!
permissions: {}
env:
RUST_BACKTRACE: 1
jobs:
windows-release-build:
name: windows-release-build
runs-on: windows-2022
env:
LLVM_SYS_180_PREFIX: C:\LLVM-18.1.8-win64
timeout-minutes: 150
steps:
- uses: actions/checkout@v4
- run: Add-Content -Path "$env:GITHUB_ENV" -Value "GITHUB_RUNNER_CPU=$((Get-CimInstance Win32_Processor).Name)"
- name: download and install zig
run: |
curl.exe -f --output "C:\zig-windows-x86_64-0.13.0.zip" --url https://ziglang.org/download/0.13.0/zig-windows-x86_64-0.13.0.zip
cd C:\
7z x zig-windows-x86_64-0.13.0.zip
Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.13.0\"
- name: zig version
run: zig version
- name: extract Rust versions for stable and nightly from rust-toolchain.toml
run: |
$toolchainContent = Get-Content -Path rust-toolchain.toml -Raw
$stableMatch = [regex]::Match($toolchainContent, 'channel\s*=\s*"([\d\.]+)"')
$nightlyMatch = [regex]::Match($toolchainContent, 'channel\s*=\s*"(nightly-[\d-]+)"')
if (-not $stableMatch.Success) {
Write-Error "Failed to extract stable Rust version from rust-toolchain.toml"
exit 1
}
if (-not $nightlyMatch.Success) {
Write-Error "Failed to extract nightly Rust version from rust-toolchain.toml"
exit 1
}
$stableVersion = $stableMatch.Groups[1].Value
$nightlyVersion = $nightlyMatch.Groups[1].Value
echo "RUST_STABLE_VERSION=$stableVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "RUST_NIGHTLY_VERSION=$nightlyVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
Write-Host "Found Rust stable version: $stableVersion"
Write-Host "Found Rust nightly version: $nightlyVersion"
- name: install rust
run: |
rustup install ${{ env.RUST_NIGHTLY_VERSION }}
rustup install ${{ env.RUST_STABLE_VERSION }}
- name: set up llvm 18
run: |
curl.exe -f -L -O -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://github.com/roc-lang/llvm-package-windows/releases/download/v18.1.8/LLVM-18.1.8-win64.7z
7z x LLVM-18.1.8-win64.7z -oC:\LLVM-18.1.8-win64
- name: cargo build release.
run: cargo build --locked --release