Skip to content

Commit 7657268

Browse files
committed
ci: dep-llvm-windows workflow packaging official LLVM release as Stride.Dependencies.LLVM.Windows
1 parent 97394cc commit 7657268

2 files changed

Lines changed: 121 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: "Dep: Package LLVM (Windows host)"
2+
3+
# Repackages the official LLVM Windows release into Stride.Dependencies.LLVM.Windows.
4+
# No build from source: downloads clang+llvm-<ver>-x86_64-pc-windows-msvc.tar.xz from
5+
# the upstream GitHub release and keeps only the three binaries Stride.Native.targets
6+
# invokes on Windows hosts. clang-cl/lld-link/ld.lld/ld64.lld are the same executables
7+
# dispatching on argv[0], so shipping clang.exe + lld.exe covers every driver via
8+
# --driver-mode / -flavor flags.
9+
10+
on:
11+
workflow_dispatch:
12+
inputs:
13+
llvm-version:
14+
description: LLVM release version (tag llvmorg-<version> on llvm/llvm-project)
15+
default: 22.1.2
16+
required: true
17+
version:
18+
description: Package version (blank = today's date)
19+
default: ''
20+
21+
jobs:
22+
pack:
23+
name: Repackage LLVM ${{ github.event.inputs.llvm-version }}
24+
# Windows runner for the preinstalled nuget.exe (nuspec-based pack, no csproj).
25+
runs-on: windows-2025-vs2026
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
sparse-checkout: build/deps/llvm-windows
30+
31+
- name: Download and extract official release
32+
shell: bash
33+
run: |
34+
V="${{ github.event.inputs.llvm-version }}"
35+
URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-$V/clang+llvm-$V-x86_64-pc-windows-msvc.tar.xz"
36+
echo "Downloading $URL"
37+
curl -fsSL -o llvm.tar.xz "$URL"
38+
DEST=build/deps/llvm-windows/tools/win-x64
39+
mkdir -p "$DEST"
40+
tar -xJf llvm.tar.xz -C "$DEST" --strip-components=2 \
41+
"clang+llvm-$V-x86_64-pc-windows-msvc/bin/clang.exe" \
42+
"clang+llvm-$V-x86_64-pc-windows-msvc/bin/lld.exe" \
43+
"clang+llvm-$V-x86_64-pc-windows-msvc/bin/llvm-ar.exe"
44+
{
45+
printf 'LLVM %s (official upstream release, repackaged)\n' "$V"
46+
printf 'Source: https://github.com/llvm/llvm-project/releases/tag/llvmorg-%s\n' "$V"
47+
printf 'Package: clang+llvm-%s-x86_64-pc-windows-msvc.tar.xz (bin/clang.exe, bin/lld.exe, bin/llvm-ar.exe)\n' "$V"
48+
printf '\n'
49+
printf 'Stride: %s/%s @ %s\n' "${{ github.server_url }}" "${{ github.repository }}" "${{ github.sha }}"
50+
printf 'Packaged: %s\n' "$(date -u +%Y-%m-%d)"
51+
printf 'Workflow: %s/%s/actions/runs/%s\n' "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}"
52+
} > "$DEST/VERSION.txt"
53+
ls -la "$DEST"
54+
55+
- name: Pack NuGet
56+
shell: pwsh
57+
run: |
58+
$version = "${{ github.event.inputs.version }}"
59+
if (-not $version) { $version = (Get-Date -Format "yyyy.M.d") }
60+
nuget pack build/deps/llvm-windows/Stride.Dependencies.LLVM.Windows.nuspec `
61+
-Version $version `
62+
-Properties "llvmVersion=${{ github.event.inputs.llvm-version }}" `
63+
-BasePath build/deps/llvm-windows `
64+
-OutputDirectory nupkg
65+
echo "PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
66+
67+
- name: Upload package artifact
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: Stride.Dependencies.LLVM.Windows.nupkg
71+
path: nupkg/*.nupkg
72+
73+
publish:
74+
name: Sign & Publish to NuGet.org
75+
needs: pack
76+
runs-on: windows-2025-vs2026
77+
environment: production
78+
steps:
79+
- name: Install signing tool
80+
run: dotnet tool install sign --tool-path ./sign-tool --version 0.9.0-beta.23127.3
81+
82+
- name: Download artifact
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: Stride.Dependencies.LLVM.Windows.nupkg
86+
87+
- name: Sign NuGet package
88+
shell: pwsh
89+
run: |
90+
./sign-tool/sign code azure-key-vault *.nupkg `
91+
--description "Stride" `
92+
--description-url "https://stride3d.net" `
93+
--publisher-name "Stride" `
94+
--azure-key-vault-tenant-id "${{ secrets.STRIDE_SIGN_TENANT_ID }}" `
95+
--azure-key-vault-client-id "${{ secrets.STRIDE_SIGN_CLIENT_ID }}" `
96+
--azure-key-vault-client-secret "${{ secrets.STRIDE_SIGN_CLIENT_SECRET }}" `
97+
--azure-key-vault-certificate "${{ secrets.STRIDE_SIGN_KEYVAULT_CERTIFICATE }}" `
98+
--azure-key-vault-url "https://${{ secrets.STRIDE_SIGN_KEYVAULT_NAME }}.vault.azure.net/" `
99+
-v Information
100+
101+
- name: Publish
102+
run: |
103+
dotnet nuget push *.nupkg --api-key "${{ secrets.STRIDE_NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3+
<metadata>
4+
<id>Stride.Dependencies.LLVM.Windows</id>
5+
<version>$version$</version>
6+
<authors>Stride Contributors</authors>
7+
<description>LLVM toolchain (clang, lld, llvm-ar from the official LLVM $llvmVersion$ Windows release) used by Stride.Native.targets to build native code on Windows hosts. Build-time tool package; referenced host-conditionally with PrivateAssets=all.</description>
8+
<license type="expression">Apache-2.0 WITH LLVM-exception</license>
9+
<repository type="git" url="https://github.com/stride3d/stride" />
10+
</metadata>
11+
<files>
12+
<!-- Packed by .github/workflows/dep-llvm-windows.yml; see its header for details -->
13+
<file src="tools/win-x64/clang.exe" target="tools/win-x64/" />
14+
<file src="tools/win-x64/lld.exe" target="tools/win-x64/" />
15+
<file src="tools/win-x64/llvm-ar.exe" target="tools/win-x64/" />
16+
<file src="tools/win-x64/VERSION.txt" target="tools/win-x64/" />
17+
</files>
18+
</package>

0 commit comments

Comments
 (0)