Browse Source

add firmware workflow for gh actions

Thomas Buck 2 weeks ago
parent
commit
1e0c69663e
3 changed files with 80 additions and 0 deletions
  1. 78
    0
      .github/workflows/cmake.yml
  2. 1
    0
      README.md
  3. 1
    0
      docs/src/introduction.md

+ 78
- 0
.github/workflows/cmake.yml View File

@@ -0,0 +1,78 @@
1
+# https://github.com/raspberrypi/pico-examples/blob/master/.github/workflows/cmake.yml
2
+
3
+name: Firmware
4
+
5
+# build for each push and pull request
6
+on: [push, pull_request]
7
+
8
+env:
9
+  BUILD_TYPE: Release
10
+
11
+jobs:
12
+  build:
13
+    runs-on: ubuntu-latest
14
+
15
+    permissions:
16
+      contents: write
17
+
18
+    steps:
19
+      - name: Install dependencies
20
+        run: sudo apt-get install -y cxxtest build-essential gcc-arm-none-eabi mtools zip
21
+
22
+      - name: Checkout repo
23
+        uses: actions/checkout@v4
24
+        with:
25
+          path: repo
26
+          fetch-depth: 0
27
+
28
+      - name: Checkout repo submodules
29
+        working-directory: ${{github.workspace}}/repo
30
+        run: git submodule update --init
31
+
32
+      - name: Checkout pico-sdk submodules
33
+        working-directory: ${{github.workspace}}/repo/pico-sdk
34
+        run: git submodule update --init
35
+
36
+      - name: Create Build Environment
37
+        working-directory: ${{github.workspace}}/repo
38
+        run:  cmake -E make_directory ${{github.workspace}}/repo/build
39
+
40
+      - name: Configure CMake
41
+        shell: bash
42
+        working-directory: ${{github.workspace}}/repo/build
43
+        run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
44
+
45
+      - name: Get core count
46
+        id: core_count
47
+        run : cat /proc/cpuinfo  | grep processor | wc -l
48
+
49
+      - name: Build
50
+        working-directory: ${{github.workspace}}/repo/build
51
+        shell: bash
52
+        run: cmake --build . --config $BUILD_TYPE --parallel $(nproc)
53
+
54
+      - name: Upload a Build Artifact
55
+        uses: actions/upload-artifact@v4.0.0
56
+        with:
57
+          name: firmware.uf2
58
+          path: ${{github.workspace}}/repo/build/drumkit.uf2
59
+          if-no-files-found: error
60
+
61
+      - name: Upload a Build Artifact
62
+        uses: actions/upload-artifact@v4.0.0
63
+        with:
64
+          name: update.elf
65
+          path: ${{github.workspace}}/repo/build/drumkit.elf
66
+          if-no-files-found: error
67
+
68
+      - name: Archive release files
69
+        if: startsWith(github.ref, 'refs/tags/')
70
+        run: |
71
+          cd ${{github.workspace}}/repo/build
72
+          zip -r firmware drumkit.uf2 drumkit.elf
73
+
74
+      - name: Upload release files
75
+        if: startsWith(github.ref, 'refs/tags/')
76
+        uses: softprops/action-gh-release@v1
77
+        with:
78
+          files: ${{github.workspace}}/repo/build/firmware.zip

+ 1
- 0
README.md View File

@@ -3,6 +3,7 @@
3 3
 ![PCB](https://github.com/xythobuz/lars/actions/workflows/kicad.yml/badge.svg)
4 4
 ![Docs](https://github.com/xythobuz/lars/actions/workflows/docs.yml/badge.svg)
5 5
 ![STLs](https://github.com/xythobuz/lars/actions/workflows/scad.yml/badge.svg)
6
+![Firmware](https://github.com/xythobuz/lars/actions/workflows/cmake.yml/badge.svg)
6 7
 
7 8
 This is a simple drum machine / loopstation.
8 9
 It's made for three hand-wound solenoids mounted to a tambourine.

+ 1
- 0
docs/src/introduction.md View File

@@ -3,6 +3,7 @@
3 3
 ![PCB](https://github.com/xythobuz/lars/actions/workflows/kicad.yml/badge.svg)
4 4
 ![Docs](https://github.com/xythobuz/lars/actions/workflows/docs.yml/badge.svg)
5 5
 ![STLs](https://github.com/xythobuz/lars/actions/workflows/scad.yml/badge.svg)
6
+![Firmware](https://github.com/xythobuz/lars/actions/workflows/cmake.yml/badge.svg)
6 7
 
7 8
 This is a simple drum machine / loopstation.
8 9
 It's made for three hand-wound solenoids mounted to a tambourine.

Loading…
Cancel
Save