-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (154 loc) · 5.29 KB
/
Copy pathbuild.yml
File metadata and controls
183 lines (154 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: build-and-package
on:
push:
branches: ["main", "master"]
tags: ["v*"]
pull_request:
workflow_dispatch:
inputs:
runtime_ref:
description: "dotnet/runtime git ref (branch/tag/sha) to fetch into vendor/runtime"
required: false
default: "main"
permissions:
contents: write
jobs:
build_windows:
name: Windows x64 release
runs-on: windows-latest
env:
DOTNET_PATH: ./vendor/runtime
RUNTIME_REF: ${{ github.event.inputs.runtime_ref || 'main' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Ensure vendor/runtime (sparse clone dotnet/runtime)
shell: pwsh
run: |
if (Test-Path "vendor/runtime") {
Write-Host "vendor/runtime already exists; skipping dotnet/runtime clone."
exit 0
}
New-Item -ItemType Directory -Force "vendor" | Out-Null
git clone --depth 1 --filter=blob:none --sparse --single-branch -b "$env:RUNTIME_REF" https://github.com/dotnet/runtime "vendor/runtime"
pushd "vendor/runtime"
git sparse-checkout set `
"src/coreclr/pal/prebuilt/inc" `
"src/coreclr/pal/inc" `
"src/coreclr/pal/inc/rt" `
"src/coreclr/inc" `
"src/coreclr" `
"src/native"
popd
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Build
shell: pwsh
run: |
./build.ps1
- name: Package
shell: pwsh
run: |
$outDir = "dist"
New-Item -ItemType Directory -Force $outDir | Out-Null
$src = "build/windows/x64/release"
if (-not (Test-Path $src)) { throw "Build output not found: $src" }
Copy-Item "$src\sw2tracer.dll" $outDir -Force
if (Test-Path "$src\sw2tracer.lib") { Copy-Item "$src\sw2tracer.lib" $outDir -Force }
if (Test-Path "$src\sw2tracer.exp") { Copy-Item "$src\sw2tracer.exp" $outDir -Force }
$zip = "sw2tracer-$env:RUNNER_OS-x64.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path "$outDir\*" -DestinationPath $zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sw2tracer-Windows-x64
path: sw2tracer-Windows-x64.zip
- name: Upload to GitHub Release (tags only)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: sw2tracer-Windows-x64.zip
build_linux:
name: Linux x64 release (SteamRT Sniper)
runs-on: ubuntu-latest
container:
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk
env:
DOTNET_PATH: ./vendor/runtime
RUNTIME_REF: ${{ github.event.inputs.runtime_ref || 'main' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Ensure vendor/runtime (sparse clone dotnet/runtime)
shell: bash
run: |
set -euo pipefail
if [ -d "vendor/runtime" ]; then
echo "vendor/runtime already exists; skipping dotnet/runtime clone."
exit 0
fi
mkdir -p vendor
git clone --depth 1 --filter=blob:none --sparse --single-branch -b "${RUNTIME_REF}" https://github.com/dotnet/runtime vendor/runtime
(cd vendor/runtime && git sparse-checkout set \
src/coreclr/pal/prebuilt/inc \
src/coreclr/pal/inc \
src/coreclr/pal/inc/rt \
src/coreclr/inc \
src/coreclr \
src/native)
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
- name: Build
shell: bash
run: |
chmod +x ./build.sh
./build.sh
- name: Package
shell: bash
run: |
set -euo pipefail
if ! command -v zip >/dev/null 2>&1; then
if command -v apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y zip
elif command -v dnf >/dev/null 2>&1; then
dnf install -y zip
elif command -v yum >/dev/null 2>&1; then
yum install -y zip
elif command -v pacman >/dev/null 2>&1; then
pacman -Sy --noconfirm zip
else
echo "zip is required but no supported package manager was found in the container."
exit 1
fi
fi
mkdir -p dist
src="build/linux/x64/release"
test -d "$src"
cp "$src/libsw2tracer.so" dist/
zip="sw2tracer-${RUNNER_OS}-x64.zip"
rm -f "$zip"
(cd dist && zip -r "../$zip" .)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sw2tracer-Linux-x64
path: sw2tracer-Linux-x64.zip
- name: Upload to GitHub Release (tags only)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: sw2tracer-Linux-x64.zip