Skip to content

Commit 105f059

Browse files
.github: workflows: add 3 runners
1. checkout crates.io runner 2. checkout default branch 3. checkout branch this runner is being deployed for
1 parent 390c092 commit 105f059

1 file changed

Lines changed: 63 additions & 19 deletions

File tree

.github/workflows/tock-build.yml

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,84 @@
11
# .github/workflows/build-tock.yml
2-
name: Build Tock OS
2+
name: Build Tock OS (Abacus Variants)
33

44
on:
55
push:
6-
branches:
7-
- main
8-
workflow_dispatch: # allows manual trigger
6+
branches: ["**"]
7+
pull_request:
8+
workflow_dispatch:
99

1010
jobs:
1111
build-tock:
12+
name: nrf52 (abacus = ${{ matrix.source }})
1213
runs-on: ubuntu-latest
1314

15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
source:
19+
- main
20+
- ci-branch
21+
# - crates-io # enable once crate is published
22+
1423
steps:
15-
- name: Checkout this workflow repo
16-
uses: actions/checkout@v3
24+
- name: Checkout workflow repo
25+
uses: actions/checkout@v4
1726

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
2432
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
2737
28-
- name: Clone Tock repository
38+
- name: Clone Tock fork
2939
run: |
3040
git clone https://github.com/abacus-rs/tock.git
3141
cd tock
3242
git checkout master
43+
git submodule update --init --recursive
3344
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
3582
run: |
3683
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
4084
make -C boards/nordic/nrf52840dk

0 commit comments

Comments
 (0)