-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (142 loc) · 5.46 KB
/
release.yml
File metadata and controls
165 lines (142 loc) · 5.46 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 0.1.1)'
required: true
type: string
env:
XLINGS_VERSION: v0.4.0
jobs:
build-linux:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system deps
run: |
sudo apt-get update -qq
sudo apt-get install -y curl git build-essential
- name: Install Xlings
env:
XLINGS_NON_INTERACTIVE: 1
run: |
VERSION_NUM="${XLINGS_VERSION#v}"
TARBALL="xlings-${VERSION_NUM}-linux-x86_64.tar.gz"
curl -fSL -o "$RUNNER_TEMP/$TARBALL" "https://github.com/d2learn/xlings/releases/download/${XLINGS_VERSION}/${TARBALL}"
tar -xzf "$RUNNER_TEMP/$TARBALL" -C "$RUNNER_TEMP"
EXTRACT_DIR=$(find "$RUNNER_TEMP" -maxdepth 1 -type d -name "xlings-*" | head -1)
chmod +x "$EXTRACT_DIR/bin/xlings"
"$EXTRACT_DIR/bin/xlings" self install
echo "PATH=$HOME/.xlings/subos/current/bin:$PATH" >> "$GITHUB_ENV"
- name: Install Project Dependencies via Xlings
run: |
xlings install
- name: Build with xmake
run: |
xmake f -m release -y
xmake -j$(nproc)
- name: Create release package
run: |
mkdir -p d2x-${{ inputs.version }}-linux-x86_64
cp build/linux/x86_64/release/d2x d2x-${{ inputs.version }}-linux-x86_64/
tar -czf d2x-${{ inputs.version }}-linux-x86_64.tar.gz d2x-${{ inputs.version }}-linux-x86_64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: d2x-linux-x86_64
path: d2x-${{ inputs.version }}-linux-x86_64.tar.gz
build-macos:
runs-on: macos-15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Xlings
env:
XLINGS_NON_INTERACTIVE: 1
run: |
VERSION_NUM="${XLINGS_VERSION#v}"
TARBALL="xlings-${VERSION_NUM}-macosx-arm64.tar.gz"
curl -fSL -o "$RUNNER_TEMP/$TARBALL" "https://github.com/d2learn/xlings/releases/download/${XLINGS_VERSION}/${TARBALL}"
tar -xzf "$RUNNER_TEMP/$TARBALL" -C "$RUNNER_TEMP"
EXTRACT_DIR=$(find "$RUNNER_TEMP" -maxdepth 1 -type d -name "xlings-*" | head -1)
xattr -dr com.apple.quarantine "$EXTRACT_DIR" 2>/dev/null || true
chmod +x "$EXTRACT_DIR/bin/xlings"
"$EXTRACT_DIR/bin/xlings" self install
echo "PATH=$HOME/.xlings/subos/current/bin:$PATH" >> "$GITHUB_ENV"
- name: Install Project Dependencies via Xlings
run: |
xlings install
clang --version
- name: Build with xmake
run: |
export LLVM_PREFIX=$HOME/.xlings/data/xpkgs/xim-x-llvm/20.1.7
xmake f -m release --toolchain=llvm --sdk=$LLVM_PREFIX -vv -y
xmake -j$(nproc)
- name: Verify no LLVM runtime dependency
run: |
BIN=build/macosx/arm64/release/d2x
if otool -L "$BIN" | grep -q "llvm"; then
otool -L "$BIN"
echo "FAIL: binary links against LLVM dylib"
exit 1
fi
echo "OK: binary has no LLVM runtime dependency"
- name: Create release package
run: |
mkdir -p d2x-${{ inputs.version }}-macosx-arm64
cp build/macosx/arm64/release/d2x d2x-${{ inputs.version }}-macosx-arm64/
tar -czf d2x-${{ inputs.version }}-macosx-arm64.tar.gz d2x-${{ inputs.version }}-macosx-arm64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: d2x-macosx-arm64
path: d2x-${{ inputs.version }}-macosx-arm64.tar.gz
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
- name: Build with xmake
run: |
xmake f -m release -y
xmake -j$env:NUMBER_OF_PROCESSORS
- name: Create release package
shell: pwsh
run: |
New-Item -ItemType Directory -Path "d2x-${{ inputs.version }}-windows-x86_64" -Force
Copy-Item "build\windows\x64\release\d2x.exe" -Destination "d2x-${{ inputs.version }}-windows-x86_64\"
Compress-Archive -Path "d2x-${{ inputs.version }}-windows-x86_64" -DestinationPath "d2x-${{ inputs.version }}-windows-x86_64.zip"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: d2x-windows-x86_64
path: d2x-${{ inputs.version }}-windows-x86_64.zip
create-release:
needs: [build-linux, build-macos, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ inputs.version }}
name: ${{ inputs.version }}
draft: false
prerelease: false
files: |
artifacts/d2x-linux-x86_64/d2x-${{ inputs.version }}-linux-x86_64.tar.gz
artifacts/d2x-macosx-arm64/d2x-${{ inputs.version }}-macosx-arm64.tar.gz
artifacts/d2x-windows-x86_64/d2x-${{ inputs.version }}-windows-x86_64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}