From c31edfd35e905f03dd30e7fdb0689663bf856ee9 Mon Sep 17 00:00:00 2001 From: Yanks Yoon <37652070+yanksyoon@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:28:58 +0800 Subject: [PATCH] feat: arm64 arch support for snap (#7) * feat: arm64 arch support for snap * fix: build go from source * feat: upload snap ci * fix: create parts dir before copy * ci: publish multiarch snap * Update snap/snapcraft.yaml Co-authored-by: Weii Wang --------- Co-authored-by: Weii Wang --- .github/workflows/integration-tests.yaml | 8 +++++++- .github/workflows/publish.yaml | 11 ++++++----- snap/snapcraft.yaml | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 6904bbf..a3f7938 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -16,9 +16,15 @@ jobs: id: snapcraft-build uses: snapcore/action-build@v1 + - name: Upload Aproxy Snap + uses: actions/upload-artifact@v3 + with: + name: snap + path: aproxy*.snap + - name: Install Aproxy Snap run: | - sudo snap install --dangerous ${{ steps.snapcraft-build.outputs.snap }} + sudo snap install --dangerous aproxy_*_amd64.snap - name: Configure Aproxy run: | diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 97cc60f..df52c96 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -27,12 +27,13 @@ jobs: uses: actions/upload-artifact@v3 with: name: snap - path: ${{ steps.snapcraft-build.outputs.snap }} + path: aproxy*.snap - name: Publish Aproxy - uses: snapcore/action-publish@v1 env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} - with: - snap: ${{ steps.snapcraft-build.outputs.snap }} - release: edge \ No newline at end of file + run: | + for snap in aproxy*.snap + do + snapcraft upload $snap --release edge + done diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a092eff..6a5e9cb 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -12,6 +12,11 @@ license: Apache-2.0 base: core22 grade: stable confinement: strict +architectures: + - build-on: amd64 + build-for: amd64 + - build-on: amd64 + build-for: arm64 apps: aproxy: @@ -23,11 +28,19 @@ apps: - network-bind parts: - pollen: - plugin: go + aproxy: + plugin: nil source: . build-snaps: - go + override-build: | + snapcraftctl build + export GOARCH=$SNAPCRAFT_TARGET_ARCH + export CGO_ENABLED=0 + go mod download + go build -ldflags="-w -s" + mkdir ${SNAPCRAFT_PART_INSTALL}/bin + cp aproxy ${SNAPCRAFT_PART_INSTALL}/bin install-start-script: plugin: dump source: ./snap/local