Skip to content

Commit

Permalink
Build in containers
Browse files Browse the repository at this point in the history
  • Loading branch information
mangelajo committed Oct 10, 2023
1 parent 88ae85d commit d1f4f85
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 2 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-firmware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build
on: [push, pull_request]
jobs:
bootloader-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: sudo apt-get install -y make podman
- name: Setup the builder image
run: |
cd firmware/bootloader
make .build-container
- name: Build the firmware
run: |
cd firmware/bootloader
make in-container
- name: Archive resulting bootloader
uses: actions/upload-artifact@v3
with:
name: jumpstarter-bootloader-dfu.bin
path: firmware/bootloader/dfu-bootloader.bin

application-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: sudo apt-get install -y make podman
- name: Setup the builder image
run: |
cd firmware/application
make .build-container
- name: Build the firmware
run: |
cd firmware/application
make in-container
- name: Archive resulting application
uses: actions/upload-artifact@v3
with:
name: jumpstarter-main.cab
path: firmware/application/jumpstarter*

41 changes: 41 additions & 0 deletions .github/workflows/publish-binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish
on:
push:
tags:
- '*'
jobs:
firmware-release:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: sudo apt-get install -y make podman
- name: Setup the builder image
run: |
cd firmware/bootloader
make .build-container
- name: Build the bootloader firmware
run: |
cd firmware/bootloader
make in-container
- name: Build the application firmware
run: |
cd firmware/application
make in-container
- name: Prepare all binaries in one directory
run: |
mkdir release
cp firmware/bootloader/*.bin release
cp firmware/application/*.bin release
cp firmware/application/*.cab release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release/*
asset_name: firmware
tag: ${{ github.ref }}
overwrite: true
body: "Automated release based on tag creation"
9 changes: 9 additions & 0 deletions firmware/application/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM registry.fedoraproject.org/fedora:38
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
RUN sh rustup.sh -y
RUN whoami
ENV PATH=/root/.cargo/bin:$PATH
RUN rustup target add thumbv7em-none-eabihf
RUN dnf install -y stlink openocd arm-none-eabi-binutils-cs \
gcab libappstream-glib rpm-build copr-cli dfu-util \
make git gcc
10 changes: 8 additions & 2 deletions firmware/application/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ flash-dfu: jumpstarter.bin
clean:
rm -rf target jumpstarter.hex jumpstarter.bin *.cab rpmbuild

firmware-builder:
.build-container:
podman build -f Containerfile -t firmware-builder
podman run -ti --rm -v $(CURDIR)/../../:/workdir -w /workdir/firmware/application firmware-builder bash
touch .build-container

firmware-builder: .build-container
podman run -ti --rm -v $(CURDIR)/../../:/workdir -w /workdir/firmware/application firmware-builder bash

in-container: .build-container
podman run -ti --rm -v $(CURDIR)/../../:/workdir -w /workdir/firmware/application firmware-builder make $(THIS)
1 change: 1 addition & 0 deletions firmware/application/firmware.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<ul>
<li>support for json config field, removed storage</li>
<li>alternate power control config</li>
<li>rescue power mode (power on into recovery)</li>
</ul>
</description>
</release>
Expand Down
9 changes: 9 additions & 0 deletions firmware/bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,14 @@ openocd: flash
clean:
rm -rf target dfu-bootloader.bin

.build-container:
podman build -f ../application/Containerfile -t firmware-builder
touch .build-container

firmware-builder: .build-container
podman run -ti --rm -v $(CURDIR)/../../:/workdir -w /workdir/firmware/bootloader firmware-builder bash

in-container: .build-container
podman run -ti --rm -v $(CURDIR)/../../:/workdir -w /workdir/firmware/bootloader firmware-builder make $(THIS)

.PHONY: clean all flash openocd

0 comments on commit d1f4f85

Please sign in to comment.