-
Notifications
You must be signed in to change notification settings - Fork 10
109 lines (106 loc) · 3.47 KB
/
push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: push
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions: write-all
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
gofumpt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: |
export PATH=$PATH:$(go env GOPATH)/bin
go install mvdan.cc/gofumpt@latest
if gofumpt -l -e . | grep '^' -q; then exit 1; fi
go-channel-closure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: test "$(grep -Erc --exclude-dir=".git*" 'make\(chan\s')" = "$(grep -Erc --exclude-dir=".git*" '\sclose\(')"
go-http-body-closure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: test "$(grep -rc --exclude-dir=".git*" 'http.Get(\|http.Head(\|http.DefaultClient.Do(')" = "$(grep -rc --exclude-dir=".git*" '.Body.Close()')"
go-monkey-unpatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: test "$(grep -cr 'defer gomonkey\.')" = "$(grep -cr 'Reset()$')"
test:
runs-on: ubuntu-latest
needs: [commitlint, codespell, golangci-lint, gofumpt, go-channel-closure, go-http-body-closure, go-monkey-unpatch]
if: success()
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: |
go test -v -timeout 30s -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | grep -E '^total:.*100.0%$'
env:
XDG_MUSIC_DIR: /tmp
notify:
needs: [test]
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_ACTIONS_SPOTITUBE }}
repository: streambinder/streambinder
event-type: doc-sync
client-payload: '{"repo": "${{ github.repository }}", "ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
benchmark:
runs-on: ubuntu-latest
needs: [test]
if: success()
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: go test -benchmem -bench '^Benchmark.*$' ./... | grep ^Benchmark
build:
runs-on: ubuntu-latest
needs: [test]
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
secrets: |
SPOTIFY_ID=${{ secrets.SPOTIFY_ID }}
SPOTIFY_KEY=${{ secrets.SPOTIFY_KEY }}
GENIUS_TOKEN=${{ secrets.GENIUS_TOKEN }}
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: ghcr.io/streambinder/spotitube:latest
push: ${{ github.event_name != 'pull_request' }}