Skip to content

Commit b066a04

Browse files
fix ci build fail use pinned python versions
fix ci build fail use pinned python versions use rust build caches
1 parent 1d8e4d3 commit b066a04

File tree

1 file changed

+47
-11
lines changed

1 file changed

+47
-11
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,37 @@ jobs:
5454
os:
5555
- ubuntu-latest
5656
- macos-latest
57+
python:
58+
- 3.11
59+
- 3.12
60+
- 3.13
5761
steps:
5862
- uses: actions/checkout@v4
63+
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: ${{ matrix.python }}
68+
5969
- name: Install protoc
6070
run: |
61-
if [ "$RUNNER_OS" == "Linux" ]; then
71+
if [ "$RUNNER_OS" = "Linux" ]; then
6272
sudo apt-get update && sudo apt-get install -y protobuf-compiler
63-
elif [ "$RUNNER_OS" == "macOS" ]; then
73+
else
6474
brew install protobuf
6575
fi
76+
77+
- name: Rust Cache
78+
uses: actions/cache@v4
79+
with:
80+
path: |
81+
~/.cargo/registry
82+
~/.cargo/git
83+
target
84+
key: build-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/Cargo.lock') }}
85+
6686
- name: Build
67-
run: cargo build
87+
run: cargo build --workspace --all-targets
6888

6989
test:
7090
runs-on: ${{ matrix.os }}
@@ -73,26 +93,42 @@ jobs:
7393
os:
7494
- ubuntu-latest
7595
- macos-latest
96+
python: ["3.11", "3.12", "3.13"]
7697
steps:
7798
- uses: actions/checkout@v4
99+
100+
- name: Set up Python
101+
uses: actions/setup-python@v5
102+
with:
103+
python-version: ${{ matrix.python }}
104+
78105
- name: Install protoc
79106
run: |
80-
if [ "$RUNNER_OS" == "Linux" ]; then
107+
if [ "$RUNNER_OS" = "Linux" ]; then
81108
sudo apt-get update && sudo apt-get install -y protobuf-compiler
82-
elif [ "$RUNNER_OS" == "macOS" ]; then
109+
else
83110
brew install protobuf
84111
fi
112+
113+
- name: Rust Cache
114+
uses: actions/cache@v4
115+
with:
116+
path: |
117+
~/.cargo/registry
118+
~/.cargo/git
119+
target
120+
key: test-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/Cargo.lock') }}
121+
85122
- name: Unit Test
86123
run: cargo test --all-targets --workspace
87124
env:
88125
RUST_LOG: DEBUG
89126
RUST_BACKTRACE: full
90-
- name: Integration Test
91-
# only run IT in linux since no docker in macos by default
127+
128+
- name: Integration Test (Linux only)
129+
if: runner.os == 'Linux'
92130
run: |
93-
if [ "$RUNNER_OS" == "Linux" ]; then
94-
RUST_TEST_THREADS=1 cargo test --features integration_tests --all-targets --workspace -- --nocapture
95-
fi
131+
RUST_TEST_THREADS=1 cargo test --features integration_tests --all-targets --workspace -- --nocapture
96132
env:
97133
RUST_LOG: DEBUG
98-
RUST_BACKTRACE: full
134+
RUST_BACKTRACE: full

0 commit comments

Comments
 (0)