Skip to content

Commit

Permalink
Update workflow to use v4 actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjko committed Jul 28, 2024
1 parent f73a466 commit 2a80609
Showing 1 changed file with 58 additions and 5 deletions.
63 changes: 58 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ env:
jobs:
build:
runs-on: ubuntu-latest
outputs:
brickpico_version: ${{steps.version-check.outputs.BRICKPICO_VERSION}}
build_date: ${{steps.version-check.outputs.BUILD_DATE}}

strategy:
matrix:
Expand All @@ -26,14 +29,14 @@ jobs:

- name: Cache Pico-SDK
id: cache-pico-sdk
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: pico-sdk
key: ${{runner.os}}-pico-sdk-${{env.PICO_SDK_REF}}

- if: ${{steps.cache-pico-sdk.outputs.cache-hit != 'true' }}
name: Checkout Pico-SDK
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: ${{env.PICO_SDK_REF}}
Expand All @@ -45,14 +48,24 @@ jobs:
echo "PICO_SDK_PATH=${{github.workspace}}/pico-sdk" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: main
submodules: recursive

- name: Configure CMake
run: cmake -S main -B ${{github.workspace}}/main/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=${{matrix.pico_board}} -DBRICKPICO_BOARD=${{matrix.brickpico_board}}

- name: Check Source Version
id: version-check
run: |
ver=$(awk '/BRICKPICO_VERSION[[:space:]]/ { gsub(/"/,""); print $3; exit; }' main/build/config.h)
echo "BRICKPICO_VERSION=$ver" >> $GITHUB_ENV
echo "BRICKPICO_VERSION=$ver" >> $GITHUB_OUTPUT
date=$(date +%Y%m%d)
echo "BUILD_DATE=$date" >> $GITHUB_ENV
echo "BUILD_DATE=$date" >> $GITHUB_OUTPUT
- name: Build
run: cmake --build ${{github.workspace}}/main/build --config ${{env.BUILD_TYPE}}

Expand All @@ -73,8 +86,48 @@ jobs:
cp -av brickpico.elf.map dist/brickpico-${{matrix.brickpico_board}}-${{matrix.pico_board}}.elf.map
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: brickpico-firmware-${{github.run_number}}-${{github.sha}}
name: firmware-${{matrix.brickpico_board}}-${{matrix.pico_board}}-build${{github.run_number}}-${{env.BUILD_DATE}}
path: main/build/dist


merge:
runs-on: ubuntu-latest
needs: build
env:
BRICKPICO_VERSION: ${{needs.build.outputs.brickpico_version}}
BUILD_DATE: ${{needs.build.outputs.build_date}}

steps:

- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: bundle
pattern: firmware-*
merge-multiple: true

- name: Calculate checksums
working-directory: bundle
run: |
sha256sum * > sha256sums.txt
ls -la
echo "### Generated firmware files" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat sha256sums.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload checksum artifact
uses: actions/upload-artifact@v4
with:
name: firmware-checksums
path: bundle/*.txt

- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: brickpico-firmware-${{env.BUILD_DATE}}-${{env.BRICKPICO_VERSION}}-build${{github.run_number}}
pattern: firmware-*
delete-merged: true

0 comments on commit 2a80609

Please sign in to comment.