-
Notifications
You must be signed in to change notification settings - Fork 17
135 lines (114 loc) · 3.12 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
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 .