mosn

Форк
0
/
reviewdog.yml 
182 строки · 5.2 Кб
1
name: actions
2
on:
3
  push:
4
    branches:
5
      - master
6
  pull_request:
7
    types:
8
      - opened
9
      - reopened
10
      - synchronize
11
      - ready_for_review
12
jobs:
13
  misc-lint:
14
    if: ${{ !github.event.pull_request.draft }}
15
    name: runner / misc-lint
16
    runs-on: ubuntu-latest
17
    steps:
18
      - name: Check out code
19
        uses: actions/checkout@v3
20
      - name: setup go
21
        uses: actions/setup-go@v4
22
      - name: run goimports
23
        working-directory: ./
24
        run: |
25
          go install golang.org/x/tools/cmd/goimports@latest
26
          export PATH=$PATH:$(go env GOPATH)/bin/
27
          dirs="$(find . -mindepth 1 -maxdepth 1 -type d ! -name 'istio')"
28
          # we don't have a directory contains whitespace, so it is fine to use for loop
29
          for dir in $dirs; do
30
              diffs=$(goimports -d $dir)
31
              if [[ -n $diffs ]]; then
32
                  echo "Files are not formatted by goimport:"
33
                  echo $diffs
34
                  exit 1
35
              fi
36
          done
37

38
  golangci-lint:
39
    if: ${{ !github.event.pull_request.draft }}
40
    name: runner / golangci-lint
41
    runs-on: ubuntu-latest
42
    steps:
43
      - name: Check out code
44
        uses: actions/checkout@v3
45
      - name: golangci-lint
46
        uses: reviewdog/action-golangci-lint@v2
47
        if: github.event_name == 'pull_request'
48
        with:
49
          golangci_lint_flags: "--skip-dirs=mtls/crypto,module/http2 --enable-all --timeout=10m --exclude-use-default=false --tests=false --disable=gochecknoinits,gochecknoglobals,exhaustive,exhaustruct,exhaustivestruct,nakedret,ireturn,interfacer,tagliatelle,varnamelen"
50
          workdir: pkg
51

52
  test:
53
    if: ${{ !github.event.pull_request.draft }}
54
    name: Test
55
    runs-on: ubuntu-latest
56
    # A matrix proves the supported range of Go versions work. This must always
57
    # include the floor Go version policy of Mosn and the current Go version.
58
    # Mosn's floor Go version for libraries is two behind current, e.g. if Go
59
    # supports 1.19 and 1.20, Mosn libraries must work on 1.18, 1.19 and 1.20.
60
    #
61
    # A floor version is required to ensure Mosn can receive security patches.
62
    # Without one, dependencies become locked to an old version of Go, which
63
    # itself receives no security patch updates.
64
    #
65
    # Mosn's binary is built with Go's floor version, e.g. if Go supports 1.19
66
    # and 1.20, Mosn will build any downloadable executables with 1.19.
67
    #
68
    # Even if mosn works with a Go version below its supported floor, users
69
    # must not depend on this. Mosn and its library dependencies are free to
70
    # use features in the supported floor Go version at any time. This remains
71
    # true even if mosn library dependencies are not eagerly updated.
72
    strategy:
73
      fail-fast: false
74
      matrix:
75
        go-version:
76
          # FIXME: make CI pass in 1.20, see https://github.com/mosn/mosn/issues/2294
77
          #- "golang:1.20"  # Current Go version
78
          - "golang:1.19"
79
          - "golang:1.18"  # Floor Go version of Mosn == current - 2
80

81
    steps:
82
      - name: Check out code
83
        uses: actions/checkout@v3
84

85
      - name: Run Unit tests.
86
        env:
87
          BUILD_IMAGE: ${{ matrix.go-version }}
88
        run: make coverage
89

90
      - name: Coverage
91
        run: bash <(curl -s https://codecov.io/bash)
92
          
93
  test-compatible:
94
    if: ${{ !github.event.pull_request.draft }}
95
    name: Test-compatible
96
    runs-on: ubuntu-latest
97
    steps:
98
      - name: Check out code
99
        uses: actions/checkout@v3
100

101
      - name: Set up Go
102
        uses: actions/setup-go@v3
103
        with:
104
          go-version: 1.18
105
          cache: true
106

107
      - name: Set to compatible version
108
        run: make istio-1.5.2
109

110
      - name: Run Unit compatible tests.
111
        run: make unit-test-istio
112

113
  integrate:
114
    if: ${{ !github.event.pull_request.draft }}
115
    name: integrate
116
    runs-on: ubuntu-latest
117
    steps:
118
      - name: Check out code
119
        uses: actions/checkout@v3
120

121
      - name: Set up Go
122
        uses: actions/setup-go@v3
123
        with:
124
          go-version: 1.18
125
          cache: true
126

127
      - name: Run Integrate tests.
128
        run: make integrate
129

130
  integrate-netpoll:
131
    if: ${{ !github.event.pull_request.draft }}
132
    name: integrate-netpoll
133
    runs-on: ubuntu-latest
134
    steps:
135
      - name: Check out code
136
        uses: actions/checkout@v3
137

138
      - name: Set up Go
139
        uses: actions/setup-go@v3
140
        with:
141
          go-version: 1.18
142
          cache: true
143

144
      - name: Run Integrate tests.
145
        run: make integrate-netpoll
146

147
  integrate-new:
148
    if: ${{ !github.event.pull_request.draft }}
149
    name: integrate-new
150
    runs-on: ubuntu-latest
151
    steps:
152
      - name: Check out code
153
        uses: actions/checkout@v3
154

155
      - name: Set up Go
156
        uses: actions/setup-go@v3
157
        with:
158
          go-version: 1.18
159
          cache: true
160

161
      - name: Run New Integrate
162
        run: make integrate-new
163

164
  build:
165
    if: ${{ !github.event.pull_request.draft }}
166
    name: build
167
    runs-on: ubuntu-latest
168
    steps:
169
      - name: Check out code
170
        uses: actions/checkout@v3
171

172
      - name: Set up Go
173
        uses: actions/setup-go@v3
174
        with:
175
          go-version: 1.18
176
          cache: true
177

178
      - name: Run Build.
179
        run: make build
180

181
      - name: Run test-shell.
182
        run: make test-shell
183

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.