|
| 1 | +name: update-submodules |
| 2 | + |
| 3 | +# Weekly check for new libDaisy / DaisySP commits. If upstream has moved, bump the |
| 4 | +# vendored submodules, confirm the firmware still builds, and open a PR. Also runnable |
| 5 | +# on demand from the Actions tab (workflow_dispatch). |
| 6 | +on: |
| 7 | + schedule: |
| 8 | + - cron: '0 7 * * 1' # Mondays 07:00 UTC |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + update: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout (with submodules) |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Bump submodules to upstream HEAD |
| 26 | + id: bump |
| 27 | + run: | |
| 28 | + set -e |
| 29 | + summary="" |
| 30 | + for sm in lib/libDaisy lib/DaisySP; do |
| 31 | + old=$(git -C "$sm" rev-parse --short HEAD) |
| 32 | + git -C "$sm" fetch --quiet origin |
| 33 | + def=$(git -C "$sm" remote show origin | sed -n 's/.*HEAD branch: //p') |
| 34 | + git -C "$sm" checkout --quiet "origin/$def" |
| 35 | + new=$(git -C "$sm" rev-parse --short HEAD) |
| 36 | + [ "$old" != "$new" ] && summary="${summary}- \`${sm}\`: ${old} -> ${new}"$'\n' |
| 37 | + done |
| 38 | + # Stage the new gitlinks, then sync nested submodules (each lib has its own) to match. |
| 39 | + git add lib/libDaisy lib/DaisySP |
| 40 | + git submodule update --init --recursive |
| 41 | + if git diff --cached --quiet -- lib; then |
| 42 | + echo "changed=false" >> "$GITHUB_OUTPUT" |
| 43 | + echo "Submodules already up to date." |
| 44 | + else |
| 45 | + echo "changed=true" >> "$GITHUB_OUTPUT" |
| 46 | + { echo "summary<<EOF"; printf '%s' "$summary"; echo "EOF"; } >> "$GITHUB_OUTPUT" |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Install ARM GCC toolchain |
| 50 | + if: steps.bump.outputs.changed == 'true' |
| 51 | + uses: carlosperate/arm-none-eabi-gcc-action@v1 |
| 52 | + with: |
| 53 | + release: '12.3.Rel1' |
| 54 | + |
| 55 | + - name: Build with the updated libraries |
| 56 | + if: steps.bump.outputs.changed == 'true' |
| 57 | + id: build |
| 58 | + continue-on-error: true # a build break shouldn't suppress the PR -- flag it instead |
| 59 | + run: | |
| 60 | + make -C lib/libDaisy -j"$(nproc)" |
| 61 | + make -C lib/DaisySP -j"$(nproc)" |
| 62 | + make -j"$(nproc)" |
| 63 | +
|
| 64 | + - name: Open pull request |
| 65 | + if: steps.bump.outputs.changed == 'true' |
| 66 | + uses: peter-evans/create-pull-request@v6 |
| 67 | + with: |
| 68 | + branch: chore/update-submodules |
| 69 | + delete-branch: true |
| 70 | + add-paths: lib |
| 71 | + commit-message: 'chore: update vendored submodules to upstream HEAD' |
| 72 | + title: 'chore: update vendored submodules (libDaisy / DaisySP)' |
| 73 | + labels: dependencies |
| 74 | + body: | |
| 75 | + Automated weekly bump of the vendored libraries to their upstream default branch. |
| 76 | +
|
| 77 | + ${{ steps.bump.outputs.summary }} |
| 78 | + Firmware build with the updated libraries: **${{ steps.build.outcome }}** |
| 79 | + (`success` = compiles clean; `failure` = needs a compatibility fix before merging). |
| 80 | +
|
| 81 | + Review the upstream changelogs, then merge if the build is green. The repo's |
| 82 | + `firmware.yml` CI does **not** run automatically on this bot PR (a GitHub limitation |
| 83 | + on `GITHUB_TOKEN`-created PRs), which is why the build above runs inline. |
0 commit comments