-
-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (118 loc) · 4.15 KB
/
Copy pathci.yml
File metadata and controls
137 lines (118 loc) · 4.15 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Build firmware
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: yacp-main-build
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
enable-cache: true
- name: Cache PlatformIO packages
uses: actions/cache@v6
with:
path: ~/.platformio
key: ${{ runner.os }}-platformio-${{ hashFiles('platformio.ini') }}
restore-keys: |
${{ runner.os }}-platformio-
- name: Install PlatformIO Core
run: uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.19.zip
- name: Read and verify version
id: version
shell: bash
run: |
set -euo pipefail
VERSION="$(sed -n 's/^crossink_version = //p' platformio.ini)"
if [ -z "$VERSION" ]; then
echo "::error::crossink_version is missing from platformio.ini"
exit 1
fi
if git rev-parse HEAD^ >/dev/null 2>&1; then
PREVIOUS_VERSION="$(git show HEAD^:platformio.ini | sed -n 's/^crossink_version = //p')"
if [ "$VERSION" = "$PREVIOUS_VERSION" ]; then
echo "::error::crossink_version must change on every main build"
exit 1
fi
fi
if ! grep -q "^## \\[v${VERSION}\\]" CHANGELOG.md; then
echo "::error::The top changelog section must include [v${VERSION}]"
exit 1
fi
echo "value=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build YACP tiny and xlarge
run: |
set -euo pipefail
pio run -e tiny -e xlarge | tee pio.log
- name: Package firmware
env:
VERSION: ${{ steps.version.outputs.value }}
run: |
set -euo pipefail
mkdir -p dist-publish
cp .pio/build/tiny/firmware-tiny.bin "dist-publish/YACP-${VERSION}-yacp-tiny.bin"
cp .pio/build/xlarge/firmware-xlarge.bin "dist-publish/YACP-${VERSION}-yacp-xlarge.bin"
cd dist-publish
sha256sum ./*.bin > SHA256SUMS.txt
- name: Prepare release notes and build summary
env:
VERSION: ${{ steps.version.outputs.value }}
shell: bash
run: |
set -euo pipefail
{
echo "# YACP ${VERSION}"
echo
echo "Commit: \`${GITHUB_SHA}\`"
echo
echo "## Hardware status"
echo
echo "- [ ] X3 hardware validated"
echo "- [ ] X4 hardware validated"
echo
cat BUILD_CHECKLIST.md
echo
echo "## Current changelog"
echo
awk 'NR == 1 { print; next } /^## \[/ { exit } { print }' CHANGELOG.md
} > dist-publish/RELEASE_NOTES.md
cat dist-publish/RELEASE_NOTES.md >> "$GITHUB_STEP_SUMMARY"
{
echo
echo "## Firmware size"
grep -E "RAM:\\s|Flash:\\s" pio.log | while read -r line; do echo "- ${line}"; done
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: YACP-${{ steps.version.outputs.value }}
path: dist-publish/
if-no-files-found: error
- name: Create or update draft release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.version.outputs.value }}
target_commitish: ${{ github.sha }}
name: YACP ${{ steps.version.outputs.value }}
body_path: dist-publish/RELEASE_NOTES.md
draft: true
prerelease: true
fail_on_unmatched_files: true
files: |
dist-publish/YACP-${{ steps.version.outputs.value }}-yacp-tiny.bin
dist-publish/YACP-${{ steps.version.outputs.value }}-yacp-xlarge.bin
dist-publish/SHA256SUMS.txt