-
Notifications
You must be signed in to change notification settings - Fork 7
78 lines (63 loc) · 2.25 KB
/
buildAndTest.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
name: Build and Test
on:
workflow_dispatch:
push:
branches:
- "*"
pull_request:
branches:
- "master"
- "develop"
jobs:
build:
runs-on: ubuntu-latest
env:
GO_VERSION: 1.23.0
GOLANGCI_LINT_VERSION: v1.61.0
YAEGI_VERSION: v0.16.1
GOPATH: ${{ github.workspace }}/go
CGO_ENABLED: 0
defaults:
run:
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
with:
path: go/src/github.com/${{ github.repository }}
fetch-depth: 0
- name: Build Cloudflare IPs
run: bash updateCFIps.sh
- name: Setup GOPATH
run: go env -w GOPATH=${{ github.workspace }}/go
# https://golangci-lint.run/usage/install#other-ci
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${{ github.workspace }}/go/bin ${GOLANGCI_LINT_VERSION}
# working-directory: ${{ github.workspace }}
- name: Install Yaegi ${{ env.YAEGI_VERSION }}
run: curl -sfL https://raw.githubusercontent.com/traefik/yaegi/master/install.sh | bash -s -- -b ${{ github.workspace }}/go/bin ${YAEGI_VERSION}
# working-directory: ${{ github.workspace }}
- name: Format code
run: gofmt -l -d ./ips/* ; gofmt -l -d ./*.go
- name: Lint Code
run: ${{ github.workspace }}/go/bin/golangci-lint run
- name: Test Code
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./*_test.go
env:
CGO_ENABLED: 1
- name: Run tests with Yaegi
run: ${{ github.workspace }}/go/bin/yaegi test .
- uses: codecov/codecov-action@v2
- name: Test With Traefik
run: cd test; bash test.sh
- name: Upload log artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
if-no-files-found: error
path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/test/logs-*
retention-days: 1