-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (93 loc) · 3.79 KB
/
go.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
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Go
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: '>=1.23.0'
- name: Check Go Version
run: go version
- name: Link workspace with GOPATH
continue-on-error: false
run: |
sudo mkdir -vp $(dirname ${GOPATH}/src/github.com/${GITHUB_REPOSITORY})
sudo chown -R ${USER}:users $(dirname ${GOPATH}/src/github.com/${GITHUB_REPOSITORY})
sudo chmod ug+rw $(dirname ${GOPATH}/src/github.com/${GITHUB_REPOSITORY})
sudo ln -svf $(pwd) ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}
- name: Check out tools into the Go module directory
continue-on-error: false
run: |
git clone https://github.com/nabbar/gotools.git scripts
./scripts/prepare
- name: Update vendor or dependancies
continue-on-error: false
run: ./scripts/ci_depend
- name: Check goFmt & goImport
continue-on-error: false
run: ./scripts/ci_format
- name: Check Missing License
continue-on-error: false
run: ./scripts/ci_license
- name: Check goLinter
continue-on-error: true
run: ./scripts/ci_linter
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
- name: Check goSecu + snyk.io
continue-on-error: true
run: ./scripts/ci_secu $SNYK_TOKEN
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Check tests
uses: nick-fields/[email protected]
continue-on-error: false
with:
max_attempts: 3
timeout_minutes: 15
command: |
wget --quiet --output-document="aws/minio" "https://dl.min.io/server/minio/release/linux-amd64/minio"
chmod -v +x "aws/minio"
go version
ginkgo version
for PKG in $(find $(pwd) -type f -name "*_suite_test.go" | sort -u );
do
cd $(dirname $PKG);
echo "testing >>> $(basename $(dirname $PKG))";
ginkgo run --cover .
done
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
- name: Add ming-w32 (x86 + win64)
continue-on-error: false
run: sudo apt-get install gcc-multilib gcc-mingw-w64
- name: Test Build Linux/amd64 with suffix/CGO
continue-on-error: false
run: |
IGNORE_BUILD=$(sed '/^[[:space:]]*$/d' "build.$(go env | grep GOARCH | cut -d'=' -f2 | tr -d '"' | tr -d "'")" | tr '\n' '|')
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GOAMD64=v4 go build -a -race -installsuffix cgo -ldflags "-w -s -extldflags '-static' " $(go list ./... | grep -vPi ${IGNORE_BUILD::-1})
- name: Test Build Windows/amd64 with CGO
continue-on-error: false
run: |
IGNORE_BUILD=$(sed '/^[[:space:]]*$/d' "build.$(go env | grep GOARCH | cut -d'=' -f2 | tr -d '"' | tr -d "'")" | tr '\n' '|')
CC=/usr/bin/x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 GOAMD64=v4 go build -a -ldflags "-w -s -extldflags '-static' " $(go list ./... | grep -vPi ${IGNORE_BUILD::-1})
- name: Test Build Darwin/arm64 with suffix/CGO
continue-on-error: false
run: |
IGNORE_BUILD=$(sed '/^[[:space:]]*$/d' "build.$(go env | grep GOARCH | cut -d'=' -f2 | tr -d '"' | tr -d "'")" | tr '\n' '|')
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 GOAMD64=v1 go build -a -ldflags "-w -s -extldflags '-static' " $(go list ./... | grep -vPi ${IGNORE_BUILD::-1})