|
|
@@ -6,18 +6,18 @@ on:
|
|
|
- main
|
|
|
tags:
|
|
|
- '[0-9]*.[0-9]*.[0-9]*'
|
|
|
- # PRs get the same gate -- without this the checks only ran after merge.
|
|
|
+ # Build every PR head commit and publish UF2 artifacts for reviewers.
|
|
|
pull_request:
|
|
|
- pull_request_review:
|
|
|
- types:
|
|
|
- - submitted
|
|
|
+
|
|
|
+concurrency:
|
|
|
+ group: build-${{ github.event.pull_request.number || github.ref }}
|
|
|
+ cancel-in-progress: true
|
|
|
|
|
|
permissions:
|
|
|
contents: read
|
|
|
|
|
|
jobs:
|
|
|
compile:
|
|
|
- if: github.event_name != 'pull_request_review' || github.event.review.state == 'approved'
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
steps:
|
|
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
uses: actions/checkout@v4
|
|
|
with:
|
|
|
fetch-depth: 0
|
|
|
- ref: ${{ github.event.pull_request.head.sha || github.event.review.pull_request.head.sha || github.sha }}
|
|
|
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
|
|
- name: Set up Arduino CLI
|
|
|
uses: arduino/setup-arduino-cli@v2
|
|
|
@@ -50,8 +50,8 @@ jobs:
|
|
|
- name: Resolve build version
|
|
|
id: build_version
|
|
|
env:
|
|
|
- PR_NUMBER: ${{ github.event.pull_request.number || github.event.review.pull_request.number || '' }}
|
|
|
- HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.review.pull_request.head.sha || github.sha }}
|
|
|
+ PR_NUMBER: ${{ github.event.pull_request.number || '' }}
|
|
|
+ HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
run: |
|
|
|
set -eu
|
|
|
SEMVER_RE='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
|
|
|
@@ -64,14 +64,21 @@ jobs:
|
|
|
if [ -z "$BASE_VERSION" ]; then
|
|
|
BASE_VERSION="0.9.1"
|
|
|
fi
|
|
|
+ SHORT_SHA="$(git rev-parse --short=8 "${HEAD_SHA}")"
|
|
|
+ PR_NUMBER_OR_ZERO="${PR_NUMBER:-0}"
|
|
|
|
|
|
- if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_review" ]; then
|
|
|
- SHORT_SHA="$(git rev-parse --short=8 "${HEAD_SHA}")"
|
|
|
- VERSION="${BASE_VERSION}-pr${PR_NUMBER}+${SHORT_SHA}"
|
|
|
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
|
+ VERSION="${BASE_VERSION}-pr${PR_NUMBER_OR_ZERO}+${SHORT_SHA}"
|
|
|
+ ARTIFACT_VERSION="${BASE_VERSION}-pr${PR_NUMBER_OR_ZERO}-${SHORT_SHA}"
|
|
|
else
|
|
|
VERSION="${BASE_VERSION}"
|
|
|
+ ARTIFACT_VERSION="${BASE_VERSION}-${SHORT_SHA}"
|
|
|
fi
|
|
|
|
|
|
+ echo "base_version=$BASE_VERSION" >> "$GITHUB_OUTPUT"
|
|
|
+ echo "pr_number=$PR_NUMBER_OR_ZERO" >> "$GITHUB_OUTPUT"
|
|
|
+ echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
|
|
|
+ echo "artifact_version=$ARTIFACT_VERSION" >> "$GITHUB_OUTPUT"
|
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
|
|
- name: Generate version header
|
|
|
@@ -114,21 +121,34 @@ jobs:
|
|
|
run: |
|
|
|
find build/openpuck build/reversepuck -maxdepth 1 -type f -print | sort
|
|
|
|
|
|
- - name: Upload build artifacts
|
|
|
+ - name: Upload OpenPuck UF2 artifact
|
|
|
+ uses: actions/upload-artifact@v4
|
|
|
+ with:
|
|
|
+ name: OpenPuck-${{ steps.build_version.outputs.artifact_version }}-standard.uf2
|
|
|
+ retention-days: 7
|
|
|
+ if-no-files-found: error
|
|
|
+ path: build/openpuck/OpenPuck.ino.uf2
|
|
|
+
|
|
|
+ - name: Upload OpenPuck HEX artifact
|
|
|
+ uses: actions/upload-artifact@v4
|
|
|
+ with:
|
|
|
+ name: OpenPuck-${{ steps.build_version.outputs.artifact_version }}-standard.hex
|
|
|
+ retention-days: 7
|
|
|
+ if-no-files-found: error
|
|
|
+ path: build/openpuck/OpenPuck.ino.hex
|
|
|
+
|
|
|
+ - name: Upload ReversePuckFirmware UF2 artifact
|
|
|
+ uses: actions/upload-artifact@v4
|
|
|
+ with:
|
|
|
+ name: ReversePuckFirmware-${{ steps.build_version.outputs.artifact_version }}.uf2
|
|
|
+ retention-days: 7
|
|
|
+ if-no-files-found: error
|
|
|
+ path: build/reversepuck/ReversePuckFirmware.ino.uf2
|
|
|
+
|
|
|
+ - name: Upload ReversePuckFirmware HEX artifact
|
|
|
uses: actions/upload-artifact@v4
|
|
|
with:
|
|
|
- name: openpuck-firmware
|
|
|
+ name: ReversePuckFirmware-${{ steps.build_version.outputs.artifact_version }}.hex
|
|
|
retention-days: 7
|
|
|
- path: |
|
|
|
- build/openpuck/*.uf2
|
|
|
- build/openpuck/*.bin
|
|
|
- build/openpuck/*.hex
|
|
|
- build/openpuck/*.elf
|
|
|
- build/openpuck/*.map
|
|
|
- build/openpuck/*.zip
|
|
|
- build/reversepuck/*.uf2
|
|
|
- build/reversepuck/*.bin
|
|
|
- build/reversepuck/*.hex
|
|
|
- build/reversepuck/*.elf
|
|
|
- build/reversepuck/*.map
|
|
|
- build/reversepuck/*.zip
|
|
|
+ if-no-files-found: error
|
|
|
+ path: build/reversepuck/ReversePuckFirmware.ino.hex
|