forked from mkalkbrenner/PPUC
-
Notifications
You must be signed in to change notification settings - Fork 3
111 lines (98 loc) · 3.28 KB
/
io-bords.yml
File metadata and controls
111 lines (98 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: PPUC IO Boards
on:
push:
pull_request:
schedule:
- cron: '0 9 * * *' # run at 08:00 UTC
jobs:
version:
name: Detect version
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
run: |
VERSION_MAJOR=$(grep -Eo "FIRMWARE_VERSION_MAJOR\s+[0-9]+" src/PPUC.h | grep -Eo "[0-9]+")
VERSION_MINOR=$(grep -Eo "FIRMWARE_VERSION_MINOR\s+[0-9]+" src/PPUC.h | grep -Eo "[0-9]+")
VERSION_PATCH=$(grep -Eo "FIRMWARE_VERSION_PATCH\s+[0-9]+" src/PPUC.h | grep -Eo "[0-9]+")
TAG="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
echo "${TAG}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Check git tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
GIT_TAG="${GITHUB_REF#refs/tags/}"
EXPECTED_TAG="v${{ steps.version.outputs.tag }}"
if [[ "${GIT_TAG}" != "${EXPECTED_TAG}" ]]; then
echo "Error: Git tag (${GIT_TAG}) does not match version from PPUC.h (v${{ steps.version.outputs.tag }})"
exit 1
fi
pio-run:
name: Build and upload firmware
runs-on: ubuntu-latest
needs: [ version ]
strategy:
fail-fast: false
matrix:
controller: ['IO_16_8_1']
steps:
- name: PPUC ${{ matrix.controller }}
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v5
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Build elf2uf2 from source
run: |
sudo apt update && sudo apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi
git clone https://github.com/ckormanyos/elf2uf2.git
cd elf2uf2
make all
sudo cp bin/elf2uf2 /usr/local/bin/
cd ..
- name: Run PlatformIO
run: |
pio run
- name: Create UF2 file (using elf2uf2)
run: |
ELF_FILE=$(find .pio/build/ -name "*.elf" | head -n 1)
echo "Found ELF file: $ELF_FILE"
elf2uf2 "$ELF_FILE" "${ELF_FILE%.elf}.uf2"
cp ${ELF_FILE%.elf}.uf2 ${{ matrix.controller }}-${{ needs.version.outputs.tag }}.uf2
- name: Upload UF2 artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.controller }}-firmware
path: |
${{ matrix.controller }}-${{ needs.version.outputs.tag }}.uf2
post-build:
runs-on: ubuntu-latest
needs: [ version, pio-run ]
name: Release
steps:
- uses: actions/download-artifact@v4
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: |
*/*.uf2