From 2e49ba1add4a5b2e7cf778957c6a189ba537bc2a Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Sat, 11 Jan 2025 09:33:11 +0000 Subject: [PATCH] ci(snap): enable snapcraft build across platforms --- .github/workflows/draft.yml | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml index 3cb16b6a..4ac16449 100644 --- a/.github/workflows/draft.yml +++ b/.github/workflows/draft.yml @@ -145,12 +145,11 @@ jobs: path: yazi-${{ matrix.target }}.zip build-snap: - if: false # Can't make CI pass, disable for now strategy: matrix: - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu + arch: + - amd64 + - arm64 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -158,8 +157,32 @@ jobs: - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - - name: Build - uses: snapcore/action-build@v1 + - name: Setup LXD + uses: canonical/setup-lxd@v1 + + - 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" + + - 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-${name}*${arch}*.txt || echo "Could not find build log" - name: Rename snap run: mv yazi_*.snap yazi-${{ matrix.target }}.snap