-
Notifications
You must be signed in to change notification settings - Fork 16
139 lines (122 loc) · 3.4 KB
/
ci.yaml
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
name: CI
on:
merge_group:
pull_request:
paths-ignore:
- 'DCO'
- 'LICENSE'
- 'README.md'
branches:
- "main"
- "v**"
workflow_dispatch:
jobs:
static-security-analysis:
runs-on: ubuntu-22.04
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v3
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude-dir e2etest -severity medium ./...
- name: Golang Vulncheck
uses: Templum/[email protected]
with:
skip-upload: true
commitlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
unit-tests:
runs-on: ubuntu-22.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
cache: true
- name: Unit Tests
run: |
make test
- name: Lint
run: |
ENV=host make lint
make bumplicense
go mod tidy
make manifests
make checkuncommitted
build-test-images:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Setup docker buildx
uses: docker/setup-buildx-action@v2
- name: Build and export the image
uses: docker/build-push-action@v4
with:
context: .
tags: quay.io/metallb/frrk8s:dev-amd64
file: Dockerfile
outputs: type=docker,dest=/tmp/frrk8s.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload frrk8s artifact
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: image-tar-frrk8s
path: /tmp/frrk8s.tar
e2e:
runs-on: ubuntu-22.04
needs:
- unit-tests
- build-test-images
- commitlint
strategy:
fail-fast: false
matrix:
ip-family: [ipv4, ipv6, dual]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install kernel modules
run: |
sudo apt-get update
sudo apt-get install linux-modules-extra-$(uname -r)
- name: Download frr8ks images
uses: actions/download-artifact@v3
with:
path: image
- name: Load image
working-directory: image
run: |
docker load -i image-tar-frrk8s/frrk8s.tar
- name: Deploy on kind
run: |
IP_FAMILY="${{ matrix.ip-family }}" IMG=quay.io/metallb/frrk8s:dev-amd64 make deploy
- name: E2E
run: |
SKIP="none"
if [ "${{ matrix.ip-family }}" == "ipv4" ]; then SKIP="$SKIP\|IPV6\|DUALSTACK"; fi
if [ "${{ matrix.ip-family }}" == "dual" ]; then SKIP="$SKIP\|IPV6"; fi
if [ "${{ matrix.ip-family }}" == "ipv6" ]; then SKIP="$SKIP\|IPV4\|DUALSTACK"; fi
GINKGO_ARGS="--skip $SKIP" make e2etests
- name: Collect Logs
if: ${{ failure() }}
uses: ./.github/workflows/composite/collectlogs
with:
artifact-name: kind-logs-${{ matrix.ip-family }}