-
Notifications
You must be signed in to change notification settings - Fork 20
180 lines (147 loc) · 4.26 KB
/
build.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Go Build & Test
on:
push:
branches:
- master
pull_request:
paths-ignore: ['docs/**', 'mkdocs.yml']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache-dependency-path: 'go.sum'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Cache npm packages
uses: actions/cache@v4
with:
path: |
internal/webui/node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Build
run: |
cd internal/webui
yarn install --network-timeout 100000 && yarn build
cd -
go build ./cmd/pgwatch
- name: Upload webui as artifact
uses: actions/upload-artifact@v4
with:
name: webui-build
path: internal/webui/build
- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
test:
if: true # false to skip job during debug
needs: build
runs-on: ubuntu-latest
name: Test
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache-dependency-path: 'go.sum'
- name: Download webui artifact
uses: actions/download-artifact@v4
with:
name: webui-build
path: internal/webui/build
- name: Test
run: |
go test -failfast -v -timeout=300s -p 1 -coverprofile=profile.cov ./...
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
file: profile.cov
goreleaser:
if: true # false to skip job during debug
needs: build
runs-on: ubuntu-latest
name: GoReleaser
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache-dependency-path: 'go.sum'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --snapshot --skip=publish --clean
test-docker-images:
if: true # false to skip job during debug
needs: build
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build Docker Image
shell: bash
run: |
docker build \
--build-arg GIT_TIME=`git show -s --format=%cI HEAD` \
--build-arg GIT_HASH=`git show -s --format=%H HEAD` \
--build-arg VERSION=`git rev-parse --abbrev-ref HEAD` \
-t cybertecpostgresql/pgwatch:latest \
-f docker/Dockerfile .
build-docs:
if: true # false to skip job during debug
needs: build
name: Build Docs
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Configure Git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Set up gopages
run: go install github.com/johnstarich/go/[email protected]
- name: Build Developer Docs
run: gopages -out "docs/godoc" -base "/godoc" -internal
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: pip install mike mkdocs-material mkdocs-glightbox
- name: Check if we should push to gh-pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
git fetch origin gh-pages --depth=1
echo "push_opt=--push" >> $GITHUB_ENV
- name: Build mkdocs
run: mike deploy ${{ env.push_opt }} devel