|
22 | 22 | - "Makefile" |
23 | 23 | branches: |
24 | 24 | - master |
25 | | - env: |
26 | | - GO_VERSION: 1.14 |
27 | | - jobs: |
28 | | - basic_checks: |
29 | | - name: Basic Checks |
30 | | - runs-on: ubuntu-latest |
31 | | - env: |
32 | | - GOLANG_LINT_VERSION: v1.27.0 |
33 | | - steps: |
34 | | - - name: Checkout Code |
35 | | - uses: actions/checkout@v2 |
36 | | - - name: Setup Go ${{ env.GO_VERSION }} |
37 | | - uses: actions/setup-go@v2 |
38 | | - with: |
39 | | - go-version: ${{ env.GO_VERSION }} |
40 | | - id: go |
41 | | - - name: Cache dependencies |
42 | | - uses: actions/cache@v2 |
43 | | - with: |
44 | | - path: ~/go/pkg/mod/cache |
45 | | - key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} |
46 | | - restore-keys: | |
47 | | - ${{ runner.os }}-go-cache- |
48 | | - - name: Check Headers |
49 | | - run: | |
50 | | - make addheaders |
51 | | - changed_files=$(git status -s | grep -v 'go.mod\|go.sum' || :) |
52 | | - [[ -z "$changed_files" ]] || (printf "Some files are missing the headers: \n$changed_files\n Did you run 'make lint' before sending the PR" && exit 1) |
53 | | - - name: Check Formatting |
54 | | - run: | |
55 | | - make fmt |
56 | | - changed_files=$(git status -s | grep -v 'go.mod\|go.sum' || :) |
57 | | - [[ -z "$changed_files" ]] || (printf "Some files are not formatted properly: \n$changed_files\n Did you run 'make test' before sending the PR?" && exit 1) |
58 | | - - name: Install golinters |
59 | | - run: | |
60 | | - go get -u golang.org/x/lint/golint |
61 | | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANG_LINT_VERSION |
62 | | - - name: Check lint |
63 | | - run: | |
64 | | - make lint |
65 | | - - name: Install cover |
66 | | - run: go get golang.org/x/tools/cmd/cover |
67 | | - - run: go mod tidy |
68 | | - - name: Validate codcov yaml file |
69 | | - run: curl -vvv --data-binary @codecov.yml https://codecov.io/validate |
70 | | - - name: Run Unit Tests |
71 | | - run: | |
72 | | - ./hack/go-test.sh "true" |
73 | | - - name: Upload results to codecov |
74 | | - uses: codecov/codecov-action@v1 |
75 | | - with: |
76 | | - file: ./test_coverage.txt |
77 | | - flags: sdk-go |
78 | | - name: sdk-go |
79 | | - fail_ci_if_error: true |
| 25 | +env: |
| 26 | + GO_VERSION: 1.14 |
| 27 | +jobs: |
| 28 | + basic_checks: |
| 29 | + name: Basic Checks |
| 30 | + runs-on: ubuntu-latest |
| 31 | + env: |
| 32 | + GOLANG_LINT_VERSION: v1.27.0 |
| 33 | + steps: |
| 34 | + - name: Checkout Code |
| 35 | + uses: actions/checkout@v2 |
| 36 | + - name: Setup Go ${{ env.GO_VERSION }} |
| 37 | + uses: actions/setup-go@v2 |
| 38 | + with: |
| 39 | + go-version: ${{ env.GO_VERSION }} |
| 40 | + id: go |
| 41 | + - name: Cache dependencies |
| 42 | + uses: actions/cache@v2 |
| 43 | + with: |
| 44 | + path: ~/go/pkg/mod/cache |
| 45 | + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} |
| 46 | + restore-keys: | |
| 47 | + ${{ runner.os }}-go-cache- |
| 48 | + - name: Check Headers |
| 49 | + run: | |
| 50 | + make addheaders |
| 51 | + changed_files=$(git status -s | grep -v 'go.mod\|go.sum' || :) |
| 52 | + [[ -z "$changed_files" ]] || (printf "Some files are missing the headers: \n$changed_files\n Did you run 'make lint' before sending the PR" && exit 1) |
| 53 | + - name: Check Formatting |
| 54 | + run: | |
| 55 | + make fmt |
| 56 | + changed_files=$(git status -s | grep -v 'go.mod\|go.sum' || :) |
| 57 | + [[ -z "$changed_files" ]] || (printf "Some files are not formatted properly: \n$changed_files\n Did you run 'make test' before sending the PR?" && exit 1) |
| 58 | + - name: Install golinters |
| 59 | + run: | |
| 60 | + go get -u golang.org/x/lint/golint |
| 61 | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANG_LINT_VERSION |
| 62 | + - name: Check lint |
| 63 | + run: | |
| 64 | + make lint |
| 65 | + - name: Install cover |
| 66 | + run: go get golang.org/x/tools/cmd/cover |
| 67 | + - run: go mod tidy |
| 68 | + - name: Validate codcov yaml file |
| 69 | + run: curl -vvv --data-binary @codecov.yml https://codecov.io/validate |
| 70 | + - name: Run Unit Tests |
| 71 | + run: | |
| 72 | + go test ./... -coverprofile test_coverage.out -covermode=atomic |
| 73 | + - name: Upload results to codecov |
| 74 | + uses: codecov/codecov-action@v1 |
| 75 | + with: |
| 76 | + file: ./test_coverage.out |
| 77 | + flags: sdk-go |
| 78 | + name: sdk-go |
| 79 | + fail_ci_if_error: true |
0 commit comments