Skip to content

Commit 3d5ed3f

Browse files
authored
build(ci): add CI workflow (#6)
1 parent b48199c commit 3d5ed3f

File tree

4 files changed

+131
-4
lines changed

4 files changed

+131
-4
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
GO_VERSION: '1.23'
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ env.GO_VERSION }}
22+
cache: true
23+
- name: Go Lint
24+
run: make lint-go
25+
- name: Check license headers
26+
run: make lint-license
27+
28+
test:
29+
name: Unit Test
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/setup-go@v5
34+
with:
35+
go-version: ${{ env.GO_VERSION }}
36+
cache: true
37+
- name: Run tests
38+
run: make unit-test-local
39+
40+
security:
41+
name: Security Scan
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Go
48+
uses: actions/setup-go@v5
49+
with:
50+
go-version: ${{ env.GO_VERSION }}
51+
cache-dependency-path: "**/go.sum"
52+
53+
- name: Run vulnerability check
54+
run: |
55+
go install golang.org/x/vuln/cmd/govulncheck@latest
56+
govulncheck ./...
57+
58+
build:
59+
name: Build Binary
60+
runs-on: ubuntu-latest
61+
needs: [lint, test]
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: actions/setup-go@v5
65+
with:
66+
go-version: ${{ env.GO_VERSION }}
67+
cache: true
68+
- name: Build binary
69+
run: make build-local

.licenserc.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
header:
2+
license:
3+
spdx-id: Apache-2.0
4+
content: |
5+
Copyright The AIGW Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
paths-ignore:
20+
# ignore doc, testdata and configuration
21+
- '**/*.md'
22+
- '.gitignore'
23+
- 'VERSION'
24+
- 'LICENSE'
25+
- 'NOTICE'
26+
- 'CODEOWNERS'
27+
- '**/testdata/**'
28+
- '**/*.yaml'
29+
- '**/*.yml'
30+
- '**/*.toml'
31+
# ignore file controlled by tools
32+
- '**/go.mod'
33+
- '**/go.sum'
34+
- 'buf.lock'
35+
- 'Chart.lock'
36+
# files can't add license
37+
- '**/*.pb.validate.go'
38+
- '**/*.json'
39+
- '**/*.txt'
40+
- '**/*.patch'
41+
- '**/*.gotmpl'
42+
- '**/*.tpl'
43+
- '.ignore_words'
44+
# files from other projects
45+
- 'site/assets/**'
46+
- 'site/layouts/**'
47+
- 'api/internal/cookie/cookie.go'
48+
- 'controller/registries/nacos/config.go'
49+
- 'vendor/**'
50+
comment: on-failure

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ require (
5252
github.com/ugorji/go/codec v1.2.12 // indirect
5353
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
5454
golang.org/x/arch v0.8.0 // indirect
55-
golang.org/x/crypto v0.31.0 // indirect
56-
golang.org/x/net v0.33.0 // indirect
57-
golang.org/x/sys v0.30.0 // indirect
58-
golang.org/x/text v0.21.0 // indirect
55+
golang.org/x/crypto v0.36.0 // indirect
56+
golang.org/x/net v0.38.0 // indirect
57+
golang.org/x/sys v0.31.0 // indirect
58+
golang.org/x/text v0.23.0 // indirect
5959
google.golang.org/protobuf v1.36.5 // indirect
6060
gopkg.in/yaml.v2 v2.4.0 // indirect
6161
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,23 @@ golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
124124
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
125125
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
126126
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
127+
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
128+
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
127129
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
128130
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
131+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
132+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
129133
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
130134
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
131135
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
132136
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
133137
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
138+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
139+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
134140
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
135141
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
142+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
143+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
136144
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
137145
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
138146
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

0 commit comments

Comments
 (0)