Skip to content

Commit

Permalink
feat: arm64 arch support for snap (#7)
Browse files Browse the repository at this point in the history
* 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 <weii.wang@canonical.com>

---------

Co-authored-by: Weii Wang <weii.wang@canonical.com>
  • Loading branch information
yanksyoon and weiiwang01 authored Nov 30, 2023
1 parent 50782a7 commit c31edfd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
run: |
for snap in aproxy*.snap
do
snapcraft upload $snap --release edge
done
17 changes: 15 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit c31edfd

Please sign in to comment.