-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (81 loc) · 2.44 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
name: Run tests
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
jobs:
test:
name: Run unit and integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Go tests
run: go test ./... -tags=unit
- name: Run integration tests
run: |
go install
go test ./... -tags=integration
container-test:
name: Run provisioning in a container
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: [ubuntu]
container:
image: femnad/fup:${{ matrix.image }}-ci
steps:
- uses: actions/checkout@v4
- name: Setup container
run: |
# https://github.com/golang/go/issues/53532
go install -buildvcs=false
cd cmd
go build -buildvcs=false -o fup-verify
cp fup-verify ~/go/bin
- name: Provision
run: |
~/go/bin/fup -f tests/config/test.yml -l 0 -n -b
- name: Verify
run: |
~/go/bin/fup-verify -c tests/config/test.yml -f tests/config/verify-test.yml
container-remote-config-test:
name: Run provisioning in a container via a remote config
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: [ubuntu]
container:
image: femnad/fup:${{ matrix.image }}-ci
steps:
- uses: actions/checkout@v4
- name: Setup container
run: |
# https://github.com/golang/go/issues/53532
go install -buildvcs=false
cd cmd
go build -buildvcs=false -o fup-verify
cp fup-verify ~/go/bin
- name: Get branch
id: get-branch
run: |
event="${{ github.event_name }}"
head_ref="${{ github.head_ref }}"
ref_name="${{ github.ref_name }}"
if [ "$event" = 'pull_request' ]
then
branch="$head_ref"
else
branch="$ref_name"
fi
echo "branch=${branch}" >> "$GITHUB_OUTPUT"
- name: Provision
run: |
~/go/bin/fup -f https://raw.githubusercontent.com/femnad/fup/${{ steps.get-branch.outputs.branch }}/tests/config/test-remote.yml -l 0 -n -b
- name: Verify
run: |
~/go/bin/fup-verify -c https://raw.githubusercontent.com/femnad/fup/${{ steps.get-branch.outputs.branch }}/tests/config/test-remote.yml -f tests/config/verify-test-remote.yml