Skip to content

Commit 9825cbc

Browse files
committed
Add vagrant test workflow, enable handling qemu binaries being symlinks
1 parent 901d1bf commit 9825cbc

File tree

2 files changed

+69
-10
lines changed

2 files changed

+69
-10
lines changed
Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: All
1+
name: CI
22
on:
33
push:
44
branches:
@@ -51,7 +51,7 @@ jobs:
5151
path: packer-builder-arm
5252
key: key-${{ github.sha }}-1
5353

54-
build:
54+
test:
5555
needs: compile
5656
strategy:
5757
fail-fast: false
@@ -112,3 +112,60 @@ jobs:
112112
113113
- name: Build image
114114
run: sudo ./packer build boards/${{ matrix.boards }}
115+
116+
test-vagrant:
117+
needs: compile
118+
runs-on: macos-10.15
119+
name: Build board with vagrant
120+
steps:
121+
- uses: actions/checkout@v3.1.0
122+
123+
- name: Cache Vagrant boxes
124+
uses: actions/cache@v3
125+
with:
126+
path: ~/.vagrant.d/boxes
127+
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
128+
restore-keys: |
129+
${{ runner.os }}-vagrant-
130+
131+
- name: Show Vagrant version
132+
run: vagrant --version
133+
134+
- name: Install Vagrant plugins
135+
run: |
136+
vagrant plugin install vagrant-disksize
137+
138+
- name: Run vagrant up
139+
run: |
140+
vagrant up
141+
142+
- name: Upload source
143+
run: |
144+
git archive -o repo.tar.gz HEAD
145+
vagrant upload repo.tar.gz /home/vagrant/repo.tar.gz
146+
vagrant ssh -c " \
147+
rm -rf packer-builder-arm && \
148+
mkdir packer-builder-arm && \
149+
tar -xf repo.tar.gz -C packer-builder-arm \
150+
"
151+
152+
- name: Retrieve cache
153+
uses: actions/cache@v3
154+
with:
155+
path: packer-builder-arm
156+
key: key-${{ github.sha }}-1
157+
158+
- name: Upload packer-build-arm binary
159+
run: |
160+
vagrant upload packer-builder-arm /home/vagrant/packer-builder-arm/packer-builder-arm
161+
162+
- name: Build board
163+
run: |
164+
vagrant ssh -c " \
165+
cd packer-builder-arm && \
166+
sudo packer build boards/raspberry-pi-3/archlinuxarm.json \
167+
"
168+
169+
- name: Check result
170+
run: |
171+
vagrant ssh -c "ls -al packer-builder-arm/raspberry-pi-3.img"

Vagrantfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66
# backwards compatibility). Please don't change it unless you know what
77
# you're doing.
88
Vagrant.configure("2") do |config|
9-
config.vm.box = "ubuntu/focal64"
9+
config.vm.box = "ubuntu/jammy64"
1010
config.disksize.size = '40GB'
1111

1212
config.vm.provision "shell", inline: <<-SHELL
13+
set -o errtrace -o nounset -o pipefail -o errexit
1314
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
1415
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
1516
1617
apt-get update
17-
apt-get install -y git golang qemu-user-static packer libarchive-tools
18-
rm -rf packer-builder-arm *>/dev/null
18+
apt-get install -y qemu-user-static packer libarchive-tools
19+
#apt-get install -y git golang
20+
#rm -rf packer-builder-arm *>/dev/null
1921
20-
git clone https://github.com/mkaczanowski/packer-builder-arm
21-
cd packer-builder-arm
22-
go mod download
23-
go build
22+
#git clone https://github.com/mkaczanowski/packer-builder-arm
23+
#cd packer-builder-arm
24+
#go mod download
25+
#go build
2426
25-
packer build boards/raspberry-pi-3/archlinuxarm.json
27+
#packer build boards/raspberry-pi-3/archlinuxarm.json
2628
SHELL
2729
end

0 commit comments

Comments
 (0)