Skip to content

Commit e08c9d8

Browse files
committed
test: build local spread binary
Don't rely on GitHub runners providing a (potentially outdated) spread binary. Instead, check out a reference version and build a local binary to be used in the github CI test. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
1 parent ae28479 commit e08c9d8

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

.github/workflows/test.yaml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,33 @@ on:
1111

1212
jobs:
1313
run-tests:
14-
runs-on: self-hosted
14+
#runs-on: [self-hosted, spread-enabled]
15+
runs-on: [self-hosted]
1516
steps:
1617
- uses: actions/checkout@v4
1718

18-
- name: Run tests
19+
- name: Run unit tests
1920
run: |
20-
spread google:
21+
sudo snap install go --classic
22+
go test -v ./...
23+
24+
- name: Build local spread
25+
run: |
26+
mkdir spread-testing
27+
cd spread-testing
28+
git init
29+
git remote add origin https://github.com/canonical/spread.git
30+
git fetch --depth=1 origin ae284792596e00d325a1787604fe4ec7e00574aa
31+
git checkout FETCH_HEAD
32+
go build -o spread-testing ./cmd/spread
33+
sudo cp spread-testing /usr/bin/spread
34+
35+
- name: Run spread tests
36+
run: |
37+
trap "rm -f secret.txt" EXIT
38+
echo "${{ secrets.SPREAD_GOOGLE_KEY }}" > .secret.txt
39+
/usr/bin/spread google:
40+
env:
2141

2242
- name: Discard spread workers
2343
if: always()

spread.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ environment:
1616

1717
backends:
1818
google:
19-
key: "$(HOST: echo $SPREAD_GOOGLE_KEY)"
19+
key: "$(HOST: cat .secret.txt)"
2020
location: snapd-spread/us-east1-b
2121
halt-timeout: 2h
2222
systems:

0 commit comments

Comments
 (0)