1313 - ' go.sum'
1414jobs :
1515
16- test-linux :
17- name : Build all and test on ubuntu-linux
16+ static :
17+ name : Static checks
1818 runs-on : ubuntu-latest
1919 steps :
2020
2525 go-version : ' 1.25'
2626 check-latest : true
2727
28- - name : Build
29- run : make all
28+ - name : Install goimports
29+ run : go install golang.org/x/tools/cmd/goimports@latest
30+
31+ - name : gofmt
32+ run : |
33+ if [ "$(find . -iname '*.go' | grep -v '\.pb\.go$' | xargs goimports -l)" ]
34+ then
35+ find . -iname '*.go' | grep -v '\.pb\.go$' | xargs goimports -d
36+ exit 1
37+ fi
3038
3139 - name : Vet
3240 run : make vet
@@ -36,24 +44,38 @@ jobs:
3644 with :
3745 version : v2.5
3846
39- - name : Test
40- run : make test
41-
42- - name : End 2 end
43- run : make e2evv
44-
45- - name : Build test mobile
46- run : make build-test-mobile
47-
48- - uses : actions/upload-artifact@v7
49- with :
50- name : e2e packet flow linux-latest
51- path : e2e/mermaid/linux-latest
52- if-no-files-found : warn
53-
54- test-linux-boringcrypto :
55- name : Build and test on linux with boringcrypto
56- runs-on : ubuntu-latest
47+ test :
48+ name : Test ${{ matrix.name }}
49+ runs-on : ${{ matrix.os }}
50+ strategy :
51+ fail-fast : false
52+ matrix :
53+ include :
54+ - name : linux
55+ os : ubuntu-latest
56+ build-cmd : go build ./cmd/nebula ./cmd/nebula-cert
57+ test-cmd : make test
58+ e2e-cmd : make e2evv
59+ - name : linux-boringcrypto
60+ os : ubuntu-latest
61+ build-cmd : make bin-boringcrypto
62+ test-cmd : make test-boringcrypto
63+ e2e-cmd : make e2e GOEXPERIMENT=boringcrypto CGO_ENABLED=1 TEST_ENV="TEST_LOGS=1" TEST_FLAGS="-v -ldflags -checklinkname=0"
64+ - name : linux-pkcs11
65+ os : ubuntu-latest
66+ build-cmd : make bin-pkcs11
67+ test-cmd : make test-pkcs11
68+ e2e-cmd : ' '
69+ - name : macos
70+ os : macos-latest
71+ build-cmd : go build ./cmd/nebula ./cmd/nebula-cert
72+ test-cmd : make test
73+ e2e-cmd : make e2evv
74+ - name : windows
75+ os : windows-latest
76+ build-cmd : go build ./cmd/nebula ./cmd/nebula-cert
77+ test-cmd : make test
78+ e2e-cmd : make e2evv
5779 steps :
5880
5981 - uses : actions/checkout@v6
@@ -64,38 +86,41 @@ jobs:
6486 check-latest : true
6587
6688 - name : Build
67- run : make bin-boringcrypto
89+ run : ${{ matrix.build-cmd }}
90+
91+ - name : Cross-build darwin-amd64
92+ if : matrix.name == 'macos'
93+ run : GOARCH=amd64 go build -o /tmp/nebula-amd64 ./cmd/nebula && GOARCH=amd64 go build -o /tmp/nebula-cert-amd64 ./cmd/nebula-cert
6894
6995 - name : Test
70- run : make test-boringcrypto
96+ run : ${{ matrix. test-cmd }}
7197
7298 - name : End 2 end
73- run : make e2e GOEXPERIMENT=boringcrypto CGO_ENABLED=1 TEST_ENV="TEST_LOGS=1" TEST_FLAGS="-v -ldflags -checklinkname=0"
74-
75- test-linux-pkcs11 :
76- name : Build and test on linux with pkcs11
77- runs-on : ubuntu-latest
78- steps :
79-
80- - uses : actions/checkout@v6
99+ if : matrix.e2e-cmd != ''
100+ run : ${{ matrix.e2e-cmd }}
81101
82- - uses : actions/setup-go@v6
102+ - uses : actions/upload-artifact@v7
103+ if : matrix.e2e-cmd != '' && always()
83104 with :
84- go-version : ' 1.25'
85- check-latest : true
86-
87- - name : Build
88- run : make bin-pkcs11
89-
90- - name : Test
91- run : make test-pkcs11
105+ name : e2e packet flow ${{ matrix.name }}
106+ path : e2e/mermaid/
107+ if-no-files-found : warn
92108
93- test :
94- name : Build and test on ${{ matrix.os }}
95- runs-on : ${{ matrix.os }}
109+ cross-build :
110+ name : Cross-build ${{ matrix.name }}
111+ runs-on : ubuntu-latest
96112 strategy :
113+ fail-fast : false
97114 matrix :
98- os : [windows-latest, macos-latest]
115+ include :
116+ - {name: linux-arm, make-target: all-cross-linux-arm}
117+ - {name: linux-mips, make-target: all-cross-linux-mips}
118+ - {name: linux-other, make-target: all-cross-linux-other}
119+ - {name: freebsd, make-target: all-freebsd}
120+ - {name: openbsd, make-target: all-openbsd}
121+ - {name: netbsd, make-target: all-netbsd}
122+ - {name: windows, make-target: all-cross-windows}
123+ - {name: mobile, make-target: build-test-mobile}
99124 steps :
100125
101126 - uses : actions/checkout@v6
@@ -105,28 +130,21 @@ jobs:
105130 go-version : ' 1.25'
106131 check-latest : true
107132
108- - name : Build nebula
109- run : go build ./cmd/nebula
110-
111- - name : Build nebula-cert
112- run : go build ./cmd/nebula-cert
113-
114- - name : Vet
115- run : make vet
133+ - name : Build ${{ matrix.name }}
134+ run : make -j"$(nproc)" ${{ matrix.make-target }}
116135
117- - name : golangci-lint
118- uses : golangci/golangci-lint-action@v9
119- with :
120- version : v2.5
121-
122- - name : Test
123- run : make test
136+ finish :
137+ name : CI status
138+ if : always()
139+ needs : [static, test, cross-build]
140+ runs-on : ubuntu-latest
141+ steps :
124142
125- - name : End 2 end
126- run : make e2evv
143+ - name : Fail if any upstream job failed
144+ if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
145+ run : |
146+ echo "upstream results: ${{ toJSON(needs) }}"
147+ exit 1
127148
128- - uses : actions/upload-artifact@v7
129- with :
130- name : e2e packet flow ${{ matrix.os }}
131- path : e2e/mermaid/${{ matrix.os }}
132- if-no-files-found : warn
149+ - name : All upstream jobs passed
150+ run : echo "ok"
0 commit comments