Skip to content

Commit a0dbfc8

Browse files
committed
ci: use python 3.12 for RISC-V64
Signed-off-by: ihb2032 <hebome@foxmail.com>
1 parent 8fe0900 commit a0dbfc8

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

.github/workflows/03-macos-linux-build.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ permissions:
2121
contents: read
2222

2323
jobs:
24-
# Build and test matrix (parallel execution)
2524
build-and-test:
2625
name: Build & Test (${{ inputs.platform }})
2726
runs-on: ${{ inputs.os }}
@@ -32,7 +31,7 @@ jobs:
3231
include:
3332
- os: ${{ inputs.os }}
3433
platform: ${{ inputs.platform }}
35-
arch_flag: "" # Use appropriate architecture
34+
arch_flag: ""
3635

3736
steps:
3837
- name: Checkout code
@@ -41,12 +40,27 @@ jobs:
4140
submodules: recursive
4241

4342
- name: Set up Python
43+
if: ${{ !contains(inputs.os, 'riscv') }}
4444
uses: actions/setup-python@v6
4545
with:
4646
python-version: '3.10'
4747
cache: 'pip'
4848
cache-dependency-path: 'pyproject.toml'
4949

50+
- name: Select Python on RISC-V
51+
if: ${{ contains(inputs.os, 'riscv') }}
52+
run: |
53+
python3.10 --version
54+
echo "PYTHON=python3.10" >> $GITHUB_ENV
55+
shell: bash
56+
57+
- name: Select Python on non-RISC-V
58+
if: ${{ !contains(inputs.os, 'riscv') }}
59+
run: |
60+
python --version
61+
echo "PYTHON=python" >> $GITHUB_ENV
62+
shell: bash
63+
5064
- name: Install Clang
5165
if: inputs.compiler == 'clang' && runner.os == 'Linux'
5266
run: |
@@ -61,7 +75,6 @@ jobs:
6175

6276
- name: Set up environment variables
6377
run: |
64-
# Set number of processors for parallel builds
6578
if [[ "${{ matrix.platform }}" == "macos-arm64" ]]; then
6679
NPROC=$(sysctl -n hw.ncpu 2>/dev/null || echo 2)
6780
else
@@ -70,19 +83,17 @@ jobs:
7083
echo "NPROC=$NPROC" >> $GITHUB_ENV
7184
echo "Using $NPROC parallel jobs for builds"
7285
73-
# Set compiler when clang is requested
7486
if [[ "${{ inputs.compiler }}" == "clang" ]]; then
7587
echo "CC=clang" >> $GITHUB_ENV
7688
echo "CXX=clang++" >> $GITHUB_ENV
7789
fi
7890
79-
# Add Python user base bin to PATH for pip-installed CLI tools
80-
echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
91+
echo "$($PYTHON -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
8192
shell: bash
8293

8394
- name: Install dependencies
8495
run: |
85-
python -m pip install --upgrade pip \
96+
$PYTHON -m pip install --upgrade pip \
8697
pybind11==3.0 \
8798
cmake==3.30.0 \
8899
ninja==1.11.1 \
@@ -97,7 +108,7 @@ jobs:
97108
98109
CMAKE_GENERATOR="Unix Makefiles" \
99110
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
100-
python -m pip install -v . \
111+
$PYTHON -m pip install -v . \
101112
--no-build-isolation \
102113
--config-settings='cmake.define.BUILD_TOOLS="ON"' \
103114
${{ matrix.arch_flag }}
@@ -112,7 +123,7 @@ jobs:
112123
- name: Run Python Tests
113124
run: |
114125
cd "$GITHUB_WORKSPACE"
115-
python -m pytest python/tests/
126+
$PYTHON -m pytest python/tests/
116127
shell: bash
117128

118129
- name: Run C++ Examples

0 commit comments

Comments
 (0)