Skip to content

Commit fe1a7a3

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

1 file changed

Lines changed: 88 additions & 63 deletions

File tree

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

Lines changed: 88 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ permissions:
88

99
env:
1010
RISE_PYPI: https://gitlab.com/api/v4/projects/56254198/packages/pypi/simple
11+
PIP_BREAK_SYSTEM_PACKAGES: 1
1112

1213
jobs:
1314
build:
@@ -39,84 +40,116 @@ jobs:
3940
make -C build -j"$NPROC"
4041
shell: bash
4142

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

5056
cpp-tests:
51-
name: C++ Tests (linux-riscv64)
57+
name: C++ Tests
5258
runs-on: ubuntu-24.04-riscv
5359
needs: build
5460

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

61-
- name: Set up environment variables
74+
- name: Extract workspace
6275
run: |
63-
NPROC=$(nproc 2>/dev/null || echo 2)
64-
echo "NPROC=$NPROC" >> "$GITHUB_ENV"
76+
cd "$GITHUB_WORKSPACE"
77+
tar -xf linux-riscv64-workspace.tar
6578
shell: bash
6679

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

7390
- name: Run C++ Tests
7491
run: |
7592
cd "$GITHUB_WORKSPACE/build"
93+
NPROC=$(nproc 2>/dev/null || echo 2)
7694
make unittest -j"$NPROC"
7795
shell: bash
7896

7997
python-tests:
80-
name: Python Tests (linux-riscv64)
98+
name: Python Tests
8199
runs-on: ubuntu-24.04-riscv
82100
needs: build
83101

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

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

103-
- name: Download build artifacts
104-
uses: actions/download-artifact@v4
105-
with:
106-
name: linux-riscv64-build
107-
path: build
108-
109130
- name: Install dependencies
110131
run: |
132+
sudo apt-get update
133+
sudo apt-get install -y libgtest-dev liburing-dev
111134
$PYTHON -m pip install --upgrade pip
112135
$PYTHON -m pip install numpy==2.2.2 cmake==3.30.0 ninja==1.11.1.1 --index-url "$RISE_PYPI"
113136
$PYTHON -m pip install pybind11==3.0 pytest scikit-build-core setuptools_scm
114137
shell: bash
115138

116-
- name: Install from existing build directory
139+
- name: Reconfigure build directory
117140
run: |
118141
cd "$GITHUB_WORKSPACE"
142+
cmake -S . -B build \
143+
-G "Unix Makefiles" \
144+
-DCMAKE_BUILD_TYPE=Release \
145+
-DBUILD_TOOLS=ON \
146+
-DBUILD_PYTHON_BINDINGS=ON
147+
shell: bash
119148

149+
- name: Install from existing build directory
150+
run: |
151+
cd "$GITHUB_WORKSPACE"
152+
NPROC=$(nproc 2>/dev/null || echo 2)
120153
export SKBUILD_BUILD_DIR="$GITHUB_WORKSPACE/build"
121154
CMAKE_GENERATOR="Unix Makefiles" \
122155
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
@@ -132,32 +165,28 @@ jobs:
132165
shell: bash
133166

134167
cpp-examples:
135-
name: C++ Examples (linux-riscv64)
168+
name: C++ Examples
136169
runs-on: ubuntu-24.04-riscv
137170
needs: build
138171

139172
steps:
140-
- name: Checkout code
141-
uses: actions/checkout@v6
173+
- name: Download workspace artifacts
174+
uses: actions/download-artifact@v8
142175
with:
143-
submodules: recursive
176+
name: linux-riscv64-workspace
177+
path: ${{ github.workspace }}
144178

145-
- name: Set up environment variables
179+
- name: Extract workspace
146180
run: |
147-
NPROC=$(nproc 2>/dev/null || echo 2)
148-
echo "NPROC=$NPROC" >> "$GITHUB_ENV"
181+
cd "$GITHUB_WORKSPACE"
182+
tar -xf linux-riscv64-workspace.tar
149183
shell: bash
150184

151-
- name: Download build artifacts
152-
uses: actions/download-artifact@v4
153-
with:
154-
name: linux-riscv64-build
155-
path: build
156-
157185
- name: Run C++ Examples
158186
run: |
159187
cd "$GITHUB_WORKSPACE/examples/c++"
160-
mkdir build && cd build
188+
NPROC=$(nproc 2>/dev/null || echo 2)
189+
mkdir -p build && cd build
161190
cmake .. -DCMAKE_BUILD_TYPE=Release
162191
make -j "$NPROC"
163192
./db-example
@@ -166,32 +195,28 @@ jobs:
166195
shell: bash
167196

168197
c-examples:
169-
name: C Examples (linux-riscv64)
198+
name: C Examples
170199
runs-on: ubuntu-24.04-riscv
171200
needs: build
172201

173202
steps:
174-
- name: Checkout code
175-
uses: actions/checkout@v6
203+
- name: Download workspace artifacts
204+
uses: actions/download-artifact@v8
176205
with:
177-
submodules: recursive
206+
name: linux-riscv64-workspace
207+
path: ${{ github.workspace }}
178208

179-
- name: Set up environment variables
209+
- name: Extract workspace
180210
run: |
181-
NPROC=$(nproc 2>/dev/null || echo 2)
182-
echo "NPROC=$NPROC" >> "$GITHUB_ENV"
211+
cd "$GITHUB_WORKSPACE"
212+
tar -xf linux-riscv64-workspace.tar
183213
shell: bash
184214

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

0 commit comments

Comments
 (0)