btclock_v3/.github/workflows/workflow.yml

96 lines
3.5 KiB
YAML
Raw Normal View History

2023-11-08 14:49:16 +00:00
name: BTClock CI
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
2023-11-28 01:16:56 +00:00
checks: write
2023-11-08 14:49:16 +00:00
steps:
2023-11-19 17:34:40 +00:00
- uses: actions/checkout@v4
2023-11-17 18:28:40 +00:00
with:
submodules: recursive
2023-11-19 17:37:29 +00:00
- uses: actions/setup-node@v4
2023-11-08 14:49:16 +00:00
with:
node-version: lts/*
cache: yarn
cache-dependency-path: '**/yarn.lock'
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
2023-11-17 18:28:40 +00:00
~/data/node_modules
2023-11-08 14:49:16 +00:00
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Get current date
id: dateAndTime
# run: echo "::set-output name=dateAndTime::$(date +'%Y-%m-%d-%H:%M')"
run: echo "dateAndTime=$(date +'%Y-%m-%d-%H:%M')" >> $GITHUB_OUTPUT
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Run unit tests
2023-11-28 01:11:51 +00:00
run: mkdir -p junit-reports && pio test -e native_test_only --junit-output-path junit-reports/
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/junit-reports/*.xml'
2023-11-08 14:49:16 +00:00
- name: Build BTClock firmware
2023-11-10 20:00:24 +00:00
run: pio run -e lolin_s3_mini_qr
2023-11-08 14:49:16 +00:00
- name: Build BTClock filesystem
2023-11-10 20:00:24 +00:00
run: pio run -e lolin_s3_mini_qr --target buildfs
2023-11-08 14:49:16 +00:00
- name: Install esptools.py
run: pip install --upgrade esptool
- name: Create merged firmware binary
run: mkdir -p output && esptool.py --chip esp32s3 merge_bin -o output/full-firmware.bin --flash_mode dio 0x0000 .pio/build/lolin_s3_mini_qr/bootloader.bin 0x8000 .pio/build/lolin_s3_mini_qr/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/lolin_s3_mini_qr/firmware.bin 0x369000 .pio/build/lolin_s3_mini_qr/littlefs.bin
2023-11-08 14:49:16 +00:00
- name: Create checksum for merged binary
run: shasum -a 256 output/full-firmware.bin | awk '{print $1}' > output/full-firmware.sha256
- name: Write commit hash to file
run: echo $GITHUB_SHA > output/commit.txt
- name: Write build date to file
run: echo "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > output/date.txt
2023-11-19 17:13:44 +00:00
- name: Copy all artifacts to output folder
2023-11-20 19:51:57 +00:00
run: cp .pio/build/lolin_s3_mini_qr/*.bin ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin output
2023-11-19 17:13:44 +00:00
2023-11-08 14:49:16 +00:00
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: |
2023-11-10 20:00:24 +00:00
.pio/build/lolin_s3_mini_qr/*.bin
2023-11-08 14:49:16 +00:00
output/full-firmware.bin
output/full-firmware.sha256
- name: Create release
uses: ncipollo/release-action@v1
with:
2023-11-10 20:00:24 +00:00
artifacts: "output/full-firmware.bin,output/full-firmware.sha256,.pio/build/lolin_s3_mini_qr/*.bin"
2023-11-08 14:49:16 +00:00
allowUpdates: true
removeArtifacts: true
makeLatest: true
- name: Pushes full-firmware.bin to web flasher
id: push_directory
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: output/
target-directory: firmware_v3/
destination-github-username: 'btclock'
destination-repository-name: 'web-flasher'
target-branch: btclock
user-name: ${{github.actor}}
user-email: ${{github.actor}}@users.noreply.github.com