Skip to content

Commit 3bf34b0

Browse files
Add GitHub Actions workflow
1 parent ffe03b1 commit 3bf34b0

File tree

1 file changed

+225
-0
lines changed

1 file changed

+225
-0
lines changed

.github/workflows/dev-release.yml

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
name: Dev Release - RPi ARMv7 Thunder
2+
on:
3+
push:
4+
tags:
5+
- 'dev-*'
6+
7+
env:
8+
TZ: Etc/UTC
9+
DEBIAN_FRONTEND: noninteractive
10+
FORCE_UNSAFE_CONFIGURE: 1
11+
CONFIG_NAME: raspberrypi_armv7_thunder
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
fetch-depth: 0
23+
24+
- name: Set up SSH for private repos
25+
run: |
26+
mkdir -p ~/.ssh
27+
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
28+
echo "${{ secrets.GHA_SSH_KEY }}" > ~/.ssh/id_ed25519
29+
chmod 600 ~/.ssh/id_ed25519
30+
31+
cat <<EOT >> ~/.ssh/config
32+
Host github.com
33+
IdentityFile ~/.ssh/id_ed25519
34+
IdentitiesOnly yes
35+
EOT
36+
37+
- name: Cache downloads
38+
uses: actions/cache@v4
39+
with:
40+
path: build/download
41+
key: downloads-${{ hashFiles('buildroot/.git/modules/**/HEAD', 'buildroot-external-metrological-open-source/.git/HEAD', 'buildroot-external-metrological-restricted/.git/HEAD') }}
42+
restore-keys: |
43+
downloads-
44+
45+
- name: Cache ccache (armv7)
46+
uses: actions/cache@v4
47+
with:
48+
path: build/ccache
49+
key: ccache-armv7-${{ hashFiles('buildroot/.git/modules/**/HEAD') }}
50+
restore-keys: |
51+
ccache-armv7-
52+
53+
- name: Install dependencies
54+
run: |
55+
sudo apt-get -qq update
56+
sudo apt-get -qq --yes install apt-utils > /dev/null
57+
sudo apt-get -qq --yes install \
58+
subversion build-essential bison flex gettext libncurses5-dev texinfo \
59+
autoconf automake libtool mercurial git-core gperf gawk expat curl cvs \
60+
libexpat-dev bzr unzip bc python3-dev wget cpio rsync xxd libmpc-dev \
61+
libgmp3-dev xz-utils file ccache > /dev/null
62+
63+
# Install multilib on x86_64
64+
if [ "$(arch)" = "x86_64" ]; then
65+
sudo apt-get -qq --yes install gcc-multilib g++-multilib > /dev/null
66+
fi
67+
68+
echo "✅ Dependencies installed"
69+
70+
- name: Configure ccache
71+
run: |
72+
ccache -M 3.5G
73+
ccache -z # Zero statistics
74+
echo "✅ ccache configured with 3.5GB limit"
75+
76+
- name: Get git reference
77+
id: ref
78+
run: |
79+
REF=$(git rev-parse --short HEAD)
80+
echo "ref=$REF" >> $GITHUB_OUTPUT
81+
echo "📌 Building reference: $REF"
82+
echo "🏷️ Tag: ${{ github.ref_name }}"
83+
84+
- name: Download packages
85+
run: |
86+
export BR2_DL_DIR="${PWD}/build/download"
87+
88+
echo "📦 Downloading packages for $CONFIG_NAME..."
89+
90+
# Initialize config
91+
make -C buildroot \
92+
BR2_EXTERNAL="../buildroot-external-metrological-restricted:../buildroot-external-metrological-open-source" \
93+
O=../../build/$CONFIG_NAME \
94+
${CONFIG_NAME}_defconfig
95+
96+
make -C build/$CONFIG_NAME syncconfig
97+
98+
# Download all sources
99+
echo "⏬ Running 'make source'..."
100+
time make -C build/$CONFIG_NAME source
101+
102+
echo "✅ Package download complete"
103+
104+
- name: Build ${{ env.CONFIG_NAME }}
105+
run: |
106+
export BR2_DL_DIR="${PWD}/build/download"
107+
export BR2_CCACHE_DIR="${PWD}/build/ccache"
108+
109+
echo "🔨 Building $CONFIG_NAME..."
110+
echo "⏰ Build started at $(date)"
111+
112+
# Initialize defconfig
113+
make -C buildroot \
114+
BR2_EXTERNAL="../buildroot-external-metrological-restricted:../buildroot-external-metrological-open-source" \
115+
O=../../build/$CONFIG_NAME \
116+
${CONFIG_NAME}_defconfig
117+
118+
# Add WPE WebKit parallel build optimization
119+
echo 'BR2_PACKAGE_WPEWEBKIT_ML_PARALLEL_BUILD_JOBS="6"' >> ./build/$CONFIG_NAME/.config
120+
121+
make -C build/$CONFIG_NAME syncconfig
122+
123+
# Build with timing
124+
time make -C build/$CONFIG_NAME
125+
126+
echo "✅ Build completed at $(date)"
127+
128+
- name: Show ccache statistics
129+
run: |
130+
echo "📊 ccache Statistics:"
131+
ccache -s
132+
133+
- name: Show build artifacts
134+
run: |
135+
echo "📁 Build artifacts:"
136+
ls -lh ./build/$CONFIG_NAME/images/
137+
138+
- name: Compress image
139+
run: |
140+
echo "🗜️ Compressing image at $(date)..."
141+
142+
xz --verbose --keep --compress --stdout \
143+
./build/$CONFIG_NAME/images/sdcard.img > \
144+
./${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz
145+
146+
# Show file size
147+
echo ""
148+
echo "📦 Compressed image:"
149+
ls -lh ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz
150+
151+
# Calculate checksums
152+
echo ""
153+
echo "🔐 Checksums:"
154+
sha256sum ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | tee ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256
155+
156+
- name: Upload artifact
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz
160+
path: |
161+
${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz
162+
${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256
163+
compression-level: 0 # Already compressed with xz
164+
165+
- name: Create pre-release
166+
uses: softprops/action-gh-release@v1
167+
with:
168+
files: |
169+
${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz
170+
${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256
171+
prerelease: true
172+
generate_release_notes: true
173+
body: |
174+
## 🎉 Dev Build - ${{ env.CONFIG_NAME }}
175+
176+
**Configuration:** `${{ env.CONFIG_NAME }}_defconfig`
177+
**Reference:** `${{ steps.ref.outputs.ref }}`
178+
**Tag:** `${{ github.ref_name }}`
179+
**Build Date:** ${{ github.event.head_commit.timestamp }}
180+
**Triggered by:** @${{ github.actor }}
181+
182+
### 📦 Artifacts
183+
- `${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz` - Compressed SD card image
184+
- `${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256` - SHA256 checksum
185+
186+
### 🔧 Platform
187+
- **Target:** Raspberry Pi (ARMv7 32-bit)
188+
- **Variant:** Thunder
189+
190+
### ⚡ Usage
191+
```bash
192+
# Download and verify
193+
wget https://github.com/WebPlatformForEmbedded/lithosphere/releases/download/${{ github.ref_name }}/${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz
194+
wget https://github.com/WebPlatformForEmbedded/lithosphere/releases/download/${{ github.ref_name }}/${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256
195+
196+
# Verify checksum
197+
sha256sum -c ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256
198+
199+
# Extract and flash
200+
xz -d ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz
201+
sudo dd if=${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img of=/dev/sdX bs=4M status=progress
202+
sync
203+
```
204+
205+
---
206+
207+
⚠️ **This is a development build for testing purposes.**
208+
env:
209+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210+
211+
- name: Build summary
212+
run: |
213+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
214+
echo "✅ BUILD SUCCESSFUL"
215+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
216+
echo ""
217+
echo "📋 Configuration: $CONFIG_NAME"
218+
echo "🏷️ Tag: ${{ github.ref_name }}"
219+
echo "📌 Reference: ${{ steps.ref.outputs.ref }}"
220+
echo "🎯 Platform: Raspberry Pi (ARMv7)"
221+
echo ""
222+
echo "📦 Artifact: ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz"
223+
echo "🔗 Release: https://github.com/WebPlatformForEmbedded/lithosphere/releases/tag/${{ github.ref_name }}"
224+
echo ""
225+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

0 commit comments

Comments
 (0)