-
-
Notifications
You must be signed in to change notification settings - Fork 11
163 lines (136 loc) · 4.69 KB
/
test.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: CI
on:
pull_request:
branches:
- main
jobs:
snapshot:
name: snapshot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --snapshot --rm-dist
- name: Capture x86_64 (64-bit) Linux binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-linux-amd64
path: dist/auto-doc_linux_amd64/auto-doc
- name: Capture i386 (32-bit) Linux binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-linux-i386
path: dist/auto-doc_linux_386/auto-doc
- name: Capture arm64 (64-bit) Linux binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-linux-arm64
path: dist/auto-doc_linux_arm64/auto-doc
- name: Capture armv6 (32-bit) Linux binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-linux-armv6
path: dist/auto-doc_linux_arm_6/auto-doc
- name: Capture armv7 (32-bit) Linux binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-linux-armv7
path: dist/auto-doc_linux_arm_7/auto-doc
- name: Capture x86_64 (64-bit) Windows binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-windows-amd64
path: dist/auto-doc_windows_amd64/auto-doc.exe
- name: Capture i386 (32-bit) Windows binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-windows-i386
path: dist/auto-doc_windows_386/auto-doc.exe
- name: Capture arm64 (64-bit) Windows binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-windows-arm64
path: dist/auto-doc_windows_arm64/auto-doc.exe
- name: Capture armv7 (32-bit) Windows binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-windows-armv7
path: dist/auto-doc_windows_arm_7/auto-doc.exe
- name: Capture x86_64 (64-bit) MacOS binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-macos-amd64
path: dist/auto-doc_darwin_amd64/auto-doc
- name: Capture arm64 (64-bit) MacOS binary
uses: actions/upload-artifact@v3
with:
name: auto-doc-macos-arm64
path: dist/auto-doc_darwin_arm64/auto-doc
test:
name: Test auto-doc
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
- name: Setup go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run build
run: make build
- name: Test action
uses: ./
with:
bin_path: ./bin/auto_doc
- name: Run auto-doc using the test directory
run: make test
- name: Run auto-doc using the top level directory
run: make run
- name: Format markdown
uses: tj-actions/remark@v3
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v12
id: verify-changed-files
with:
files: |
README.md
test/**
- name: Commit README changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add ${{ steps.verify-changed-files.outputs.changed_files }}
git commit -m "Updated README."
- name: Push README changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
continue-on-error: true
with:
github_token: ${{ secrets.PAT_TOKEN }}
branch: ${{ github.head_ref }}