@@ -54,17 +54,34 @@ jobs:
5454 os :
5555 - ubuntu-latest
5656 - macos-latest
57+ python : ["3.11", "3.12", "3.13"]
5758 steps :
5859 - uses : actions/checkout@v4
60+
61+ - name : Set up Python
62+ uses : actions/setup-python@v5
63+ with :
64+ python-version : ${{ matrix.python }}
65+
5966 - name : Install protoc
6067 run : |
61- if [ "$RUNNER_OS" == "Linux" ]; then
68+ if [ "$RUNNER_OS" = "Linux" ]; then
6269 sudo apt-get update && sudo apt-get install -y protobuf-compiler
63- elif [ "$RUNNER_OS" == "macOS" ]; then
70+ elif [ "$RUNNER_OS" = "macOS" ]; then
6471 brew install protobuf
6572 fi
73+
74+ - name : Rust Cache
75+ uses : actions/cache@v4
76+ with :
77+ path : |
78+ ~/.cargo/registry
79+ ~/.cargo/git
80+ target
81+ key : build-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/Cargo.lock') }}
82+
6683 - name : Build
67- run : cargo build
84+ run : cargo build --workspace --all-targets
6885
6986 test :
7087 runs-on : ${{ matrix.os }}
@@ -73,26 +90,42 @@ jobs:
7390 os :
7491 - ubuntu-latest
7592 - macos-latest
93+ python : ["3.11", "3.12", "3.13"]
7694 steps :
7795 - uses : actions/checkout@v4
96+
97+ - name : Set up Python
98+ uses : actions/setup-python@v5
99+ with :
100+ python-version : ${{ matrix.python }}
101+
78102 - name : Install protoc
79103 run : |
80- if [ "$RUNNER_OS" == "Linux" ]; then
104+ if [ "$RUNNER_OS" = "Linux" ]; then
81105 sudo apt-get update && sudo apt-get install -y protobuf-compiler
82- elif [ "$RUNNER_OS" == "macOS" ]; then
106+ elif [ "$RUNNER_OS" = "macOS" ]; then
83107 brew install protobuf
84108 fi
109+
110+ - name : Rust Cache
111+ uses : actions/cache@v4
112+ with :
113+ path : |
114+ ~/.cargo/registry
115+ ~/.cargo/git
116+ target
117+ key : test-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/Cargo.lock') }}
118+
85119 - name : Unit Test
86120 run : cargo test --all-targets --workspace
87121 env :
88122 RUST_LOG : DEBUG
89123 RUST_BACKTRACE : full
90- - name : Integration Test
91- # only run IT in linux since no docker in macos by default
124+
125+ - name : Integration Test (Linux only)
126+ if : runner.os == 'Linux'
92127 run : |
93- if [ "$RUNNER_OS" == "Linux" ]; then
94- RUST_TEST_THREADS=1 cargo test --features integration_tests --all-targets --workspace -- --nocapture
95- fi
128+ RUST_TEST_THREADS=1 cargo test --features integration_tests --all-targets --workspace -- --nocapture
96129 env :
97130 RUST_LOG : DEBUG
98- RUST_BACKTRACE : full
131+ RUST_BACKTRACE : full
0 commit comments