|
| 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: |
10 | | - runs-on: ${{ matrix.os }} |
11 | | - strategy: |
12 | | - matrix: |
13 | | - os: [ubuntu-latest] |
| 16 | + ci_linux: |
| 17 | + name: Linux |
| 18 | + runs-on: ubuntu-latest |
| 19 | + timeout-minutes: 45 |
14 | 20 | env: |
15 | 21 | DO_DOCKER: 0 |
16 | 22 | steps: |
17 | | - - uses: actions/checkout@v2 |
18 | | - - uses: egor-tensin/setup-clang@v1 |
19 | | - - uses: actions-rs/toolchain@v1 |
| 23 | + - uses: actions/checkout@v5 |
| 24 | + |
| 25 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
20 | 26 | with: |
21 | | - profile: minimal |
22 | 27 | toolchain: stable |
23 | | - override: true |
24 | | - - uses: actions-rs/cargo@v1 |
25 | | - with: |
26 | | - command: test |
27 | | - - uses: actions/setup-python@v5 |
| 28 | + target: arm-unknown-linux-gnueabihf |
| 29 | + rustflags: "" |
| 30 | + |
| 31 | + - uses: actions/setup-python@v6 |
28 | 32 | with: |
29 | | - python-version: '3.12' |
30 | | - architecture: 'x64' |
| 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 | + |
31 | 40 | - name: Install ARM cross-compiler and C libraries |
32 | 41 | run: | |
33 | 42 | sudo apt-get update |
34 | 43 | 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 |
| 44 | +
|
| 45 | + - name: Cargo tests |
| 46 | + run: cargo test |
| 47 | + |
37 | 48 | - name: Cargo tests (RP and JEM) |
38 | 49 | run: | |
39 | 50 | cargo test --features rp |
40 | 51 | cargo test --features jem |
| 52 | +
|
41 | 53 | - name: Run tests (script.sh) |
42 | | - # Set environment variables for the cc crate |
43 | 54 | env: |
44 | 55 | CC_arm_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc |
45 | 56 | 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 |
| 57 | + run: bash ./ci/script.sh |
50 | 58 |
|
51 | 59 | ci_macos: |
52 | | - runs-on: ${{ matrix.os }} |
53 | | - strategy: |
54 | | - matrix: |
55 | | - os: [macos-latest] |
| 60 | + name: macOS |
| 61 | + runs-on: macos-latest |
| 62 | + timeout-minutes: 45 |
56 | 63 | env: |
57 | 64 | DO_DOCKER: 0 |
| 65 | + SKIP_RPI_TEST: 1 |
58 | 66 | steps: |
59 | | - - uses: actions/checkout@v2 |
60 | | - - run: brew install llvm |
61 | | - - uses: actions-rs/toolchain@v1 |
| 67 | + - uses: actions/checkout@v5 |
| 68 | + |
| 69 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
62 | 70 | with: |
63 | | - profile: minimal |
64 | 71 | toolchain: stable |
65 | | - override: true |
66 | | - - uses: actions-rs/cargo@v1 |
67 | | - with: |
68 | | - command: test |
69 | | - - uses: actions/setup-python@v5 |
| 72 | + rustflags: "" |
| 73 | + |
| 74 | + - uses: actions/setup-python@v6 |
70 | 75 | 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) |
| 76 | + python-version: "3.12" |
| 77 | + cache: "pip" |
| 78 | + cache-dependency-path: open-codegen/setup.py |
| 79 | + |
| 80 | + - name: Install LLVM |
| 81 | + run: brew install llvm |
| 82 | + |
| 83 | + - name: Cargo tests |
| 84 | + run: cargo test |
| 85 | + |
| 86 | + - name: Cargo tests (RP and JEM) |
75 | 87 | 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) |
| 88 | + cargo test --features rp |
| 89 | + cargo test --features jem |
| 90 | +
|
91 | 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 |
| 92 | + run: bash ./ci/script.sh |
0 commit comments