|
| 1 | +--- |
| 2 | +name: ci |
| 3 | +on: pull_request |
| 4 | +jobs: |
| 5 | + yamllint: |
| 6 | + name: yamllint |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - name: Check out code into the Go module directory |
| 10 | + uses: actions/checkout@v1 |
| 11 | + - name: Setup Python |
| 12 | + uses: actions/setup-python@v1 |
| 13 | + - name: Install yamllint |
| 14 | + run: pip install --user yamllint |
| 15 | + - name: Run yamllint |
| 16 | + run: ~/.local/bin/yamllint -c .yamllint.yml --strict . |
| 17 | + shellcheck: |
| 18 | + name: shellcheck |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v1 |
| 22 | + - name: shellcheck |
| 23 | + uses: reviewdog/action-shellcheck@v1 |
| 24 | + with: |
| 25 | + github_token: ${{ secrets.github_token }} |
| 26 | + reporter: github-check |
| 27 | + build: |
| 28 | + name: build |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v1 |
| 32 | + - uses: actions/setup-go@v1 |
| 33 | + with: |
| 34 | + go-version: 1.13 |
| 35 | + - run: | |
| 36 | + go build -race ./... |
| 37 | + test: |
| 38 | + name: test |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v1 |
| 42 | + - uses: actions/setup-go@v1 |
| 43 | + with: |
| 44 | + go-version: 1.13 |
| 45 | + - name: Install gotestsum |
| 46 | + run: go get gotest.tools/[email protected] |
| 47 | + - name: Run tests |
| 48 | + run: | |
| 49 | + eval $(go env) |
| 50 | + mkdir -p ~/junit/ |
| 51 | + ${GOPATH}/bin/gotestsum --junitfile ~/junit/unit-tests.xml -- -race -short $(go list ./...) |
| 52 | + golangci-lint: |
| 53 | + name: golangci-lint |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - name: Check out code into the Go module directory |
| 57 | + uses: actions/checkout@v1 |
| 58 | + - name: golangci-lint |
| 59 | + uses: reviewdog/action-golangci-lint@v1 |
| 60 | + with: |
| 61 | + github_token: ${{ secrets.github_token }} |
| 62 | + reporter: github-check |
| 63 | + |
| 64 | + excludeFmtErrorf: |
| 65 | + name: exclude fmt.Errorf |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: Exclude fmt.Errorf |
| 69 | + run: | |
| 70 | + if grep -r --include=*.go fmt.Errorf . ; then |
| 71 | + echo "Please use errors.Errorf (or errors.New or errors.Wrap or errors.Wrapf) as appropriate rather than fmt.Errorf" |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | + restrictNSMDeps: |
| 75 | + name: Restrict dependencies on github.com/networkservicemesh/* |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - name: Restrict dependencies on github.com/networkservicemesh/* |
| 79 | + run: | |
| 80 | + for i in $(grep github.com/networkservicemesh/ go.mod | gsed 's;.*\(github.com\/networkservicemesh\/[a-zA-z\/]*\).*;\1;g' | sort -u);do |
| 81 | + if [ "${i}" != "github.com/networkservicemesh/sdk" ] && [ "${i}" != "github.com/networkservicemesh/networkservicemesh/controlplane/api" ]; then |
| 82 | + echo Dependency on "${i}" is forbidden |
| 83 | + exit 1 |
| 84 | + fi |
| 85 | + done |
| 86 | + checkgomod: |
| 87 | + name: check go.mod and go.sum |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v1 |
| 91 | + - uses: actions/setup-go@v1 |
| 92 | + with: |
| 93 | + go-version: 1.13 |
| 94 | + - run: go mod tidy |
| 95 | + - name: Check for changes in go.mod or go.sum |
| 96 | + run: | |
| 97 | + git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false ) |
| 98 | + git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false ) |
| 99 | + license: |
| 100 | + name: license header check |
| 101 | + runs-on: ubuntu-latest |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v1 |
| 104 | + - uses: actions/setup-go@v1 |
| 105 | + with: |
| 106 | + go-version: 1.13 |
| 107 | + - name: Install go-header |
| 108 | + run: 'go get github.com/denis-tingajkin/[email protected]' |
| 109 | + - name: Run go-header |
| 110 | + run: | |
| 111 | + eval $(go env) |
| 112 | + ${GOPATH}/bin/go-header |
0 commit comments