Skip to content

Commit 0898608

Browse files
committed
add github actions
1 parent 8cdfbfa commit 0898608

File tree

5 files changed

+137
-3
lines changed

5 files changed

+137
-3
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: build
2+
3+
on: [ push ]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-18.04
8+
9+
strategy:
10+
matrix:
11+
go:
12+
- 1.x
13+
- 1.17.x
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-go@v2
18+
with: { go-version: '${{ matrix.go }}' }
19+
20+
- uses: actions/cache@v2
21+
with:
22+
path: |
23+
~/go/pkg/mod
24+
~/.cache/go-build
25+
~/Library/Caches/go-build
26+
%LocalAppData%\go-build
27+
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
31+
- run: make env deps-fetch test-with-coverage
32+
33+
build:
34+
runs-on: ubuntu-18.04
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: actions/setup-go@v2
38+
with: { go-version: '1.17' }
39+
40+
- uses: actions/cache@v2
41+
with:
42+
path: |
43+
~/go/pkg/mod
44+
~/.cache/go-build
45+
~/Library/Caches/go-build
46+
%LocalAppData%\go-build
47+
key: ${{ runner.os }}-go-${{ hashFiles('tools/go.sum') }}
48+
restore-keys: |
49+
${{ runner.os }}-go-
50+
51+
- run: make tools
52+
- run: '[ $(grep go:gen tools/tools.go | wc -l) = $(ls bin/linux/*/* | wc -l) ]'
53+
54+
- run: make pre-push
55+
56+
notify:
57+
runs-on: ubuntu-18.04
58+
needs: [ test, build ]
59+
steps:
60+
- uses: rtCamp/action-slack-notify@v2
61+
env:
62+
SLACK_ICON: https://github.com/github.png?size=64
63+
SLACK_TITLE: ${{ github.repository }}
64+
SLACK_USERNAME: GitHub Actions
65+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

.github/workflows/dist.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags: [ '*' ]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
goreleaser:
12+
runs-on: ubuntu-18.04
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with: { fetch-depth: 0 }
17+
- uses: actions/setup-go@v2
18+
with: { go-version: '1.17' }
19+
20+
- uses: actions/cache@v2
21+
with:
22+
path: |
23+
~/go/pkg/mod
24+
~/.cache/go-build
25+
~/Library/Caches/go-build
26+
%LocalAppData%\go-build
27+
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
31+
- run: make env deps-fetch test
32+
33+
- uses: goreleaser/goreleaser-action@v2
34+
with:
35+
distribution: goreleaser
36+
version: latest
37+
args: release --rm-dist
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}

internal/cmd/github/labels.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func Labels(git Git, github GitHub) *cobra.Command {
175175
Use: syncCommand,
176176
Short: "sync repository labels",
177177
Long: "Sync repository labels.",
178-
RunE: func(cmd *cobra.Command, args []string) error {
178+
RunE: func(cmd *cobra.Command, _ []string) error {
179179
push, args, err := cmd.Parent().Find([]string{pushCommand})
180180
if err != nil {
181181
return err

internal/cmd/github/mocks_test.go

Lines changed: 31 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/model/github/label.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ type LabelSet struct {
101101
func (set LabelSet) FindByID(id int64) *Label {
102102
for _, label := range set.Labels {
103103
if label.ID == id {
104+
label := label
104105
return &label
105106
}
106107
}

0 commit comments

Comments
 (0)