Skip to content

Commit 6cb3676

Browse files
committed
ci: fix
Signed-off-by: ihb2032 <hebome@foxmail.com>
1 parent 2079ced commit 6cb3676

1 file changed

Lines changed: 87 additions & 63 deletions

File tree

.github/workflows/07-linux-riscv-build.yml

Lines changed: 87 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -39,84 +39,116 @@ jobs:
3939
make -C build -j"$NPROC"
4040
shell: bash
4141

42-
- name: Upload build artifacts
43-
uses: actions/upload-artifact@v4
42+
- name: Archive entire workspace
43+
run: |
44+
cd "$GITHUB_WORKSPACE"
45+
tar -cf linux-riscv64-workspace.tar .
46+
shell: bash
47+
48+
- name: Upload workspace artifacts
49+
uses: actions/upload-artifact@v7
4450
with:
45-
name: linux-riscv64-build
46-
path: build
51+
name: linux-riscv64-workspace
52+
path: ${{ github.workspace }}/linux-riscv64-workspace.tar
4753
if-no-files-found: error
48-
compression-level: 0
4954

5055
cpp-tests:
51-
name: C++ Tests (linux-riscv64)
56+
name: C++ Tests
5257
runs-on: ubuntu-24.04-riscv
5358
needs: build
5459

5560
steps:
56-
- name: Checkout code
57-
uses: actions/checkout@v6
61+
- name: Install test dependencies
62+
run: |
63+
sudo apt-get update
64+
sudo apt-get install -y python3-pybind11 pybind11-dev libgtest-dev liburing-dev
65+
shell: bash
66+
67+
- name: Download workspace artifacts
68+
uses: actions/download-artifact@v8
5869
with:
59-
submodules: recursive
70+
name: linux-riscv64-workspace
71+
path: ${{ github.workspace }}
6072

61-
- name: Set up environment variables
73+
- name: Extract workspace
6274
run: |
63-
NPROC=$(nproc 2>/dev/null || echo 2)
64-
echo "NPROC=$NPROC" >> "$GITHUB_ENV"
75+
cd "$GITHUB_WORKSPACE"
76+
tar -xf linux-riscv64-workspace.tar
6577
shell: bash
6678

67-
- name: Download build artifacts
68-
uses: actions/download-artifact@v4
69-
with:
70-
name: linux-riscv64-build
71-
path: build
79+
- name: Reconfigure build directory
80+
run: |
81+
cd "$GITHUB_WORKSPACE"
82+
cmake -S . -B build \
83+
-G "Unix Makefiles" \
84+
-DCMAKE_BUILD_TYPE=Release \
85+
-DBUILD_TOOLS=ON \
86+
-DBUILD_PYTHON_BINDINGS=ON
87+
shell: bash
7288

7389
- name: Run C++ Tests
7490
run: |
7591
cd "$GITHUB_WORKSPACE/build"
92+
NPROC=$(nproc 2>/dev/null || echo 2)
7693
make unittest -j"$NPROC"
7794
shell: bash
7895

7996
python-tests:
80-
name: Python Tests (linux-riscv64)
97+
name: Python Tests
8198
runs-on: ubuntu-24.04-riscv
8299
needs: build
83100

84101
steps:
85-
- name: Checkout code
86-
uses: actions/checkout@v6
87-
with:
88-
submodules: recursive
89-
90102
- name: Select Python
91103
run: |
92-
python3.10 --version
93-
echo "PYTHON=python3.10" >> "$GITHUB_ENV"
104+
if command -v python3 >/dev/null 2>&1; then
105+
PYTHON_BIN=python3
106+
elif command -v python >/dev/null 2>&1; then
107+
PYTHON_BIN=python
108+
else
109+
echo "No local Python interpreter found on PATH"
110+
exit 1
111+
fi
112+
"$PYTHON_BIN" --version
113+
echo "PYTHON=$PYTHON_BIN" >> "$GITHUB_ENV"
94114
shell: bash
95115

96-
- name: Set up environment variables
116+
- name: Download workspace artifacts
117+
uses: actions/download-artifact@v8
118+
with:
119+
name: linux-riscv64-workspace
120+
path: ${{ github.workspace }}
121+
122+
- name: Extract workspace
97123
run: |
98-
NPROC=$(nproc 2>/dev/null || echo 2)
99-
echo "NPROC=$NPROC" >> "$GITHUB_ENV"
124+
cd "$GITHUB_WORKSPACE"
125+
tar -xf linux-riscv64-workspace.tar
100126
echo "$($PYTHON -c 'import site; print(site.USER_BASE)')/bin" >> "$GITHUB_PATH"
101127
shell: bash
102128

103-
- name: Download build artifacts
104-
uses: actions/download-artifact@v4
105-
with:
106-
name: linux-riscv64-build
107-
path: build
108-
109129
- name: Install dependencies
110130
run: |
131+
sudo apt-get update
132+
sudo apt-get install -y libgtest-dev liburing-dev
111133
$PYTHON -m pip install --upgrade pip
112134
$PYTHON -m pip install numpy==2.2.2 cmake==3.30.0 ninja==1.11.1.1 --index-url "$RISE_PYPI"
113135
$PYTHON -m pip install pybind11==3.0 pytest scikit-build-core setuptools_scm
114136
shell: bash
115137

116-
- name: Install from existing build directory
138+
- name: Reconfigure build directory
117139
run: |
118140
cd "$GITHUB_WORKSPACE"
141+
cmake -S . -B build \
142+
-G "Unix Makefiles" \
143+
-DCMAKE_BUILD_TYPE=Release \
144+
-DBUILD_TOOLS=ON \
145+
-DBUILD_PYTHON_BINDINGS=ON
146+
shell: bash
119147

148+
- name: Install from existing build directory
149+
run: |
150+
cd "$GITHUB_WORKSPACE"
151+
NPROC=$(nproc 2>/dev/null || echo 2)
120152
export SKBUILD_BUILD_DIR="$GITHUB_WORKSPACE/build"
121153
CMAKE_GENERATOR="Unix Makefiles" \
122154
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
@@ -132,32 +164,28 @@ jobs:
132164
shell: bash
133165

134166
cpp-examples:
135-
name: C++ Examples (linux-riscv64)
167+
name: C++ Examples
136168
runs-on: ubuntu-24.04-riscv
137169
needs: build
138170

139171
steps:
140-
- name: Checkout code
141-
uses: actions/checkout@v6
172+
- name: Download workspace artifacts
173+
uses: actions/download-artifact@v8
142174
with:
143-
submodules: recursive
175+
name: linux-riscv64-workspace
176+
path: ${{ github.workspace }}
144177

145-
- name: Set up environment variables
178+
- name: Extract workspace
146179
run: |
147-
NPROC=$(nproc 2>/dev/null || echo 2)
148-
echo "NPROC=$NPROC" >> "$GITHUB_ENV"
180+
cd "$GITHUB_WORKSPACE"
181+
tar -xf linux-riscv64-workspace.tar
149182
shell: bash
150183

151-
- name: Download build artifacts
152-
uses: actions/download-artifact@v4
153-
with:
154-
name: linux-riscv64-build
155-
path: build
156-
157184
- name: Run C++ Examples
158185
run: |
159186
cd "$GITHUB_WORKSPACE/examples/c++"
160-
mkdir build && cd build
187+
NPROC=$(nproc 2>/dev/null || echo 2)
188+
mkdir -p build && cd build
161189
cmake .. -DCMAKE_BUILD_TYPE=Release
162190
make -j "$NPROC"
163191
./db-example
@@ -166,32 +194,28 @@ jobs:
166194
shell: bash
167195

168196
c-examples:
169-
name: C Examples (linux-riscv64)
197+
name: C Examples
170198
runs-on: ubuntu-24.04-riscv
171199
needs: build
172200

173201
steps:
174-
- name: Checkout code
175-
uses: actions/checkout@v6
202+
- name: Download workspace artifacts
203+
uses: actions/download-artifact@v8
176204
with:
177-
submodules: recursive
205+
name: linux-riscv64-workspace
206+
path: ${{ github.workspace }}
178207

179-
- name: Set up environment variables
208+
- name: Extract workspace
180209
run: |
181-
NPROC=$(nproc 2>/dev/null || echo 2)
182-
echo "NPROC=$NPROC" >> "$GITHUB_ENV"
210+
cd "$GITHUB_WORKSPACE"
211+
tar -xf linux-riscv64-workspace.tar
183212
shell: bash
184213

185-
- name: Download build artifacts
186-
uses: actions/download-artifact@v4
187-
with:
188-
name: linux-riscv64-build
189-
path: build
190-
191214
- name: Run C Examples
192215
run: |
193216
cd "$GITHUB_WORKSPACE/examples/c"
194-
mkdir build && cd build
217+
NPROC=$(nproc 2>/dev/null || echo 2)
218+
mkdir -p build && cd build
195219
cmake .. -DCMAKE_BUILD_TYPE=Release
196220
make -j "$NPROC"
197221
./c_api_basic_example

0 commit comments

Comments
 (0)