-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (75 loc) · 2.31 KB
/
snap-ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Snap CI
on:
schedule:
- cron: "20 2 * * 1" # Monday mornings 02:20 UTC
push:
branches: [main]
pull_request:
branches: [main]
# Allow manual trigger
workflow_dispatch:
jobs:
matrix-build:
strategy:
matrix:
runs:
- architecture: amd64
runner: ubuntu-latest
- architecture: arm64
runner: [self-hosted, ARM64, Linux]
runs-on: ${{ matrix.runs.runner }}
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: chip-tool_${{ github.run_number}}_${{matrix.runs.architecture}}
path: ${{ steps.snapcraft.outputs.snap }}
if-no-files-found: error
- uses: snapcore/action-publish@v1
if: github.ref == 'refs/heads/main'
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: latest/edge
- 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: ../${{ steps.snapcraft.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_${{ github.run_number}}_${{matrix.runs.architecture}}
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: [matrix-build]
steps:
- name: Install Snapcraft
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 --to-channel latest/beta