forked from tulir/gomuks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
123 lines (112 loc) · 3.26 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
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
stages:
- build
- package
default:
before_script:
- mkdir -p .cache
- export GOPATH="$CI_PROJECT_DIR/.cache"
cache:
paths:
- .cache
.build-linux: &build-linux
stage: build
before_script:
- export GO_LDFLAGS="-s -w -linkmode external -extldflags -static -X main.Tag=$CI_COMMIT_TAG -X main.Commit=$CI_COMMIT_SHA -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`'"
script:
- go build -ldflags "$GO_LDFLAGS" -o gomuks
artifacts:
paths:
- gomuks
linux/amd64:
<<: *build-linux
image: dock.mau.dev/tulir/gomuks-build-docker:linux-amd64
linux/arm:
<<: *build-linux
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm
linux/arm64:
<<: *build-linux
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm64-native
tags:
- linux
- arm64
windows/amd64:
image: dock.mau.dev/tulir/gomuks-build-docker:windows-amd64
stage: build
script:
- go build -o gomuks.exe
artifacts:
paths:
- gomuks.exe
macos/amd64:
stage: build
tags:
- macos
- amd64
before_script:
- export GO_LDFLAGS="-X main.Tag=$CI_COMMIT_TAG -X main.Commit=$CI_COMMIT_SHA -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`'"
script:
- mkdir gomuks-macos-amd64
- go build -ldflags "$GO_LDFLAGS" -o gomuks-macos-amd64/gomuks
- install_name_tool -change /usr/local/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3.dylib gomuks-macos-amd64/gomuks
- install_name_tool -add_rpath @executable_path gomuks-macos-amd64/gomuks
- install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks-macos-amd64/gomuks
- cp /usr/local/opt/libolm/lib/libolm.3.dylib gomuks-macos-amd64/
artifacts:
paths:
- gomuks-macos-amd64
macos/arm64:
stage: build
tags:
- macos
- arm64
before_script:
- export LIBRARY_PATH=/opt/homebrew/lib
- export CPATH=/opt/homebrew/include
- export PATH=/opt/homebrew/bin:$PATH
- export GO_LDFLAGS="-X main.Tag=$CI_COMMIT_TAG -X main.Commit=$CI_COMMIT_SHA -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`'"
script:
- mkdir gomuks-macos-arm64
- go build -ldflags "$GO_LDFLAGS" -o gomuks-macos-arm64/gomuks
- install_name_tool -change /opt/homebrew/opt/libolm/lib/libolm.3.dylib @rpath/libolm.3.dylib gomuks-macos-arm64/gomuks
- install_name_tool -add_rpath @executable_path gomuks-macos-arm64/gomuks
- install_name_tool -add_rpath /opt/homebrew/opt/libolm/lib gomuks-macos-arm64/gomuks
- install_name_tool -add_rpath /usr/local/opt/libolm/lib gomuks-macos-arm64/gomuks
- cp /opt/homebrew/opt/libolm/lib/libolm.3.dylib gomuks-macos-arm64/
artifacts:
paths:
- gomuks-macos-arm64
macos/universal:
stage: package
tags:
- macos
dependencies:
- macos/amd64
- macos/arm64
needs:
- macos/amd64
- macos/arm64
variables:
GIT_STRATEGY: none
script:
- lipo -create -output libolm.3.dylib gomuks-macos-arm64/libolm.3.dylib gomuks-macos-amd64/libolm.3.dylib
- lipo -create -output gomuks gomuks-macos-arm64/gomuks gomuks-macos-amd64/gomuks
artifacts:
name: gomuks-macos-universal
paths:
- libolm.3.dylib
- gomuks
debian:
image: debian
stage: package
dependencies:
- linux/amd64
only:
- tags
script:
- mkdir -p deb/usr/bin
- cp gomuks deb/usr/bin/gomuks
- chmod -R -s deb/DEBIAN && chmod -R 0755 deb/DEBIAN
- dpkg-deb --build deb gomuks.deb
artifacts:
paths:
- gomuks.deb