|
6 | 6 | - "v*" # triggers only if push new tag version, like `0.8.4` or else |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - check-go: |
10 | | - name: Check Go code |
11 | | - runs-on: ubuntu-latest |
12 | | - steps: |
13 | | - - name: Checkout code |
14 | | - uses: actions/checkout@v2 |
15 | | - - name: Setup Golang |
16 | | - uses: actions/setup-go@v1 |
17 | | - with: |
18 | | - go-version: '1.16.4' |
19 | | - - name: Download all Go modules |
20 | | - run: | |
21 | | - go mod download |
22 | | - - name: Check for tidyness of go.mod and go.sum |
23 | | - run: | |
24 | | - go mod tidy |
25 | | - git diff --exit-code -- . |
26 | | -
|
27 | | - build-go: |
28 | | - name: Build & cache Go code |
29 | | - runs-on: ubuntu-latest |
30 | | - steps: |
31 | | - - name: Checkout code |
32 | | - uses: actions/checkout@v2 |
33 | | - - name: Setup Golang |
34 | | - uses: actions/setup-go@v1 |
35 | | - with: |
36 | | - go-version: '1.16.4' |
37 | | - - name: Restore go build cache |
38 | | - uses: actions/cache@v1 |
39 | | - with: |
40 | | - path: ~/.cache/go-build |
41 | | - key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} |
42 | | - - name: Download all Go modules |
43 | | - run: | |
44 | | - go mod download |
45 | | -
|
46 | | - lint-go: |
47 | | - name: Lint Go code |
48 | | - runs-on: ubuntu-latest |
49 | | - steps: |
50 | | - - name: Checkout code |
51 | | - uses: actions/checkout@v2 |
52 | | - - name: Run golangci-lint |
53 | | - uses: golangci/golangci-lint-action@v2 |
54 | | - with: |
55 | | - version: v1.39.0 |
56 | | - args: --timeout 5m |
57 | | - |
58 | | - test-go: |
59 | | - name: Run unit tests |
60 | | - runs-on: ubuntu-latest |
61 | | - needs: |
62 | | - - build-go |
63 | | - steps: |
64 | | - - name: Create checkout directory |
65 | | - run: mkdir -p ~/go/src/github.com/gitpod-io |
66 | | - - name: Checkout code |
67 | | - uses: actions/checkout@v2 |
68 | | - - name: Create symlink in GOPATH |
69 | | - run: ln -s $(pwd) ~/go/src/github.com/gitpod-io/dazzle |
70 | | - - name: Setup Golang |
71 | | - uses: actions/setup-go@v1 |
72 | | - with: |
73 | | - go-version: '1.16.4' |
74 | | - - name: Restore go build cache |
75 | | - uses: actions/cache@v1 |
76 | | - with: |
77 | | - path: ~/.cache/go-build |
78 | | - key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} |
79 | | - - name: Download and vendor all required packages |
80 | | - run: | |
81 | | - go mod download |
82 | | - - name: Run all unit tests |
83 | | - run: go test -v -coverprofile=coverage.out $(go list ./...) |
84 | | - - name: Generate code coverage artifacts |
85 | | - uses: actions/upload-artifact@v2 |
86 | | - with: |
87 | | - name: code-coverage |
88 | | - path: coverage.out |
89 | | - |
90 | 9 | release: |
91 | | - name: Run GoReleaser |
92 | 10 | runs-on: ubuntu-latest |
93 | | - needs: |
94 | | - - build-go |
95 | | - - test-go |
96 | 11 | steps: |
97 | | - - name: Create checkout directory |
98 | | - run: mkdir -p ~/go/src/github.com/gitpod-io |
99 | | - - name: Checkout code |
| 12 | + - |
| 13 | + name: Checkout |
100 | 14 | uses: actions/checkout@v2 |
101 | | - - name: Create symlink in GOPATH |
102 | | - run: ln -s $(pwd) ~/go/src/github.com/gitpod-io/dazzle |
103 | | - - name: Setup Golang |
104 | | - uses: actions/setup-go@v1 |
105 | 15 | with: |
106 | | - go-version: '1.16.4' |
107 | | - - name: Restore go build cache |
108 | | - uses: actions/cache@v1 |
| 16 | + fetch-depth: 0 |
| 17 | + - |
| 18 | + name: Set up Go |
| 19 | + uses: actions/setup-go@v2 |
109 | 20 | with: |
110 | | - path: ~/.cache/go-build |
111 | | - key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} |
112 | | - - name: Download and vendor all required packages |
113 | | - run: | |
114 | | - go mod download |
115 | | - - name: Run GoReleaser |
116 | | - uses: goreleaser/goreleaser-action@master |
| 21 | + go-version: 1.16.4 |
| 22 | + - |
| 23 | + name: Run GoReleaser |
| 24 | + uses: goreleaser/goreleaser-action@v2 |
117 | 25 | with: |
| 26 | + # either 'goreleaser' (default) or 'goreleaser-pro' |
| 27 | + distribution: goreleaser |
118 | 28 | version: latest |
119 | 29 | args: release --rm-dist |
120 | 30 | env: |
|
0 commit comments