|
1 | 1 | # .github/workflows/build-tock.yml |
2 | | -name: Build Tock OS |
| 2 | +name: Build Tock OS (Abacus Variants) |
3 | 3 |
|
4 | 4 | on: |
5 | 5 | push: |
6 | | - branches: |
7 | | - - main |
8 | | - workflow_dispatch: # allows manual trigger |
| 6 | + branches: ["**"] |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
9 | 9 |
|
10 | 10 | jobs: |
11 | 11 | build-tock: |
| 12 | + name: nrf52 (abacus = ${{ matrix.source }}) |
12 | 13 | runs-on: ubuntu-latest |
13 | 14 |
|
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + source: |
| 19 | + - main |
| 20 | + - ci-branch |
| 21 | + # - crates-io # enable once crate is published |
| 22 | + |
14 | 23 | steps: |
15 | | - - name: Checkout this workflow repo |
16 | | - uses: actions/checkout@v3 |
| 24 | + - name: Checkout workflow repo |
| 25 | + uses: actions/checkout@v4 |
17 | 26 |
|
18 | | - - name: Install Rust toolchain |
19 | | - uses: actions-rs/toolchain@v1 |
20 | | - with: |
21 | | - toolchain: stable |
22 | | - profile: minimal |
23 | | - override: true |
| 27 | + - name: Install Rust + ARM target |
| 28 | + run: | |
| 29 | + rustup toolchain install stable |
| 30 | + rustup default stable |
| 31 | + rustup target add thumbv7em-none-eabihf |
24 | 32 |
|
25 | | - - name: Install LLVM (required for some boards) |
26 | | - run: sudo apt-get update && sudo apt-get install -y llvm clang |
| 33 | + - name: Install system dependencies |
| 34 | + run: | |
| 35 | + sudo apt-get update |
| 36 | + sudo apt-get install -y llvm clang make |
27 | 37 |
|
28 | | - - name: Clone Tock repository |
| 38 | + - name: Clone Tock fork |
29 | 39 | run: | |
30 | 40 | git clone https://github.com/abacus-rs/tock.git |
31 | 41 | cd tock |
32 | 42 | git checkout master |
| 43 | + git submodule update --init --recursive |
33 | 44 |
|
34 | | - - name: Build Tock for boards |
| 45 | + # ------------------------------------ |
| 46 | + # GLOBAL PATCH: abacus -> main |
| 47 | + # Applies to entire workspace |
| 48 | + # ------------------------------------ |
| 49 | + - name: Override abacus_registers -> main (workspace-wide) |
| 50 | + if: matrix.source == 'main' |
| 51 | + run: | |
| 52 | + cd tock |
| 53 | + printf '\n[patch."https://github.com/abacus-rs/abacus-registers"]\n' >> Cargo.toml |
| 54 | + printf 'abacus_registers = { git = "https://github.com/abacus-rs/abacus-registers", branch = "main" }\n' >> Cargo.toml |
| 55 | +
|
| 56 | + # ------------------------------------ |
| 57 | + # GLOBAL PATCH: abacus -> CI branch |
| 58 | + # Uses branch that triggered CI |
| 59 | + # ------------------------------------ |
| 60 | + - name: Override abacus_registers -> CI branch (workspace-wide) |
| 61 | + if: matrix.source == 'ci-branch' |
| 62 | + run: | |
| 63 | + echo "CI branch detected: ${GITHUB_REF_NAME}" |
| 64 | + cd tock |
| 65 | + printf '\n[patch."https://github.com/abacus-rs/abacus-registers"]\n' >> Cargo.toml |
| 66 | + printf 'abacus_registers = { git = "https://github.com/abacus-rs/abacus-registers", branch = "%s" }\n' "${GITHUB_REF_NAME}" >> Cargo.toml |
| 67 | +
|
| 68 | + # (Future) when crate is published |
| 69 | + # - name: Override abacus_registers -> crates.io |
| 70 | + # if: matrix.source == 'crates-io' |
| 71 | + # run: | |
| 72 | + # cd tock |
| 73 | + # printf '\n[patch.crates-io]\n' >> Cargo.toml |
| 74 | + # printf 'abacus_registers = { version = "*" }\n' >> Cargo.toml |
| 75 | + |
| 76 | + - name: Verify resolved abacus source |
| 77 | + run: | |
| 78 | + cd tock |
| 79 | + cargo tree -i abacus_registers || true |
| 80 | +
|
| 81 | + - name: Build nrf52840dk |
35 | 82 | run: | |
36 | 83 | cd tock |
37 | | - # Build the kernel (Rust) for the default board (e.g., hail) |
38 | | - # Add targets if needed: rustup target add thumbv7em-none-eabihf |
39 | | - rustup target add thumbv7em-none-eabihf |
40 | 84 | make -C boards/nordic/nrf52840dk |
0 commit comments