Add Forgejo CI action
Some checks failed
/ build (push) Failing after 3s
/ merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Has been skipped
/ merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Has been skipped
/ merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Has been skipped
/ merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Has been skipped
/ release (push) Has been skipped
Some checks failed
/ build (push) Failing after 3s
/ merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Has been skipped
/ merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Has been skipped
/ merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Has been skipped
/ merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Has been skipped
/ release (push) Has been skipped
This commit is contained in:
parent
1ccd5f18fb
commit
2a3c0a7911
1 changed files with 173 additions and 0 deletions
173
.forgejo/workflows/push.yaml
Normal file
173
.forgejo/workflows/push.yaml
Normal file
|
@ -0,0 +1,173 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
branches:
|
||||
- 'feature/forgejo-ci'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: ghcr.io/catthehacker/ubuntu:js-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
checks: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
cache-dependency-path: '**/yarn.lock'
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.platformio/.cache
|
||||
~/data/node_modules
|
||||
key: ${{ runner.os }}-pio
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
- name: Get current date
|
||||
id: dateAndTime
|
||||
shell: bash
|
||||
run: echo "dateAndTime=$(date +'%Y-%m-%d-%H:%M')" >> $GITHUB_OUTPUT
|
||||
- name: Install PlatformIO Core
|
||||
shell: bash
|
||||
run: pip install --upgrade platformio
|
||||
- name: Run unit tests
|
||||
shell: bash
|
||||
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'
|
||||
detailed_summary: true
|
||||
- name: Build BTClock firmware
|
||||
shell: bash
|
||||
run: pio run
|
||||
- name: Build BTClock filesystem
|
||||
shell: bash
|
||||
run: pio run --target buildfs
|
||||
- name: Copy bootloader to output folder
|
||||
run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin .pio
|
||||
- name: Upload artifacts
|
||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
include-hidden-files: true
|
||||
retention-days: 1
|
||||
name: prepared-outputs
|
||||
path: .pio/**/*.bin
|
||||
merge:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: ghcr.io/catthehacker/ubuntu:js-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
checks: write
|
||||
needs: build
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
chip:
|
||||
- name: lolin_s3_mini
|
||||
version: esp32s3
|
||||
- name: btclock_rev_b
|
||||
version: esp32s3
|
||||
- name: btclock_v8
|
||||
version: esp32s3
|
||||
epd_variant: [213epd, 29epd]
|
||||
exclude:
|
||||
- chip: {name: btclock_rev_b, version: esp32s3}
|
||||
epd_variant: 29epd
|
||||
- chip: {name: btclock_v8, version: esp32s3}
|
||||
epd_variant: 29epd
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
with:
|
||||
name: prepared-outputs
|
||||
path: .pio
|
||||
- name: Install esptools.py
|
||||
run: pip install --upgrade esptool
|
||||
- name: Create merged firmware binary
|
||||
run: |
|
||||
if [ "${{ matrix.chip.name }}" == "btclock_v8" ]; then
|
||||
mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && \
|
||||
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
|
||||
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
|
||||
--flash_mode dio \
|
||||
--flash_freq 80m \
|
||||
--flash_size 16MB \
|
||||
0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin \
|
||||
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
|
||||
0xe000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/ota_data_initial.bin \
|
||||
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
|
||||
0x810000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin;
|
||||
else
|
||||
# Original command for other cases
|
||||
mkdir -p ${{ matrix.chip.name }}_${{ matrix.epd_variant }} && \
|
||||
esptool.py --chip ${{ matrix.chip.version }} merge_bin \
|
||||
-o ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin \
|
||||
--flash_mode dio \
|
||||
0x0000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/bootloader.bin \
|
||||
0x8000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/partitions.bin \
|
||||
0xe000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/ota_data_initial.bin \
|
||||
0x10000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin \
|
||||
0x369000 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin
|
||||
# Adjust the offset for littlefs or other files as needed for the original case
|
||||
fi
|
||||
|
||||
- name: Create checksum for firmware
|
||||
run: shasum -a 256 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}_firmware.bin.sha256
|
||||
|
||||
- name: Create checksum for merged binary
|
||||
run: shasum -a 256 ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}.bin.sha256
|
||||
|
||||
- name: Create checksum for littlefs partition
|
||||
run: shasum -a 256 .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin | awk '{print $1}' > ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/littlefs.bin.sha256
|
||||
|
||||
- name: Copy all artifacts to output folder
|
||||
run: cp .pio/build/${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.bin .pio/boot_app0.bin ${{ matrix.chip.name }}_${{ matrix.epd_variant }}
|
||||
|
||||
- name: Create OTA binary file
|
||||
run: mv ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/firmware.bin ${{ matrix.chip.name }}_${{ matrix.epd_variant }}/${{ matrix.chip.name }}_${{ matrix.epd_variant }}_firmware.bin
|
||||
- name: Upload artifacts
|
||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: build-${{ matrix.chip.name }}-${{ matrix.epd_variant }}
|
||||
path: |
|
||||
${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.bin
|
||||
${{ matrix.chip.name }}_${{ matrix.epd_variant }}/*.sha256
|
||||
release:
|
||||
runs-on: docker
|
||||
permissions:
|
||||
contents: write
|
||||
checks: write
|
||||
needs: merge
|
||||
steps:
|
||||
- name: Download matrix outputs
|
||||
uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
with:
|
||||
pattern: "build-*/**/*.bin,build-*/**/*.sha256"
|
||||
merge-multiple: false
|
||||
path: release
|
||||
- name: Create release
|
||||
uses: https://code.forgejo.org/actions/forgejo-release@v2.4.0
|
||||
with:
|
||||
url: 'https://git.btclock.dev/'
|
||||
repo: '${{ github.repository }}'
|
||||
direction: upload
|
||||
tag: '${{ github.ref_name }}'
|
||||
sha: '${{ github.sha }}'
|
||||
release-dir: release
|
||||
token: ${{ secrets.TOKEN }}
|
||||
override: false
|
||||
verbose: false
|
||||
prerelease: ${{ github.ref_type != 'tag' && github.ref_name != 'main' }}
|
||||
release-notes-assistant: false
|
Loading…
Reference in a new issue