This repository was archived by the owner on Apr 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
126 lines (118 loc) · 2.72 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
126 lines (118 loc) · 2.72 KB
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
stages:
- lint
- test
- build
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE
IMAGE_TAG: $CI_COMMIT_SHORT_SHA
HUGO_VERSION: 0.160.0
.go_cache: &go_cache
key:
files:
- go.sum
paths:
- .cache/go-mod
- .cache/go-build
policy: pull-push
.web_cache: &web_cache
key:
files:
- web/yarn.lock
prefix: web
paths:
- web/node_modules
policy: pull-push
# Lint job
lint:
stage: lint
image: golang:1.26
tags:
- linux-x86
variables:
GOMODCACHE: $CI_PROJECT_DIR/.cache/go-mod
GOCACHE: $CI_PROJECT_DIR/.cache/go-build
script:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.10.1
- $(go env GOPATH)/bin/golangci-lint run --timeout 5m
cache: *go_cache
# Test job
test:
stage: test
image: golang:1.26
tags:
- linux-x86
variables:
GOMODCACHE: $CI_PROJECT_DIR/.cache/go-mod
GOCACHE: $CI_PROJECT_DIR/.cache/go-build
script:
- go test -v -race ./...
cache: *go_cache
# Frontend lint + build
frontend:
stage: lint
image: node:22
tags:
- linux-x86
script:
- cd web
- yarn install --frozen-lockfile
- yarn lint
- yarn build
cache: *web_cache
# Build job
build:
stage: build
image: docker:latest
variables:
DOCKER_HOST: unix:///var/run/docker.sock
tags:
- linux-x86
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker pull $IMAGE_NAME:latest || true
- docker build --cache-from $IMAGE_NAME:latest -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:latest .
- docker push $IMAGE_NAME:$IMAGE_TAG
- docker push $IMAGE_NAME:latest
after_script:
- docker rmi $IMAGE_NAME:$IMAGE_TAG || true
only:
- master
# Docs / GitLab Pages
pages:
stage: lint
image: golang:1.26
tags:
- linux-x86
cache:
- key: go-mod
paths:
- .cache/go-mod
- .cache/go-build
policy: pull-push
- key:
files:
- docs-site/themes/hugo-geekdoc/package-lock.json
prefix: npm-docs
paths:
- docs-site/themes/hugo-geekdoc/node_modules
policy: pull-push
variables:
GOMODCACHE: $CI_PROJECT_DIR/.cache/go-mod
GOCACHE: $CI_PROJECT_DIR/.cache/go-build
GIT_SUBMODULE_STRATEGY: recursive
GIT_DEPTH: 0
before_script:
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && apt-get install -y -qq nodejs
- go install github.com/gohugoio/hugo@v${HUGO_VERSION}
script:
- cd docs-site/themes/hugo-geekdoc && npm install && npm run build
- cd ../../..
- cd docs-site
- hugo --minify --baseURL "${CI_PAGES_URL}/"
- mv public ../public
artifacts:
paths:
- public
only:
- master