|
| 1 | +name: Continuous integration |
| 2 | + |
1 | 3 | on: |
2 | 4 | push: |
3 | | - branches: [ master ] |
| 5 | + branches: [master] |
4 | 6 | pull_request: |
5 | 7 |
|
6 | | -name: Continuous integration |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: true |
7 | 14 |
|
8 | 15 | jobs: |
9 | | - ci: |
| 16 | + rust_tests: |
| 17 | + name: Rust tests (${{ matrix.name }}) |
10 | 18 | runs-on: ${{ matrix.os }} |
| 19 | + timeout-minutes: 45 |
11 | 20 | strategy: |
| 21 | + fail-fast: false |
12 | 22 | matrix: |
13 | | - os: [ubuntu-latest] |
| 23 | + include: |
| 24 | + - name: Linux |
| 25 | + os: ubuntu-latest |
| 26 | + - name: macOS |
| 27 | + os: macos-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v5 |
| 30 | + |
| 31 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 32 | + with: |
| 33 | + toolchain: stable |
| 34 | + rustflags: "" |
| 35 | + |
| 36 | + - name: Cargo tests |
| 37 | + run: cargo test |
| 38 | + |
| 39 | + - name: Cargo tests (RP and JEM) |
| 40 | + run: | |
| 41 | + cargo test --features rp |
| 42 | + cargo test --features jem |
| 43 | +
|
| 44 | + python_tests: |
| 45 | + name: Python tests (${{ matrix.name }}) |
| 46 | + needs: rust_tests |
| 47 | + runs-on: ${{ matrix.os }} |
| 48 | + 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 |
14 | 59 | env: |
15 | 60 | DO_DOCKER: 0 |
| 61 | + SKIP_RPI_TEST: ${{ matrix.skip_rpi_test }} |
16 | 62 | steps: |
17 | | - - uses: actions/checkout@v2 |
18 | | - - uses: egor-tensin/setup-clang@v1 |
19 | | - - uses: actions-rs/toolchain@v1 |
| 63 | + - uses: actions/checkout@v5 |
| 64 | + |
| 65 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
20 | 66 | with: |
21 | | - profile: minimal |
22 | 67 | toolchain: stable |
23 | | - override: true |
24 | | - - uses: actions-rs/cargo@v1 |
25 | | - with: |
26 | | - command: test |
27 | | - - uses: actions/setup-python@v5 |
| 68 | + components: clippy |
| 69 | + rustflags: "" |
| 70 | + |
| 71 | + - uses: actions/setup-python@v6 |
28 | 72 | with: |
29 | | - python-version: '3.12' |
30 | | - architecture: 'x64' |
| 73 | + python-version: "3.12" |
| 74 | + cache: "pip" |
| 75 | + cache-dependency-path: open-codegen/setup.py |
| 76 | + |
| 77 | + - uses: egor-tensin/setup-clang@v1 |
| 78 | + if: runner.os == 'Linux' |
| 79 | + |
| 80 | + - name: Install Linux ARM target |
| 81 | + if: runner.os == 'Linux' |
| 82 | + run: rustup target add arm-unknown-linux-gnueabihf |
| 83 | + |
31 | 84 | - name: Install ARM cross-compiler and C libraries |
| 85 | + if: runner.os == 'Linux' |
32 | 86 | run: | |
33 | 87 | sudo apt-get update |
34 | 88 | sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross |
35 | | - # If icasadi_rosenbrock or other deps need C++: |
36 | | - # sudo apt-get install -y g++-arm-linux-gnueabihf |
37 | | - - name: Cargo tests (RP and JEM) |
38 | | - run: | |
39 | | - cargo test --features rp |
40 | | - cargo test --features jem |
41 | | - - name: Run tests (script.sh) |
42 | | - # Set environment variables for the cc crate |
| 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' |
43 | 96 | env: |
44 | 97 | CC_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc |
45 | 98 | AR_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-ar |
46 | | - # If C++ is involved and you installed g++-arm-linux-gnueabihf: |
47 | | - # CXX_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-g++ |
48 | | - run: | |
49 | | - bash ./ci/script.sh |
| 99 | + run: bash ./ci/script.sh python-tests |
50 | 100 |
|
51 | | - ci_macos: |
| 101 | + - name: Run Python tests and generated Clippy checks |
| 102 | + if: runner.os == 'macOS' |
| 103 | + run: bash ./ci/script.sh python-tests |
| 104 | + |
| 105 | + ocp_tests: |
| 106 | + name: OCP tests (${{ matrix.name }}) |
| 107 | + needs: python_tests |
52 | 108 | runs-on: ${{ matrix.os }} |
| 109 | + timeout-minutes: 45 |
53 | 110 | strategy: |
| 111 | + fail-fast: false |
54 | 112 | matrix: |
55 | | - os: [macos-latest] |
| 113 | + include: |
| 114 | + - name: Linux |
| 115 | + os: ubuntu-latest |
| 116 | + - name: macOS |
| 117 | + os: macos-latest |
56 | 118 | env: |
57 | 119 | DO_DOCKER: 0 |
58 | 120 | steps: |
59 | | - - uses: actions/checkout@v2 |
60 | | - - run: brew install llvm |
61 | | - - uses: actions-rs/toolchain@v1 |
| 121 | + - uses: actions/checkout@v5 |
| 122 | + |
| 123 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
62 | 124 | with: |
63 | | - profile: minimal |
64 | 125 | toolchain: stable |
65 | | - override: true |
66 | | - - uses: actions-rs/cargo@v1 |
67 | | - with: |
68 | | - command: test |
69 | | - - uses: actions/setup-python@v5 |
| 126 | + rustflags: "" |
| 127 | + |
| 128 | + - uses: actions/setup-python@v6 |
70 | 129 | with: |
71 | | - python-version: '3.12' |
72 | | - - run: cargo test --features rp |
73 | | - - run: cargo test --features jem |
74 | | - - name: Install ARM cross-compiler toolchain (via Homebrew) |
75 | | - run: | |
76 | | - # Tap the repository that provides the cross-compiler |
77 | | - brew tap messense/macos-cross-toolchains |
78 | | - # Update brew to ensure the tap is recognized (can sometimes be needed) |
79 | | - brew update |
80 | | - # Install the full toolchain (includes gcc, binutils, sysroot) |
81 | | - # This specific formula provides the entire toolchain. |
82 | | - brew install arm-unknown-linux-gnueabihf |
83 | | - |
84 | | - # The above `brew install` might have linking conflicts if other partial |
85 | | - # toolchains were somehow pre-installed or installed by other steps. |
86 | | - # If it fails with link errors, you might need: |
87 | | - # brew link --overwrite arm-unknown-linux-gnueabihf |
88 | | -
|
89 | | - # Verify the compiler is found |
90 | | - which arm-linux-gnueabihf-gcc || (echo "arm-linux-gnueabihf-gcc not found in PATH" && exit 1) |
91 | | - - name: Run tests (script.sh) |
92 | | - # Set environment variables for the cc crate and PyO3 (if needed) |
93 | | - env: |
94 | | - CC_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc |
95 | | - AR_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-ar |
96 | | - # If you are building PyO3 bindings and need to specify Python libs from the sysroot: |
97 | | - # PYO3_CROSS_LIB_DIR: "/opt/homebrew/opt/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot/usr/lib" # Adjust path and Python version |
98 | | - # PYO3_CROSS_INCLUDE_DIR: "/opt/homebrew/opt/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot/usr/include/python3.x" # Adjust path and Python version |
99 | | - run: | |
100 | | - bash ./ci/script.sh |
| 130 | + python-version: "3.12" |
| 131 | + cache: "pip" |
| 132 | + cache-dependency-path: open-codegen/setup.py |
| 133 | + |
| 134 | + - name: Run OCP Python tests |
| 135 | + run: bash ./ci/script.sh ocp-tests |
0 commit comments