Skip to content

Commit 62161ae

Browse files
committed
GA pipeline
1 parent 43da6af commit 62161ae

2 files changed

Lines changed: 64 additions & 53 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,26 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16-
ci_linux:
17-
name: Linux
18-
runs-on: ubuntu-latest
16+
rust_tests:
17+
name: Rust tests (${{ matrix.name }})
18+
runs-on: ${{ matrix.os }}
1919
timeout-minutes: 45
20-
env:
21-
DO_DOCKER: 0
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- name: Linux
25+
os: ubuntu-latest
26+
- name: macOS
27+
os: macos-latest
2228
steps:
2329
- uses: actions/checkout@v5
2430

2531
- uses: actions-rust-lang/setup-rust-toolchain@v1
2632
with:
2733
toolchain: stable
28-
target: arm-unknown-linux-gnueabihf
2934
rustflags: ""
3035

31-
- uses: actions/setup-python@v6
32-
with:
33-
python-version: "3.12"
34-
architecture: "x64"
35-
cache: "pip"
36-
cache-dependency-path: open-codegen/setup.py
37-
38-
- uses: egor-tensin/setup-clang@v1
39-
40-
- name: Install ARM cross-compiler and C libraries
41-
run: |
42-
sudo apt-get update
43-
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
44-
4536
- name: Cargo tests
4637
run: cargo test
4738

@@ -50,25 +41,31 @@ jobs:
5041
cargo test --features rp
5142
cargo test --features jem
5243
53-
- name: Run tests (script.sh)
54-
env:
55-
CC_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc
56-
AR_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-ar
57-
run: bash ./ci/script.sh
58-
59-
ci_macos:
60-
name: macOS
61-
runs-on: macos-latest
44+
python_tests:
45+
name: Python tests (${{ matrix.name }})
46+
needs: rust_tests
47+
runs-on: ${{ matrix.os }}
6248
timeout-minutes: 45
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
include:
53+
- name: Linux
54+
os: ubuntu-latest
55+
skip_rpi_test: 0
56+
- name: macOS
57+
os: macos-latest
58+
skip_rpi_test: 1
6359
env:
6460
DO_DOCKER: 0
65-
SKIP_RPI_TEST: 1
61+
SKIP_RPI_TEST: ${{ matrix.skip_rpi_test }}
6662
steps:
6763
- uses: actions/checkout@v5
6864

6965
- uses: actions-rust-lang/setup-rust-toolchain@v1
7066
with:
7167
toolchain: stable
68+
components: clippy
7269
rustflags: ""
7370

7471
- uses: actions/setup-python@v6
@@ -77,16 +74,30 @@ jobs:
7774
cache: "pip"
7875
cache-dependency-path: open-codegen/setup.py
7976

80-
- name: Install LLVM
81-
run: brew install llvm
77+
- uses: egor-tensin/setup-clang@v1
78+
if: runner.os == 'Linux'
8279

83-
- name: Cargo tests
84-
run: cargo test
80+
- name: Install Linux ARM target
81+
if: runner.os == 'Linux'
82+
run: rustup target add arm-unknown-linux-gnueabihf
8583

86-
- name: Cargo tests (RP and JEM)
84+
- name: Install ARM cross-compiler and C libraries
85+
if: runner.os == 'Linux'
8786
run: |
88-
cargo test --features rp
89-
cargo test --features jem
87+
sudo apt-get update
88+
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
89+
90+
- name: Install LLVM
91+
if: runner.os == 'macOS'
92+
run: brew install llvm
93+
94+
- name: Run Python tests and generated Clippy checks
95+
if: runner.os == 'Linux'
96+
env:
97+
CC_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc
98+
AR_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-ar
99+
run: bash ./ci/script.sh
90100

91-
- name: Run tests (script.sh)
101+
- name: Run Python tests and generated Clippy checks
102+
if: runner.os == 'macOS'
92103
run: bash ./ci/script.sh

ci/script.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,21 @@ function run_clippy_test() {
2323
popd
2424
}
2525

26-
regular_test() {
26+
generated_clippy_tests() {
27+
cd .python_test_build
28+
run_clippy_test "only_f1"
29+
run_clippy_test "only_f2"
30+
run_clippy_test "halfspace_optimizer"
31+
run_clippy_test "parametric_f2"
32+
run_clippy_test "plain"
33+
run_clippy_test "python_bindings"
34+
run_clippy_test "rosenbrock_ros"
35+
}
36+
37+
python_tests() {
2738
# Run Python tests
2839
# ------------------------------------
2940

30-
# --- create virtual environment
3141
cd open-codegen
3242
export PYTHONPATH=.
3343

@@ -52,19 +62,9 @@ regular_test() {
5262
python -W ignore test/test_raspberry_pi.py -v
5363
fi
5464

55-
5665
# Run Clippy for generated optimizers
5766
# ------------------------------------
58-
59-
cd .python_test_build
60-
run_clippy_test "only_f1"
61-
run_clippy_test "only_f2"
62-
run_clippy_test "halfspace_optimizer"
63-
run_clippy_test "parametric_f2"
64-
run_clippy_test "plain"
65-
run_clippy_test "python_bindings"
66-
run_clippy_test "rosenbrock_ros"
67-
67+
generated_clippy_tests
6868
}
6969

7070
test_docker() {
@@ -74,8 +74,8 @@ test_docker() {
7474

7575
main() {
7676
if [ $DO_DOCKER -eq 0 ]; then
77-
echo "Running regular tests"
78-
regular_test
77+
echo "Running Python and generated Clippy tests"
78+
python_tests
7979
else
8080
echo "Building Docker image"
8181
test_docker

0 commit comments

Comments
 (0)