-
Notifications
You must be signed in to change notification settings - Fork 102
174 lines (149 loc) · 4.91 KB
/
test.yml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI
on:
push:
tags:
- v*
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Retrieve cache
id: cache-key
uses: actions/cache@v4
with:
path: packer-builder-arm
key: key-${{ github.sha }}-1
- name: Checkout
if: steps.cache-key.outputs.cache-hit != 'true'
uses: actions/[email protected]
- name: Set up Go 1.21
if: steps.cache-key.outputs.cache-hit != 'true'
uses: actions/[email protected]
with:
go-version: '1.21'
id: go
- name: Get dependencies
if: steps.cache-key.outputs.cache-hit != 'true'
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
if: steps.cache-key.outputs.cache-hit != 'true'
run: go build -v .
- name: Cache binary
if: steps.cache-key.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: packer-builder-arm
key: key-${{ github.sha }}-1
test:
needs: compile
strategy:
fail-fast: false
matrix:
boards:
#- bananapi-r1/archlinuxarm.json
- beaglebone-black/angstrom.json
- beaglebone-black/archlinuxarm.json
- beaglebone-black/debian.json
- beaglebone-black/ubuntu.pkr.hcl
#- jetson-nano/ubuntu.json
- odroid-u3/archlinuxarm.json
- odroid-xu4/archlinuxarm.json
- odroid-xu4/ubuntu.json
- parallella/archlinuxarm.json
- parallella/ubuntu.json
- raspberry-pi/archlinuxarm.json
- raspberry-pi/raspbian.json
- raspberry-pi/raspbian-resize.json
- raspberry-pi/raspios-lite-arm.json
- raspberry-pi-3/archlinuxarm.json
- raspberry-pi-3/raspios-lite-arm64.json
- raspberry-pi-4/ubuntu_server_20.04_arm64.json
- raspberry-pi-4/ubuntu_server_20.04_arm64.pkr.hcl
- raspberry-pi-4/archlinuxarm.pkr.hcl
- rock-4b/debos-radxa.pkr.hcl
- wandboard/archlinuxarm.json
name: Build ${{ matrix.boards }} image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Fetch additional packages
run: |
sudo apt-get update
sudo apt-get install fdisk gdisk qemu-user-static libarchive-tools tar qemu qemu-utils
- name: Install Packer
uses: hashicorp-contrib/setup-packer@v3
with:
packer-version: 1.10.0
- name: Retrieve cache
uses: actions/cache@v4
with:
path: packer-builder-arm
key: key-${{ github.sha }}-1
- name: Install packer plugins
if: ${{ endsWith(matrix.boards, '.hcl') }}
run: PACKER_LOG=1 packer init boards/${{ matrix.boards }}
- name: Validate
run: PACKER_LOG=1 packer validate boards/${{ matrix.boards }}
- name: Build image
run: sudo PACKER_LOG=1 packer build boards/${{ matrix.boards }}
test-vagrant:
needs: compile
runs-on: macos-12
name: Build board with vagrant
steps:
- name: Check GitHub Status
uses: crazy-max/ghaction-github-status@v4
- uses: actions/[email protected]
- name: Cache Vagrant boxes
uses: actions/cache@v4
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Show Vagrant version
run: vagrant --version
- name: Install Vagrant plugins
run: |
vagrant plugin install vagrant-disksize
- name: Run vagrant up
run: |
vagrant up
- name: Upload source
run: |
git archive -o repo.tar.gz HEAD
vagrant upload repo.tar.gz /home/vagrant/repo.tar.gz
vagrant ssh -c " \
rm -rf packer-builder-arm && \
mkdir packer-builder-arm && \
tar -xf repo.tar.gz -C packer-builder-arm \
"
- name: Retrieve cache
uses: actions/cache@v4
with:
path: packer-builder-arm
key: key-${{ github.sha }}-1
- name: Upload packer-build-arm binary
run: |
vagrant upload packer-builder-arm /home/vagrant/packer-builder-arm/packer-builder-arm
- name: Build board
run: |
vagrant ssh -c " \
cd packer-builder-arm && \
sudo PACKER_LOG=1 packer build boards/raspberry-pi-3/archlinuxarm.json \
"
- name: Check result
run: |
vagrant ssh -c "ls -al packer-builder-arm/raspberry-pi-3.img"