ci: use GitHub Linux arm64 runners for the snap build (#2214)

This commit is contained in:
Jon Seager 2025-01-18 10:44:45 +02:00 committed by GitHub
parent 3e1c8950f2
commit ebaf2c29c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 37 deletions

View file

@ -145,43 +145,27 @@ jobs:
path: yazi-${{ matrix.target }}.zip
build-snap:
if: false # Can't make CI pass, disable for now
strategy:
matrix:
arch:
- amd64
- arm64
runs-on: ubuntu-latest
include:
- os: ubuntu-24.04
arch: amd64
- os: ubuntu-24.04
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: canonical/setup-lxd@v0.1.2
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.2
- name: Setup snapcraft
run: |
sudo snap install --classic snapcraft
mkdir -p ~/.local/share/snapcraft
echo "${{ secrets.LP_TOKEN }}" > ~/.local/share/snapcraft/launchpad-credentials
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "Github Actions"
run: sudo snap install --classic snapcraft
- name: Build snap
env:
arch: ${{ matrix.arch }}
run: |
# Modify the `platforms` to use a single arch only, but run this in a matrix so they
# all get hit
yq -i '.platforms |= {env(arch): {"build-on": env(arch)}}' snap/snapcraft.yaml
# Now run a remote-build, targeting just the single arch specified
snapcraft remote-build --launchpad-accept-public-upload
# Output the build logs from the remote-build
cat snapcraft-yazi*.txt || echo "Could not find build log"
run: snapcraft --verbose
- name: Rename snap
run: mv yazi_*.snap yazi-${{ matrix.arch }}.snap

View file

@ -133,9 +133,6 @@ parts:
- usr/lib/libMagickCore-7.Q16HDRI.so*
- usr/lib/libMagickWand-7.Q16HDRI.so*
# Most of what is done here should be done in the `yazi` part, but using
# `override-prime` there stops snapcraft from automatically patching ELF
# binaries (due to a bug), so we do that work here in a separate part.
cleanup:
after: [yazi, magick]
plugin: nil
@ -149,14 +146,6 @@ parts:
# executable at $SNAP/usr/bin/7zz.
mv $CRAFT_PRIME/usr/lib/7zip/7zz $CRAFT_PRIME/usr/bin/7zz
# The snapcraft linter highlighted issues with the rpath of these two libraries,
# so we fix them up manually here after they are primed in the yazi part.
patchelf --force-rpath --set-rpath "\$ORIGIN:\$ORIGIN/pulseaudio:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" $CRAFT_PRIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libpulse.so.0.24.2
patchelf --force-rpath --set-rpath "\$ORIGIN/lapack:\$ORIGIN/blas:\$ORIGIN:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" $CRAFT_PRIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libsphinxbase.so.3.0.0
patchelf --force-rpath --set-rpath "\$ORIGIN/../lib:\$ORIGIN/../lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" $CRAFT_PRIME/usr/bin/magick
patchelf --force-rpath --set-rpath "\$ORIGIN/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" $CRAFT_PRIME/usr/lib/libMagickCore-7.Q16HDRI.so.10.0.2
patchelf --force-rpath --set-rpath "\$ORIGIN:\$ORIGIN/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" $CRAFT_PRIME/usr/lib/libMagickWand-7.Q16HDRI.so.10.0.2
# Ensure we don't ship duplicates of files that exist in the core24
# snap.
cd /snap/core24/current