Skip to content

Commit 3b2a659

Browse files
authored
add ci pipeline for arm7 builds (#472)
1 parent 4859b93 commit 3b2a659

3 files changed

Lines changed: 286 additions & 11 deletions

File tree

.github/workflows/build.yaml

Lines changed: 238 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,238 @@ jobs:
356356
asset_path: rpm_output/*.rpm
357357
asset_name: eim-cli-${{ matrix.package_name }}.rpm
358358

359+
build-cli-linux-armv7:
360+
name: Build CLI (Linux - linux-armv7)
361+
needs: [setup, build-test-lib, build-cli-linux]
362+
if: (needs.build-test-lib.result == 'success' || needs.build-test-lib.result == 'skipped') && (needs.build-cli-linux.result == 'success')
363+
runs-on: ubuntu-latest
364+
env:
365+
CROSS_TARGET: armv7-unknown-linux-musleabihf
366+
steps:
367+
- name: Checkout repository
368+
uses: actions/checkout@v4
369+
370+
- name: Set up Rust
371+
uses: dtolnay/rust-toolchain@stable
372+
with:
373+
targets: armv7-unknown-linux-musleabihf
374+
375+
- name: Install cross
376+
run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5
377+
378+
- name: Cache cargo
379+
uses: actions/cache@v4
380+
with:
381+
path: |
382+
~/.cargo/registry
383+
~/.cargo/git
384+
target
385+
key: linux-armv7-cargo-${{ hashFiles('**/Cargo.lock') }}
386+
restore-keys: linux-armv7-cargo-
387+
388+
- name: Build CLI
389+
env:
390+
LIBZ_SYS_STATIC: 1
391+
ZLIB_STATIC: 1
392+
LZMA_API_STATIC: 1
393+
APP_INSIGHTS_CONNECTION_STRING: ${{ secrets.APP_INSIGHTS_CONNECTION_STRING }}
394+
run: |
395+
cd src-tauri
396+
cross build --release --no-default-features --features cli --target ${{ env.CROSS_TARGET }}
397+
shell: bash
398+
399+
- name: Create release directory
400+
run: mkdir -p release_cli/linux-armv7
401+
402+
- name: Copy binary
403+
run: |
404+
cp src-tauri/target/${{ env.CROSS_TARGET }}/release/eim release_cli/linux-armv7/eim
405+
chmod +x release_cli/linux-armv7/eim
406+
cd release_cli/linux-armv7
407+
zip -r eim.zip eim
408+
shell: bash
409+
410+
- name: Download completions from linux-x64 build
411+
uses: actions/download-artifact@v4
412+
with:
413+
name: eim-cli-linux-x64-${{ (github.event_name == 'release' && github.ref_name) || github.run_number }}
414+
path: /tmp/x64-cli-artifact/
415+
416+
- name: Generate Completions from x64 binary
417+
shell: bash
418+
run: |
419+
set -euo pipefail
420+
# Completions are architecture-independent (just text from clap),
421+
# so we reuse the x64 binary to generate them.
422+
X64_BIN="/tmp/x64-cli-artifact/eim"
423+
chmod +x "$X64_BIN"
424+
425+
cd src-tauri
426+
OUTDIR="target/${{ env.CROSS_TARGET }}/release/completions"
427+
mkdir -p "$OUTDIR"
428+
429+
"$X64_BIN" completions zsh > "$OUTDIR/_eim"
430+
"$X64_BIN" completions bash > "$OUTDIR/eim.bash"
431+
"$X64_BIN" completions fish > "$OUTDIR/eim.fish"
432+
"$X64_BIN" completions elvish > "$OUTDIR/eim.elv"
433+
434+
mkdir -p target/release/completions
435+
cp -a "$OUTDIR"/. target/release/completions/
436+
437+
- name: Upload build artifacts
438+
uses: actions/upload-artifact@v4
439+
with:
440+
name: eim-cli-linux-armv7-${{ (github.event_name == 'release' && github.ref_name) || github.run_number }}
441+
path: release_cli/linux-armv7/eim
442+
443+
- name: Upload Release Asset
444+
if: github.event_name == 'release' && github.event.action == 'created'
445+
uses: shogo82148/actions-upload-release-asset@v1
446+
env:
447+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
448+
with:
449+
upload_url: ${{ github.event.release.upload_url }}
450+
asset_path: release_cli/linux-armv7/eim.zip
451+
asset_name: eim-cli-linux-armv7.zip
452+
453+
# offline installer
454+
- name: Build offline_installer_builder
455+
env:
456+
LIBZ_SYS_STATIC: 1
457+
ZLIB_STATIC: 1
458+
LZMA_API_STATIC: 1
459+
run: |
460+
cd src-tauri
461+
cross build --release --no-default-features --features offline --bin offline_installer_builder --target ${{ env.CROSS_TARGET }}
462+
shell: bash
463+
464+
- name: Copy offline_installer_builder binary
465+
run: |
466+
cp src-tauri/target/${{ env.CROSS_TARGET }}/release/offline_installer_builder release_cli/linux-armv7/offline_installer_builder
467+
chmod +x release_cli/linux-armv7/offline_installer_builder
468+
cd release_cli/linux-armv7
469+
zip -r offline_installer_builder.zip offline_installer_builder
470+
shell: bash
471+
472+
- name: Upload offline_installer_builder artifacts
473+
uses: actions/upload-artifact@v4
474+
with:
475+
name: offline_installer_builder-linux-armv7-${{ (github.event_name == 'release' && github.ref_name) || github.run_number }}
476+
path: release_cli/linux-armv7/offline_installer_builder
477+
478+
- name: Upload offline_installer_builder Release Asset
479+
if: github.event_name == 'release' && github.event.action == 'created'
480+
uses: shogo82148/actions-upload-release-asset@v1
481+
env:
482+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
483+
with:
484+
upload_url: ${{ github.event.release.upload_url }}
485+
asset_path: release_cli/linux-armv7/offline_installer_builder.zip
486+
asset_name: offline_installer_builder-linux-armv7.zip
487+
488+
# .deb package
489+
- name: Prepare manpage for deb package
490+
if: github.event_name == 'release' && github.event.action == 'created'
491+
run: |
492+
mkdir -p src-tauri/man
493+
cp man/eim.1 src-tauri/man/
494+
shell: bash
495+
496+
- name: Build CLI .deb package
497+
run: |
498+
cd src-tauri
499+
cargo install cargo-deb || true
500+
501+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
502+
VERSION="${GITHUB_REF_NAME#v}"
503+
else
504+
VERSION="0.0.0-${GITHUB_SHA:0:7}"
505+
fi
506+
507+
echo "Using version: $VERSION"
508+
509+
cargo deb --no-build --no-strip --no-default-features --features cli \
510+
--target ${{ env.CROSS_TARGET }} \
511+
--deb-version $VERSION
512+
shell: bash
513+
514+
- name: Upload CLI .deb artifact
515+
uses: actions/upload-artifact@v4
516+
with:
517+
name: eim-cli-linux-armv7-${{ (github.event_name == 'release' && github.ref_name) || github.run_number }}-deb
518+
path: src-tauri/target/debian/eim*.deb
519+
if-no-files-found: warn
520+
521+
- name: Upload CLI .deb Release Asset
522+
if: github.event_name == 'release' && github.event.action == 'created'
523+
uses: shogo82148/actions-upload-release-asset@v1
524+
env:
525+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
526+
with:
527+
upload_url: ${{ github.event.release.upload_url }}
528+
asset_path: src-tauri/target/debian/eim*.deb
529+
asset_name: eim-cli-linux-armv7.deb
530+
531+
# .rpm package
532+
- name: Build CLI .rpm package
533+
run: |
534+
cd src-tauri
535+
cargo install cargo-generate-rpm || true
536+
537+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
538+
VERSION="${GITHUB_REF_NAME#v}"
539+
else
540+
VERSION="0.0.0-${GITHUB_SHA:0:7}"
541+
fi
542+
543+
echo "Using version: $VERSION"
544+
545+
mkdir -p ~/.rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
546+
547+
cargo generate-rpm \
548+
--target ${{ env.CROSS_TARGET }} \
549+
--payload-compress gzip \
550+
551+
echo "Generated RPM files:"
552+
find target -name "*.rpm" -type f
553+
shell: bash
554+
555+
- name: Find and upload RPM artifacts
556+
id: find-rpms
557+
run: |
558+
RPM_DIR="rpm_output"
559+
mkdir -p "$RPM_DIR"
560+
find src-tauri/target -name "*.rpm" -type f -exec cp {} "$RPM_DIR/" \;
561+
562+
echo "Contents of $RPM_DIR:"
563+
ls -la "$RPM_DIR"/
564+
565+
if [ -d "$RPM_DIR" ] && [ "$(ls -A $RPM_DIR)" ]; then
566+
echo "rpm_files_found=true" >> $GITHUB_OUTPUT
567+
else
568+
echo "rpm_files_found=false" >> $GITHUB_OUTPUT
569+
echo "No RPM files found!" >&2
570+
exit 1
571+
fi
572+
573+
- name: Upload RPM artifacts
574+
if: steps.find-rpms.outputs.rpm_files_found == 'true'
575+
uses: actions/upload-artifact@v4
576+
with:
577+
name: eim-cli-linux-armv7-${{ (github.event_name == 'release' && github.ref_name) || github.run_number }}-rpm
578+
path: rpm_output/*.rpm
579+
if-no-files-found: warn
580+
581+
- name: Upload CLI .rpm Release Asset
582+
if: github.event_name == 'release' && github.event.action == 'created' && steps.find-rpms.outputs.rpm_files_found == 'true'
583+
uses: shogo82148/actions-upload-release-asset@v1
584+
env:
585+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
586+
with:
587+
upload_url: ${{ github.event.release.upload_url }}
588+
asset_path: rpm_output/*.rpm
589+
asset_name: eim-cli-linux-armv7.rpm
590+
359591
build-cli:
360592
name: Build CLI (${{ matrix.package_name }})
361593
needs: [setup, build-test-lib]
@@ -673,8 +905,8 @@ jobs:
673905

674906
build-offline-archives:
675907
name: Build Offline Archives
676-
needs: [build-cli, build-cli-linux]
677-
if: (needs.build-cli.result == 'success' || needs.build-cli.result == 'skipped') && (needs.build-cli-linux.result == 'success' || needs.build-cli-linux.result == 'skipped') && github.event_name == 'release'
908+
needs: [build-cli, build-cli-linux, build-cli-linux-armv7]
909+
if: (needs.build-cli.result == 'success' || needs.build-cli.result == 'skipped') && (needs.build-cli-linux.result == 'success' || needs.build-cli-linux.result == 'skipped') && (needs.build-cli-linux-armv7.result == 'success' || needs.build-cli-linux-armv7.result == 'skipped') && github.event_name == 'release'
678910
uses: ./.github/workflows/build_offline_installer_archives.yaml
679911
with:
680912
ref: ${{ github.ref }}
@@ -1048,7 +1280,7 @@ jobs:
10481280

10491281
Autotest-CLI:
10501282
name: Autotest CLI
1051-
needs: [build-cli, build-cli-linux]
1283+
needs: [build-cli, build-cli-linux, build-cli-linux-armv7]
10521284
if: needs.build-cli.result == 'success' && needs.build-cli-linux.result == 'success'
10531285
uses: ./.github/workflows/test_cli.yml
10541286
with:
@@ -1069,7 +1301,7 @@ jobs:
10691301

10701302
update-release-info:
10711303
name: Update Release Information
1072-
needs: [build-cli, build-cli-linux, build-gui]
1304+
needs: [build-cli, build-cli-linux, build-cli-linux-armv7, build-gui]
10731305
runs-on: ubuntu-latest
10741306
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
10751307
steps:
@@ -1088,7 +1320,7 @@ jobs:
10881320
10891321
update-homebrew:
10901322
name: Update Homebrew Formula and Cask
1091-
needs: [build-cli, build-cli-linux, build-gui, update-release-info]
1323+
needs: [build-cli, build-cli-linux, build-cli-linux-armv7, build-gui, update-release-info]
10921324
uses: ./.github/workflows/update-homebrew.yml
10931325
with:
10941326
version: ${{ github.ref_name }}
@@ -1097,7 +1329,7 @@ jobs:
10971329

10981330
update-linux-repos:
10991331
name: Update APT and RPM Repositories
1100-
needs: [build-cli-linux, build-gui, update-release-info]
1332+
needs: [build-cli-linux, build-cli-linux-armv7, build-gui, update-release-info]
11011333
uses: ./.github/workflows/update-linux-repos.yml
11021334
if: github.event_name == 'release' && github.event.action == 'created'
11031335
with:

.github/workflows/update-linux-repos.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,20 @@ jobs:
6060
path: new-debs/
6161
continue-on-error: true
6262

63+
- name: Download CLI linux-armv7 .deb artifact
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: eim-cli-linux-armv7-${{ inputs.version }}-deb
67+
path: new-debs/
68+
continue-on-error: true
69+
6370
- name: Create proper APT repository structure
6471
run: |
65-
# Create proper directory structure
72+
# Create proper directory structure (now includes armhf)
6673
mkdir -p apt-repo/pool/main
6774
mkdir -p apt-repo/dists/stable/main/binary-amd64
6875
mkdir -p apt-repo/dists/stable/main/binary-arm64
76+
mkdir -p apt-repo/dists/stable/main/binary-armhf
6977
7078
# Sync existing .deb files from S3 pool
7179
aws s3 sync s3://espdldata/dl/eim/apt/pool/main/ apt-repo/pool/main/ --exclude "*" --include "*.deb" || echo "No existing pool found"
@@ -89,14 +97,18 @@ jobs:
8997
dpkg-scanpackages --arch arm64 pool/main > dists/stable/main/binary-arm64/Packages
9098
gzip -k -f dists/stable/main/binary-arm64/Packages
9199
92-
# Generate Release file
100+
# ARMHF packages
101+
dpkg-scanpackages --arch armhf pool/main > dists/stable/main/binary-armhf/Packages
102+
gzip -k -f dists/stable/main/binary-armhf/Packages
103+
104+
# Generate Release file (now includes armhf)
93105
cd dists/stable
94106
cat > Release << EOF
95107
Origin: Espressif Systems
96108
Label: ESP-IDF Installation Manager
97109
Suite: stable
98110
Codename: stable
99-
Architectures: amd64 arm64
111+
Architectures: amd64 arm64 armhf
100112
Components: main
101113
Description: ESP-IDF Installation Manager packages
102114
Date: $(date -Ru)
@@ -156,6 +168,13 @@ jobs:
156168
path: new-rpms/
157169
continue-on-error: true
158170

171+
- name: Download CLI linux-armv7 .rpm artifact
172+
uses: actions/download-artifact@v4
173+
with:
174+
name: eim-cli-linux-armv7-${{ inputs.version }}-rpm
175+
path: new-rpms/
176+
continue-on-error: true
177+
159178
- name: Download GUI linux-x64 .rpm artifact
160179
uses: actions/download-artifact@v4
161180
with:
@@ -172,32 +191,38 @@ jobs:
172191

173192
- name: Create RPM repository structure
174193
run: |
175-
# Create directory structure
194+
# Create directory structure (now includes armv7hl)
176195
mkdir -p rpm-repo/x86_64
177196
mkdir -p rpm-repo/aarch64
197+
mkdir -p rpm-repo/armv7hl
178198
179199
# Sync existing .rpm files from S3
180200
aws s3 sync s3://espdldata/dl/eim/rpm/x86_64/ rpm-repo/x86_64/ --exclude "*" --include "*.rpm" || echo "No existing x86_64 RPMs found"
181201
aws s3 sync s3://espdldata/dl/eim/rpm/aarch64/ rpm-repo/aarch64/ --exclude "*" --include "*.rpm" || echo "No existing aarch64 RPMs found"
202+
aws s3 sync s3://espdldata/dl/eim/rpm/armv7hl/ rpm-repo/armv7hl/ --exclude "*" --include "*.rpm" || echo "No existing armv7hl RPMs found"
182203
183204
# Debug: Show contents of downloaded RPMs
184205
echo "Downloaded RPM artifacts:"
185206
find new-rpms -type f -name "*.rpm" -exec ls -la {} \;
186207
187208
# Copy new .rpm files to appropriate architecture directories
188-
# Improved file discovery logic
189209
if [ -d "new-rpms" ] && [ "$(ls -A new-rpms)" ]; then
190210
# Copy x86_64 RPMs
191211
find new-rpms -type f \( -name "*x86_64*.rpm" -o -name "*amd64*.rpm" -o -name "*linux-x64*.rpm" \) -exec cp {} rpm-repo/x86_64/ \; || echo "No x86_64 RPMs to copy"
192212
193213
# Copy aarch64 RPMs
194214
find new-rpms -type f \( -name "*aarch64*.rpm" -o -name "*arm64*.rpm" -o -name "*linux-aarch64*.rpm" \) -exec cp {} rpm-repo/aarch64/ \; || echo "No aarch64 RPMs to copy"
195215
216+
# Copy armv7hl RPMs
217+
find new-rpms -type f \( -name "*armv7*.rpm" -o -name "*armhf*.rpm" -o -name "*linux-armv7*.rpm" \) -exec cp {} rpm-repo/armv7hl/ \; || echo "No armv7hl RPMs to copy"
218+
196219
echo "Copied RPM files:"
197220
echo "x86_64 RPMs:"
198221
ls -la rpm-repo/x86_64/ || echo "No x86_64 RPMs"
199222
echo "aarch64 RPMs:"
200223
ls -la rpm-repo/aarch64/ || echo "No aarch64 RPMs"
224+
echo "armv7hl RPMs:"
225+
ls -la rpm-repo/armv7hl/ || echo "No armv7hl RPMs"
201226
else
202227
echo "No RPM artifacts downloaded"
203228
fi
@@ -223,6 +248,15 @@ jobs:
223248
echo "No aarch64 RPMs found, skipping metadata generation"
224249
fi
225250
251+
# Generate metadata for armv7hl
252+
if [ -d "armv7hl" ] && [ "$(ls -A armv7hl/*.rpm 2>/dev/null)" ]; then
253+
echo "Generating metadata for armv7hl RPMs..."
254+
createrepo_c armv7hl/ --update
255+
echo "armv7hl metadata generated successfully"
256+
else
257+
echo "No armv7hl RPMs found, skipping metadata generation"
258+
fi
259+
226260
- name: Create repo file
227261
run: |
228262
cat > rpm-repo/eim.repo << EOF

0 commit comments

Comments
 (0)