mosn
1name: actions2on:3push:4branches:5- master6pull_request:7types:8- opened9- reopened10- synchronize11- ready_for_review12jobs:13misc-lint:14if: ${{ !github.event.pull_request.draft }}15name: runner / misc-lint16runs-on: ubuntu-latest17steps:18- name: Check out code19uses: actions/checkout@v320- name: setup go21uses: actions/setup-go@v422- name: run goimports23working-directory: ./24run: |25go install golang.org/x/tools/cmd/goimports@latest
26export PATH=$PATH:$(go env GOPATH)/bin/
27dirs="$(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
29for dir in $dirs; do
30diffs=$(goimports -d $dir)
31if [[ -n $diffs ]]; then
32echo "Files are not formatted by goimport:"
33echo $diffs
34exit 1
35fi
36done
37
38golangci-lint:39if: ${{ !github.event.pull_request.draft }}40name: runner / golangci-lint41runs-on: ubuntu-latest42steps:43- name: Check out code44uses: actions/checkout@v345- name: golangci-lint46uses: reviewdog/action-golangci-lint@v247if: github.event_name == 'pull_request'48with:49golangci_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"50workdir: pkg51
52test:53if: ${{ !github.event.pull_request.draft }}54name: Test55runs-on: ubuntu-latest56# A matrix proves the supported range of Go versions work. This must always57# 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 Go59# 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, which63# itself receives no security patch updates.64#65# Mosn's binary is built with Go's floor version, e.g. if Go supports 1.1966# 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, users69# must not depend on this. Mosn and its library dependencies are free to70# use features in the supported floor Go version at any time. This remains71# true even if mosn library dependencies are not eagerly updated.72strategy:73fail-fast: false74matrix:75go-version:76# FIXME: make CI pass in 1.20, see https://github.com/mosn/mosn/issues/229477#- "golang:1.20" # Current Go version78- "golang:1.19"79- "golang:1.18" # Floor Go version of Mosn == current - 280
81steps:82- name: Check out code83uses: actions/checkout@v384
85- name: Run Unit tests.86env:87BUILD_IMAGE: ${{ matrix.go-version }}88run: make coverage89
90- name: Coverage91run: bash <(curl -s https://codecov.io/bash)92
93test-compatible:94if: ${{ !github.event.pull_request.draft }}95name: Test-compatible96runs-on: ubuntu-latest97steps:98- name: Check out code99uses: actions/checkout@v3100
101- name: Set up Go102uses: actions/setup-go@v3103with:104go-version: 1.18105cache: true106
107- name: Set to compatible version108run: make istio-1.5.2109
110- name: Run Unit compatible tests.111run: make unit-test-istio112
113integrate:114if: ${{ !github.event.pull_request.draft }}115name: integrate116runs-on: ubuntu-latest117steps:118- name: Check out code119uses: actions/checkout@v3120
121- name: Set up Go122uses: actions/setup-go@v3123with:124go-version: 1.18125cache: true126
127- name: Run Integrate tests.128run: make integrate129
130integrate-netpoll:131if: ${{ !github.event.pull_request.draft }}132name: integrate-netpoll133runs-on: ubuntu-latest134steps:135- name: Check out code136uses: actions/checkout@v3137
138- name: Set up Go139uses: actions/setup-go@v3140with:141go-version: 1.18142cache: true143
144- name: Run Integrate tests.145run: make integrate-netpoll146
147integrate-new:148if: ${{ !github.event.pull_request.draft }}149name: integrate-new150runs-on: ubuntu-latest151steps:152- name: Check out code153uses: actions/checkout@v3154
155- name: Set up Go156uses: actions/setup-go@v3157with:158go-version: 1.18159cache: true160
161- name: Run New Integrate162run: make integrate-new163
164build:165if: ${{ !github.event.pull_request.draft }}166name: build167runs-on: ubuntu-latest168steps:169- name: Check out code170uses: actions/checkout@v3171
172- name: Set up Go173uses: actions/setup-go@v3174with:175go-version: 1.18176cache: true177
178- name: Run Build.179run: make build180
181- name: Run test-shell.182run: make test-shell183