-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (114 loc) · 3.47 KB
/
ci.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
110
111
112
113
114
name: ci
on:
push:
branches: [ 'main' ]
pull_request:
types: [ synchronize, opened, reopened, labeled, unlabeled ]
jobs:
matrix_test:
strategy:
matrix:
platform:
- ubuntu-22.04
- macos-13
- windows-2022
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.20.x'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-test-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-test
- run: script/test
shell: sh
test:
needs:
- matrix_test
runs-on: ubuntu-22.04
steps:
- run: echo ok
shell: sh
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.20.x'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
.bindown
key: ${{ runner.os }}-go-lint-${{ hashFiles('**/go.sum', 'bindown.yml', 'script/*') }}
restore-keys: ${{ runner.os }}-go-lint
- run: script/lint
generate:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.20.x'
- name: configure git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-generate-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-generate
- run: script/generate --check
release:
runs-on: ubuntu-22.04
needs:
- test
- lint
- generate
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: WillAbides/setup-go-faster@v1
id: setup-go
with:
go-version: '1.20.x'
- uses: actions/cache@v3
with:
path: |
${{ steps.setup-go.outputs.GOCACHE }}
${{ steps.setup-go.outputs.GOMODCACHE }}
key: ${{ runner.os }}-go-release-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-release
- uses: WillAbides/[email protected]
id: release-train
with:
create-release: true
release-refs: main
pre-tag-hook: |
set -e
script/check-module-version "$(go list -m)" "$RELEASE_TAG"
script/bindown install goreleaser
git tag "$RELEASE_TAG"
bin/goreleaser release --clean --skip-publish
cp dist/checksums.txt dist/bindown_*.tar.gz "$ASSETS_DIR"
- if: steps.release-train.outputs.created-release == 'true'
env:
RELEASE_TAG: ${{ steps.release-train.outputs.release-tag }}
run: |
go run ./internal/build-bootstrapper -tag "$RELEASE_TAG" > bootstrap-bindown.sh
gh release upload "$RELEASE_TAG" bootstrap-bindown.sh