Skip to content

Commit 6cd04db

Browse files
authored
Merge pull request #1 from purduehackers/kk/ci
ci: use GitHub Actions to build binaries
2 parents 1eb1e87 + b3e45aa commit 6cd04db

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build Pi software
2+
3+
on:
4+
push: {}
5+
pull_request: {}
6+
workflow_dispatch: {}
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out sources
14+
uses: actions/checkout@v6
15+
with:
16+
sparse-checkout: |
17+
Software
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Build binary
23+
run: ./build-rpi.sh
24+
working-directory: Software
25+
26+
- name: Upload binary
27+
uses: actions/upload-artifact@v6
28+
with:
29+
name: phone-bell-software-arm64
30+
path: Software/phone-bell-software-arm64
31+
if-no-files-found: error
32+
compression-level: 0

Software/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,12 @@ COPY . .
3131

3232
# Build for Raspberry Pi (no-default-features to skip druid/GUI)
3333
RUN cargo build --release --target aarch64-unknown-linux-gnu --no-default-features --features real
34+
RUN aarch64-linux-gnu-strip /app/target/aarch64-unknown-linux-gnu/release/phone-bell-software
3435

3536
# The binary will be at /app/target/aarch64-unknown-linux-gnu/release/phone-bell-software
37+
38+
FROM scratch
39+
COPY --from=builder /app/target/aarch64-unknown-linux-gnu/release/phone-bell-software /phone-bell-software-arm64
40+
ENTRYPOINT ["/phone-bell-software-arm64"]
41+
42+
# The binary will be at /phone-bell-software-arm64 in the output image

Software/build-rpi.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ set -e
44
cd "$(dirname "$0")"
55

66
echo "Building Docker image..."
7-
docker build -t phone-bell-builder .
8-
9-
echo "Extracting binary..."
10-
docker create --name phone-bell-temp phone-bell-builder
11-
docker cp phone-bell-temp:/app/target/aarch64-unknown-linux-gnu/release/phone-bell-software ./phone-bell-software-arm64
12-
docker rm phone-bell-temp
13-
14-
echo "Stripping debug symbols..."
15-
docker run --rm -v "$(pwd):/out" phone-bell-builder \
16-
aarch64-linux-gnu-strip -o /out/phone-bell-software-arm64 /out/phone-bell-software-arm64
17-
7+
docker build -o . .
188
echo "Done! Binary: phone-bell-software-arm64"
199
ls -lh phone-bell-software-arm64

0 commit comments

Comments
 (0)