-
Notifications
You must be signed in to change notification settings - Fork 405
142 lines (134 loc) · 4.24 KB
/
ci.yaml
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
name: CI
on:
push:
branches:
- master
- release-*
pull_request: {}
workflow_dispatch: {}
env:
GO_VERSION: '1.21'
GOLANGCI_VERSION: 'v1.55.2'
# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
DOCKER_USR: ${{ secrets.DOCKER_USR }}
AWS_USR: ${{ secrets.AWS_USR }}
jobs:
typos-check:
runs-on: ubuntu-22.04
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling with custom config file
uses: crate-ci/[email protected]
with:
config: ./typos.toml
verify:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Verify Code
run: make verify
golangci-lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Lint golang code
uses: golangci/[email protected]
with:
version: ${{ env.GOLANGCI_VERSION }}
args: --verbose
skip-cache: true
mode: readonly
# markdownlint-misspell-shellcheck:
# runs-on: ubuntu-22.04
# # this image is build from Dockerfile
# # https://github.com/pouchcontainer/pouchlinter/blob/master/Dockerfile
# container: pouchcontainer/pouchlinter:v0.1.2
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Run misspell
# run: find ./* -name "*" | xargs misspell -error
# - name: Lint markdown files
# run: find ./ -name "*.md" | grep -v enhancements | grep -v .github
# - name: Check markdown links
# run: |
# set +e
# for name in $(find . -name \*.md | grep -v CHANGELOG); do
# if [ -f $name ]; then
# markdown-link-check -q $name -c .github/workflows/markdown-link-check.config.json;
# if [ $? -ne 0 ]; then
# code=1
# fi
# fi
# done
# bash -c "exit $code";
unit-tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
# - name: Cache Go Dependencies
# uses: actions/cache@v3
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: ${{ runner.os }}-go-
- name: Run Unit Tests
run: make test
- name: Publish Unit Test Coverage
# only publish result in openyurt repo
if: github.repository == 'openyurtio/openyurt'
uses: codecov/[email protected]
with:
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
files: ./cover.out,./yurttunnel-cover.out
version: v0.6.0
fail_ci_if_error: true
verbose: true
e2e-tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
# - uses: actions/cache@v3
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: ${{ runner.os }}-go-
- name: Install Required Commands
run: |
go install sigs.k8s.io/[email protected]
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.28.7/bin/linux/amd64/kubectl && sudo install kubectl /usr/local/bin/kubectl
- name: Build Images
run: make docker-build
- name: Local Up Openyurt Cluster With Kind
run: NODES_NUM=3 DISABLE_DEFAULT_CNI=true make local-up-openyurt
- name: Run e2e Tests
run: make e2e-tests