Skip to content

Commit 4997c15

Browse files
committed
BUILD/MINOR: github: update pull request validation
1 parent af4cb66 commit 4997c15

5 files changed

Lines changed: 104 additions & 31 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: go build
1+
name: build and test
22
on:
33
pull_request:
44
branches:
@@ -10,14 +10,64 @@ jobs:
1010
steps:
1111
- name: Check out code
1212
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
1315
- name: Set up Go
1416
uses: actions/setup-go@v5
1517
with:
1618
go-version-file: 'go.mod'
17-
id: go
18-
- name: Get dependencies
19-
run: |
20-
go get -v -t -d ./...
19+
- name: Verify dependencies
20+
run: go mod verify
2121
- name: Build
22+
run: make build
23+
- name: Upload binary
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: dataplaneapi
27+
path: build/dataplaneapi
28+
retention-days: 1
29+
test:
30+
name: Unit tests
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Check out code
34+
uses: actions/checkout@v4
35+
- name: Set up Go
36+
uses: actions/setup-go@v5
37+
with:
38+
go-version-file: 'go.mod'
39+
- name: Test
40+
run: make test
41+
e2e:
42+
name: HAProxy ${{ matrix.haproxy_version }} (${{ matrix.testpart }})
43+
needs: build
44+
strategy:
45+
matrix:
46+
haproxy_version: ["3.4"]
47+
testpart: ["1/4", "2/4", "3/4", "4/4"]
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Check out code
51+
uses: actions/checkout@v4
52+
- name: Install Bats
53+
run: |
54+
git clone --depth 1 --branch v1.10.0 https://github.com/bats-core/bats-core.git "$RUNNER_TEMP/bats-core"
55+
sudo "$RUNNER_TEMP/bats-core/install.sh" /usr/local
56+
- name: Download binary
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: dataplaneapi
60+
path: build
61+
- name: Run E2E tests
2262
run: |
23-
go build -v .
63+
chmod +x build/dataplaneapi
64+
bash ./e2e/run.bash
65+
env:
66+
HAPROXY_VERSION: ${{ matrix.haproxy_version }}
67+
TESTPART: ${{ matrix.testpart }}
68+
- name: Upload failure logs
69+
if: failure()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: e2e-logs-${{ strategy.job-index }}
73+
path: e2e/logs/

‎.github/workflows/check.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ jobs:
77
check:
88
runs-on: ubuntu-latest
99
steps:
10+
- name: Check out code
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
1014
- name: commit-policy
11-
uses: docker://ghcr.io/haproxytech/commit-check:5.0.4
15+
uses: docker://ghcr.io/haproxytech/commit-check:5.8.1
1216
env:
1317
API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/e2e.yml‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎.github/workflows/lint.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ on:
44
branches:
55
- master
66
jobs:
7+
diff:
8+
name: Generated code
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
- name: Set up Go
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version-file: 'go.mod'
17+
- name: Install swagger
18+
run: |
19+
SWAGGER_VERSION=$(curl -fsSL https://raw.githubusercontent.com/haproxytech/client-native/master/Makefile | grep '^SWAGGER_VERSION=' | cut -d= -f2)
20+
curl -fsSL "https://github.com/go-swagger/go-swagger/releases/download/${SWAGGER_VERSION}/swagger_linux_amd64" -o "$RUNNER_TEMP/swagger"
21+
chmod +x "$RUNNER_TEMP/swagger"
22+
printf '%s\n' "$RUNNER_TEMP" >> "$GITHUB_PATH"
23+
- name: Generate code
24+
run: |
25+
make generate-native
26+
make specification
27+
- name: Check generated code
28+
run: |
29+
git diff --exit-code
30+
test -z "$(git ls-files --others --exclude-standard)"
731
gofumpt:
832
name: gofumpt
933
runs-on: ubuntu-latest

‎.github/workflows/vuln.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: govulncheck
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
govulncheck:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out code
11+
uses: actions/checkout@v4
12+
- name: Set up Go
13+
uses: actions/setup-go@v5
14+
with:
15+
go-version-file: 'go.mod'
16+
- name: Install govulncheck
17+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
18+
- name: Check vulnerabilities
19+
run: govulncheck ./...

0 commit comments

Comments
 (0)