Skip to content

Commit 8b6e49e

Browse files
committed
improve ci/cd workflow
1 parent 0898608 commit 8b6e49e

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

.github/workflows/dist.yml renamed to .github/workflows/cd.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: publish
1+
name: delivery
22

33
on:
44
push:
@@ -15,23 +15,24 @@ jobs:
1515
- uses: actions/checkout@v2
1616
with: { fetch-depth: 0 }
1717
- uses: actions/setup-go@v2
18-
with: { go-version: '1.17' }
18+
with: { fetch-depth: 0, go-version: '1.17' }
1919

2020
- uses: actions/cache@v2
2121
with:
22+
fetch-depth: 0
2223
path: |
2324
~/go/pkg/mod
2425
~/.cache/go-build
2526
~/Library/Caches/go-build
2627
%LocalAppData%\go-build
2728
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
28-
restore-keys: |
29-
${{ runner.os }}-go-
29+
restore-keys: ${{ runner.os }}-go-
3030

3131
- run: make env deps-fetch test
3232

3333
- uses: goreleaser/goreleaser-action@v2
3434
with:
35+
fetch-depth: 0
3536
distribution: goreleaser
3637
version: latest
3738
args: release --rm-dist

.github/workflows/ci.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
name: build
1+
name: integration
22

3-
on: [ push ]
3+
on:
4+
pull_request: { branches: [ '*' ] }
5+
push: { branches: [ '*' ] }
46

57
jobs:
68
test:
@@ -14,42 +16,45 @@ jobs:
1416

1517
steps:
1618
- uses: actions/checkout@v2
19+
with: { fetch-depth: 0 }
1720
- uses: actions/setup-go@v2
18-
with: { go-version: '${{ matrix.go }}' }
21+
with: { fetch-depth: 0, go-version: '${{ matrix.go }}' }
1922

2023
- uses: actions/cache@v2
2124
with:
25+
fetch-depth: 0
2226
path: |
2327
~/go/pkg/mod
2428
~/.cache/go-build
2529
~/Library/Caches/go-build
2630
%LocalAppData%\go-build
2731
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
28-
restore-keys: |
29-
${{ runner.os }}-go-
32+
restore-keys: ${{ runner.os }}-go-
3033

31-
- run: make env deps-fetch test-with-coverage
34+
- run: make env deps-fetch install test-with-coverage
35+
- run: '[ $(ls bin/linux/*/* | wc -l) = 1 ]'
3236

3337
build:
3438
runs-on: ubuntu-18.04
3539
steps:
3640
- uses: actions/checkout@v2
41+
with: { fetch-depth: 0 }
3742
- uses: actions/setup-go@v2
38-
with: { go-version: '1.17' }
43+
with: { fetch-depth: 0, go-version: '1.17' }
3944

4045
- uses: actions/cache@v2
4146
with:
47+
fetch-depth: 0
4248
path: |
4349
~/go/pkg/mod
4450
~/.cache/go-build
4551
~/Library/Caches/go-build
4652
%LocalAppData%\go-build
4753
key: ${{ runner.os }}-go-${{ hashFiles('tools/go.sum') }}
48-
restore-keys: |
49-
${{ runner.os }}-go-
54+
restore-keys: ${{ runner.os }}-go-
5055

5156
- run: make tools
52-
- run: '[ $(grep go:gen tools/tools.go | wc -l) = $(ls bin/linux/*/* | wc -l) ]'
57+
- run: '[ $(ls bin/linux/*/* | wc -l) = $(grep go:gen tools/tools.go | wc -l) ]'
5358

5459
- run: make pre-push
5560

@@ -58,6 +63,7 @@ jobs:
5863
needs: [ test, build ]
5964
steps:
6065
- uses: rtCamp/action-slack-notify@v2
66+
with: { fetch-depth: 0 }
6167
env:
6268
SLACK_ICON: https://github.com/github.png?size=64
6369
SLACK_TITLE: ${{ github.repository }}

0 commit comments

Comments
 (0)