-
Notifications
You must be signed in to change notification settings - Fork 63
159 lines (150 loc) · 7.2 KB
/
ci-test.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
on: [push, pull_request]
name: Run Test Cases
jobs:
go-path-test:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
path: src/github.com/qiniu/go-sdk
ref: ${{ github.ref }}
submodules: recursive
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.10'
- name: Run unit cases
run: |
set -ex
rm -rf $GITHUB_WORKSPACE/src/github.com/qiniu/x && git clone -b v1.12.21 --depth 1 https://github.com/qiniu/x.git $GITHUB_WORKSPACE/src/github.com/qiniu/x
GOPATH=$GITHUB_WORKSPACE go get github.com/qiniu/dyn
rm -rf $GITHUB_WORKSPACE/src/github.com/gofrs/flock && git clone -b v0.8.1 --depth 1 https://github.com/gofrs/flock $GITHUB_WORKSPACE/src/github.com/gofrs/flock
GOPATH=$GITHUB_WORKSPACE go get github.com/alex-ant/gomath/rational
GOPATH=$GITHUB_WORKSPACE go get github.com/gammazero/toposort
GOPATH=$GITHUB_WORKSPACE go get github.com/joeshaw/multierror
# FIXME special package
# github.com/go-playground/validator/v10
# validator modified package name
# from gopkg.in/go-playground/validator.v10 to github.com/go-playground/validator/v10
# new package name don't work in non-module mode
rm -rf $GITHUB_WORKSPACE/src/github.com/go-playground/validator/v10 && git clone -b v10.9.0 --depth 1 https://github.com/go-playground/validator.git $GITHUB_WORKSPACE/src/github.com/go-playground/validator/v10
rm -rf $GITHUB_WORKSPACE/src/github.com/universal-translator && git clone -b v0.18.0 --depth 1 https://github.com/go-playground/universal-translator.git $GITHUB_WORKSPACE/src/github.com/go-playground/universal-translator
rm -rf $GITHUB_WORKSPACE/src/github.com/elastic/go-sysinfo && git clone -b v1.0.2 --depth 1 https://github.com/elastic/go-sysinfo.git $GITHUB_WORKSPACE/src/github.com/elastic/go-sysinfo
rm -rf $GITHUB_WORKSPACE/src/github.com/pkg/errors && git clone -b v0.9.1 --depth 1 https://github.com/pkg/errors.git $GITHUB_WORKSPACE/src/github.com/pkg/errors
rm -rf $GITHUB_WORKSPACE/src/github.com/prometheus/procfs && git clone -b v0.0.6 --depth 1 https://github.com/prometheus/procfs.git $GITHUB_WORKSPACE/src/github.com/prometheus/procfs
rm -rf $GITHUB_WORKSPACE/src/howett.net/plist && git clone -b v1.0.0 --depth 1 https://github.com/DHowett/go-plist.git $GITHUB_WORKSPACE/src/howett.net/plist
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/sys && git clone -b v0.12.0 --depth 1 https://github.com/golang/sys $GITHUB_WORKSPACE/src/golang.org/x/sys
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/crypto && git clone -b v0.10.0 --depth 1 https://go.googlesource.com/crypto $GITHUB_WORKSPACE/src/golang.org/x/crypto
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/text && git clone -b v0.10.0 --depth 1 https://github.com/golang/text $GITHUB_WORKSPACE/src/golang.org/x/text
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/sync && git clone -b v0.3.0 --depth 1 https://github.com/golang/sync $GITHUB_WORKSPACE/src/golang.org/x/sync
GOPATH=$GITHUB_WORKSPACE go get github.com/leodido/go-urn
GOPATH=$GITHUB_WORKSPACE go get github.com/go-playground/locales
rm -rf $GITHUB_WORKSPACE/src/github.com/dave/jennifer && git clone -b v1.6.1 --depth 1 https://github.com/dave/jennifer $GITHUB_WORKSPACE/src/github.com/dave/jennifer
rm -rf $GITHUB_WORKSPACE/src/modernc.org/fileutil && git clone -b v1.0.0 --depth 1 https://gitlab.com/cznic/fileutil.git $GITHUB_WORKSPACE/src/modernc.org/fileutil
rm -rf $GITHUB_WORKSPACE/src/github.com/gorilla/mux && git clone -b v1.7.4 --depth 1 https://github.com/gorilla/mux $GITHUB_WORKSPACE/src/github.com/gorilla/mux
GOPATH=$GITHUB_WORKSPACE go get github.com/iancoleman/strcase
# github.com/stretchr/testify
# newer version require newer go feature
rm -rf $GITHUB_WORKSPACE/src/github.com/stretchr/testify && git clone -b v1.6.1 --depth 1 https://github.com/stretchr/testify.git $GITHUB_WORKSPACE/src/github.com/stretchr/testify
GOPATH=$GITHUB_WORKSPACE go get github.com/davecgh/go-spew/spew
GOPATH=$GITHUB_WORKSPACE go get github.com/pmezard/go-difflib/difflib
GOPATH=$GITHUB_WORKSPACE go get gopkg.in/yaml.v3
rm -rf $GITHUB_WORKSPACE/src/github.com/BurntSushi/toml && git clone -b v0.3.1 --depth 1 https://github.com/BurntSushi/toml.git $GITHUB_WORKSPACE/src/github.com/BurntSushi/toml
GOPATH=$GITHUB_WORKSPACE make unittest
working-directory: src/github.com/qiniu/go-sdk
go-mod-test:
needs: 'go-path-test'
strategy:
fail-fast: false
max-parallel: 1
matrix:
go_version: ['1.11', '1.12', '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22']
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: recursive
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}
- name: Format
run: |
if [ "${{ matrix.go_version }}" = "1.22" ]; then
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
exit 1
fi
fi
- name: Golint
run: |
if [ "${{ matrix.go_version }}" = "1.22" ]; then
set -e
go install honnef.co/go/tools/cmd/staticcheck@latest
make staticcheck
fi
- name: Run unit cases
run: |
set -e
if [ "${{ matrix.go_version }}" = "1.11" ] || [ "${{ matrix.go_version }}" = "1.12" ] || [ "${{ matrix.go_version }}" = "1.13" ] || [ "${{ matrix.go_version }}" = "1.14" ] || [ "${{ matrix.go_version }}" = "1.15" ]; then
go get modernc.org/[email protected]
fi
make unittest
env:
GO111MODULE: 'on'
go-mod-test-windows:
needs: 'go-mod-test'
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: recursive
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run unit cases
run: |
set -e
make unittest
shell: bash
go-mod-test-macos:
needs: 'go-mod-test-windows'
runs-on: macos-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: recursive
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install dependencies
run: |
brew install make
- name: Run unit cases
run: |
set -e
make unittest