Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM64 build on native runner #80

Closed
wants to merge 11 commits into from
106 changes: 106 additions & 0 deletions .github/workflows/build-amd64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Snap CI AMD64

on:
# schedule:
# - cron: "20 2 * * 1" # Monday morning 02:20 UTC
# push:
# branches: [main]
# pull_request:
# branches: [main]
# Allow manual trigger
workflow_dispatch:

env:
ARTIFACT_AMD64: chip-tool_${{ github.run_number}}_amd64

jobs:
build:
outputs:
snap: ${{ steps.snapcraft.outputs.snap }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build snap
uses: snapcore/action-build@v1
id: snapcraft

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_AMD64 }}
path: ${{ steps.snapcraft.outputs.snap }}
if-no-files-found: error

publish-edge:
# Only publish if we are on the main branch
# if: github.ref == 'refs/heads/main'
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download locally built snap
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_AMD64 }}

- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ needs.build.outputs.snap }}
release: latest/edge/test

test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download locally built snap
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_AMD64 }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.*"
cache: false

- name: Run tests
shell: bash
working-directory: tests
env:
SKIP_TEARDOWN_REMOVAL: true
LOCAL_SERVICE_SNAP: ../${{ needs.build.outputs.snap }}
run: |
go test -failfast -p 1 -timeout 30m -v

- name: Upload snap logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: tests/logs/*.log

promote-beta:
# Only promote if we are on the main branch
# if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [test, publish-edge]
steps:
- name: Install Snapcraft
# Install snapcraft and add it to PATH
run: |
sudo snap install snapcraft --classic
echo /snap/bin >> $GITHUB_PATH
shell: bash

- name: Promote Snap
env: # Workaround for https://github.com/snapcore/snapcraft/issues/4439
SNAPCRAFT_HAS_TTY: "true"
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
run: |
yes | snapcraft promote chip-tool --from-channel latest/edge/test --to-channel latest/beta/test
134 changes: 0 additions & 134 deletions .github/workflows/build-and-test-snap.yml

This file was deleted.

106 changes: 106 additions & 0 deletions .github/workflows/build-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Snap CI ARM64

on:
# schedule:
# - cron: "20 2 * * 1" # Monday morning 02:20 UTC
# push:
# branches: [main]
# pull_request:
# branches: [main]
# Allow manual trigger
workflow_dispatch:

env:
ARTIFACT_ARM64: chip-tool_${{ github.run_number}}_arm64

jobs:
build:
outputs:
snap: ${{ steps.snapcraft.outputs.snap }}
runs-on: [self-hosted, ARM64, Linux]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build Snap
uses: snapcore/action-build@v1
id: snapcraft

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_ARM64 }}
path: ${{ steps.snapcraft.outputs.snap }}
if-no-files-found: error

publish-edge:
# Only publish if we are on the main branch
# if: github.ref == 'refs/heads/main'
needs: [build]
runs-on: [self-hosted, ARM64, Linux]
steps:
- name: Download locally built snap
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_ARM64 }}

- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ needs.build.outputs.snap }}
release: latest/edge/test

test:
needs: build
runs-on: [self-hosted, ARM64, Linux]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download locally built snap
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_ARM64 }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.*"
cache: false

- name: Run tests
shell: bash
working-directory: tests
env:
SKIP_TEARDOWN_REMOVAL: true
LOCAL_SERVICE_SNAP: ../${{ needs.build.outputs.snap }}
run: |
go test -failfast -p 1 -timeout 30m -v

- name: Upload snap logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: tests/logs/*.log

promote-beta:
# Only promote if we are on the main branch
# if: github.ref == 'refs/heads/main'
runs-on: [self-hosted, ARM64, Linux]
needs: [test, publish-edge]
steps:
- name: Install Snapcraft
# Install snapcraft and add it to PATH
run: |
sudo snap install snapcraft --classic
echo /snap/bin >> $GITHUB_PATH
shell: bash

- name: Promote Snap
env: # Workaround for https://github.com/snapcore/snapcraft/issues/4439
SNAPCRAFT_HAS_TTY: "true"
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
run: |
yes | snapcraft promote chip-tool --from-channel latest/edge/test --to-channel latest/beta/test
Loading
Loading