-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
58 lines (53 loc) · 1.15 KB
/
.gitlab-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
default:
image: reg.agarg.me/build/golang:latest-1.18.7-bullseye
tags:
- agarg-public-projects
stages:
- pre-flight
- build
- release
.global-vars:
variables:
GOOS: linux
GOARCH: arm
GOARM: 6
RELEASE_BIN: alsaRemoteControl-${GOARCH}-${GOARM}-${CI_COMMIT_REF_NAME}
go-fmt-vet:
stage: pre-flight
extends:
- .global-vars
script:
- fmt_output=$(find -name vendor -prune -o -type f -name '*.go' -print0 | xargs -0 gofmt -l)
- echo "${fmt_output}"
- test -z "${fmt_output}"
- go vet ./...
compile:
stage: build
extends:
- .global-vars
script:
- go build -ldflags "-extldflags '-static'" -o "${CI_PROJECT_DIR}/${RELEASE_BIN}" .
- xz $RELEASE_BIN
artifacts:
name: "compile_to_publish-$CI_COMMIT_REF_SLUG"
expose_as: compile_to_publish
paths:
- ${RELEASE_BIN}.xz
- .ci/publish
expire_in: 1 hour
dependencies:
- go-fmt-vet
release:
stage: release
extends:
- .global-vars
variables:
GIT_STRATEGY: none
script:
- sh .ci/publish
dependencies:
- compile
rules:
- if: $CI_COMMIT_REF_PROTECTED == "true"
when: always
- when: never