Skip to content

Commit 0f6a9e1

Browse files
committed
fix(ci): follow xlings project CI pattern for toolchain setup
- Use curl quick_install.sh instead of gh release download - Use GITHUB_PATH/GITHUB_ENV for persistent PATH (not export) - Pass absolute --sdk/--cc/--cxx paths to xmake f (bypass shim issues) - Add -vv for verbose xmake config output - Remove github.token dependency from setup-toolchain action Modeled after openxlings/xlings CI which uses the same approach.
1 parent 636c55a commit 0f6a9e1

2 files changed

Lines changed: 33 additions & 60 deletions

File tree

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,33 @@
11
name: Setup C++23 Toolchain
22
description: Install xlings and project dependencies declared in .xlings.json
33

4-
inputs:
5-
token:
6-
description: 'GitHub token for downloading xlings releases'
7-
required: true
8-
94
runs:
105
using: composite
116
steps:
12-
- name: Install xlings (linux)
13-
if: runner.os == 'Linux'
14-
shell: bash
15-
run: |
16-
LATEST_VERSION=$(gh release view --repo d2learn/xlings --json tagName -q '.tagName')
17-
VERSION_NUM=${LATEST_VERSION#v}
18-
TARBALL="xlings-${VERSION_NUM}-linux-x86_64.tar.gz"
19-
gh release download "$LATEST_VERSION" --repo d2learn/xlings --pattern "$TARBALL" --dir /tmp
20-
mkdir -p "$HOME/.xlings"
21-
tar -xzf "/tmp/$TARBALL" -C "$HOME/.xlings" --strip-components=1
22-
"$HOME/.xlings/bin/xlings" self install
23-
env:
24-
GH_TOKEN: ${{ inputs.token }}
25-
26-
- name: Install xlings (macos)
27-
if: runner.os == 'macOS'
7+
- name: Install xlings (unix)
8+
if: runner.os != 'Windows'
289
shell: bash
2910
run: |
30-
LATEST_VERSION=$(gh release view --repo d2learn/xlings --json tagName -q '.tagName')
31-
VERSION_NUM=${LATEST_VERSION#v}
32-
ARCH=$(uname -m)
33-
TARBALL="xlings-${VERSION_NUM}-macosx-${ARCH}.tar.gz"
34-
gh release download "$LATEST_VERSION" --repo d2learn/xlings --pattern "$TARBALL" --dir /tmp
35-
mkdir -p "$HOME/.xlings"
36-
tar -xzf "/tmp/$TARBALL" -C "$HOME/.xlings" --strip-components=1
37-
xattr -dr com.apple.quarantine "$HOME/.xlings" 2>/dev/null || true
38-
"$HOME/.xlings/bin/xlings" self install
39-
env:
40-
GH_TOKEN: ${{ inputs.token }}
11+
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash
12+
echo "XLINGS_HOME=$HOME/.xlings" >> "$GITHUB_ENV"
13+
echo "$HOME/.xlings/subos/current/bin" >> "$GITHUB_PATH"
14+
echo "$HOME/.xlings/bin" >> "$GITHUB_PATH"
4115
4216
- name: Install xlings (windows)
4317
if: runner.os == 'Windows'
4418
shell: pwsh
45-
run: irm https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.ps1 | iex
19+
run: |
20+
irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.ps1 | iex
21+
"XLINGS_HOME=$env:USERPROFILE\.xlings" >> $env:GITHUB_ENV
22+
"$env:USERPROFILE\.xlings\subos\current\bin" >> $env:GITHUB_PATH
23+
"$env:USERPROFILE\.xlings\bin" >> $env:GITHUB_PATH
4624
47-
- name: Install dependencies (unix)
25+
- name: Install dependencies
4826
if: runner.os != 'Windows'
4927
shell: bash
50-
run: |
51-
export PATH="$HOME/.xlings/bin:$HOME/.xlings/subos/current/bin:$PATH"
52-
xlings install -y
28+
run: xlings install -y
5329

5430
- name: Install dependencies (windows)
5531
if: runner.os == 'Windows'
5632
shell: pwsh
57-
run: |
58-
$env:PATH = "$env:USERPROFILE\.xlings\bin;$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
59-
xlings install -y
33+
run: xlings install -y

.github/workflows/ci.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,34 +85,38 @@ jobs:
8585
steps:
8686
- uses: actions/checkout@v4
8787
- uses: ./.github/actions/setup-toolchain
88-
with:
89-
token: ${{ github.token }}
9088

9189
- name: Configure (linux)
9290
if: runner.os == 'Linux'
9391
working-directory: tests
9492
run: |
95-
# gcc 15 installed by xlings — put its bin dir first so xmake finds it
9693
GCC_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['gcc']['linux'])")
97-
export PATH="$HOME/.xlings/data/xpkgs/xim-x-gcc/${GCC_VERSION}/bin:$HOME/.xlings/bin:$HOME/.xlings/subos/current/bin:$PATH"
98-
echo "gcc version: $(gcc --version | head -1)"
99-
xmake f -P . -y -vv
94+
GCC_SDK="$HOME/.xlings/data/xpkgs/xim-x-gcc/${GCC_VERSION}"
95+
echo "Using gcc ${GCC_VERSION} from ${GCC_SDK}"
96+
"${GCC_SDK}/bin/gcc" --version | head -1
97+
xmake f -P . -y -vv \
98+
--sdk="${GCC_SDK}" \
99+
--cc="${GCC_SDK}/bin/gcc" \
100+
--cxx="${GCC_SDK}/bin/g++"
100101
101102
- name: Configure (macos)
102103
if: runner.os == 'macOS'
103104
working-directory: tests
104105
run: |
105106
LLVM_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['llvm']['macosx'])")
106-
export PATH="$HOME/.xlings/data/xpkgs/xim-x-llvm/${LLVM_VERSION}/bin:$HOME/.xlings/bin:$HOME/.xlings/subos/current/bin:$PATH"
107-
echo "clang version: $(clang --version | head -1)"
108-
xmake f -P . -y --toolchain=llvm -vv
107+
LLVM_SDK="$HOME/.xlings/data/xpkgs/xim-x-llvm/${LLVM_VERSION}"
108+
echo "Using llvm ${LLVM_VERSION} from ${LLVM_SDK}"
109+
"${LLVM_SDK}/bin/clang" --version | head -1
110+
xmake f -P . -y -vv \
111+
--toolchain=llvm \
112+
--sdk="${LLVM_SDK}" \
113+
--cc="${LLVM_SDK}/bin/clang" \
114+
--cxx="${LLVM_SDK}/bin/clang++"
109115
110116
- name: Configure (windows)
111117
if: runner.os == 'Windows'
112118
working-directory: tests
113-
run: |
114-
$env:PATH = "$env:USERPROFILE\.xlings\bin;$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
115-
xmake f -P . -y -vv
119+
run: xmake f -P . -y -vv
116120

117121
- name: Build and test (unix)
118122
if: runner.os != 'Windows'
@@ -121,26 +125,23 @@ jobs:
121125
BUILD_ALL: ${{ needs.detect-changes.outputs.build_all }}
122126
CHANGED_PACKAGES: ${{ needs.detect-changes.outputs.packages }}
123127
run: |
124-
# Set up PATH with correct compiler version
128+
# Put correct compiler on PATH for xmake build subprocesses
125129
if [ "$(uname)" = "Linux" ]; then
126130
GCC_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['gcc']['linux'])")
127-
export PATH="$HOME/.xlings/data/xpkgs/xim-x-gcc/${GCC_VERSION}/bin:$HOME/.xlings/bin:$HOME/.xlings/subos/current/bin:$PATH"
131+
export PATH="$HOME/.xlings/data/xpkgs/xim-x-gcc/${GCC_VERSION}/bin:$PATH"
128132
else
129133
LLVM_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['llvm']['macosx'])")
130-
export PATH="$HOME/.xlings/data/xpkgs/xim-x-llvm/${LLVM_VERSION}/bin:$HOME/.xlings/bin:$HOME/.xlings/subos/current/bin:$PATH"
134+
export PATH="$HOME/.xlings/data/xpkgs/xim-x-llvm/${LLVM_VERSION}/bin:$PATH"
131135
fi
132136
133137
# Collect test targets to build
134138
TARGETS=""
135139
if [ "$BUILD_ALL" = "true" ]; then
136-
# Find all test targets from test xmake.lua files
137140
TARGETS=$(grep -r 'target("' */*/xmake.lua 2>/dev/null | sed 's/.*target("\([^"]*\)").*/\1/' | sort -u)
138141
echo "Building ALL targets: $TARGETS"
139142
else
140-
# Build only changed packages
141143
for pkg in $(echo "$CHANGED_PACKAGES" | tr -d '[]"' | tr ',' ' '); do
142144
TARGET="${pkg}_test"
143-
# Verify the target exists
144145
if grep -rq "target(\"$TARGET\")" */*/xmake.lua 2>/dev/null; then
145146
TARGETS="$TARGETS $TARGET"
146147
else
@@ -176,8 +177,6 @@ jobs:
176177
BUILD_ALL: ${{ needs.detect-changes.outputs.build_all }}
177178
CHANGED_PACKAGES: ${{ needs.detect-changes.outputs.packages }}
178179
run: |
179-
$env:PATH = "$env:USERPROFILE\.xlings\bin;$env:USERPROFILE\.xlings\subos\current\bin;$env:PATH"
180-
181180
# Collect test targets
182181
$targets = @()
183182
if ($env:BUILD_ALL -eq "true") {

0 commit comments

Comments
 (0)