-
Notifications
You must be signed in to change notification settings - Fork 175
/
.gitlab-ci.yml
115 lines (107 loc) · 5.02 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
stages: # List of stages for jobs, and their order of execution
- build
- after_build
- after_pack
- test
variables:
GOPROXY: https://goproxy.cn,direct
# GOPATH: "$CI_PROJECT_DIR/.go"
# GOBIN: "$CI_PROJECT_DIR/.go/bin"
CGO_ENABLED: '0'
# DENO_DIR: "$CI_PROJECT_DIR/.deno"
# GOCACHE: "$CI_PROJECT_DIR/.go-cache"
compose-build:
tags:
- client-build-shell
stage: build
artifacts:
expire_in: 1 day
paths:
- out/bin/*
- ci/push
before_script:
- mkdir -p .go-cache
- mkdir -p .go
rules:
- if: '$CI_COMMIT_TAG == null'
script:
- GOOS=windows GOARCH=amd64 go build -v -ldflags "-s -w -buildid=" -trimpath -o out/bin/murphysec-windows-amd64.exe .
- GOOS=windows GOARCH=arm64 go build -v -ldflags "-s -w -buildid=" -trimpath -o out/bin/murphysec-windows-arm64.exe .
- GOOS=linux GOARCH=amd64 go build -v -ldflags "-s -w -buildid=" -trimpath -o out/bin/murphysec-linux-amd64 .
- GOOS=linux GOARCH=arm64 go build -v -ldflags "-s -w -buildid=" -trimpath -o out/bin/murphysec-linux-arm64 .
- GOOS=darwin GOARCH=amd64 go build -v -ldflags "-s -w -buildid=" -trimpath -o out/bin/murphysec-darwin-amd64 .
- GOOS=darwin GOARCH=arm64 go build -v -ldflags "-s -w -buildid=" -trimpath -o out/bin/murphysec-darwin-arm64 .
- go build -v -ldflags "-s -w" -trimpath -o ci/push ./ci
compose-build-with-tag:
tags:
- client-build-shell
stage: build
artifacts:
expire_in: 1 day
paths:
- out/bin/*
- ci/push
before_script:
- mkdir -p .go-cache
- mkdir -p .go
rules:
- if: '$CI_COMMIT_TAG != null'
script:
- GOOS=windows GOARCH=amd64 go build -v -ldflags "-s -w -X github.com/murphysecurity/murphysec/infra/buildinfo.version=$CI_COMMIT_TAG -buildid=" -trimpath -o out/bin/murphysec-windows-amd64.exe .
- GOOS=windows GOARCH=arm64 go build -v -ldflags "-s -w -X github.com/murphysecurity/murphysec/infra/buildinfo.version=$CI_COMMIT_TAG -buildid=" -trimpath -o out/bin/murphysec-windows-arm64.exe .
- GOOS=linux GOARCH=amd64 go build -v -ldflags "-s -w -X github.com/murphysecurity/murphysec/infra/buildinfo.version=$CI_COMMIT_TAG -buildid=" -trimpath -o out/bin/murphysec-linux-amd64 .
- GOOS=linux GOARCH=arm64 go build -v -ldflags "-s -w -X github.com/murphysecurity/murphysec/infra/buildinfo.version=$CI_COMMIT_TAG -buildid=" -trimpath -o out/bin/murphysec-linux-arm64 .
- GOOS=darwin GOARCH=amd64 go build -v -ldflags "-s -w -X github.com/murphysecurity/murphysec/infra/buildinfo.version=$CI_COMMIT_TAG -buildid=" -trimpath -o out/bin/murphysec-darwin-amd64 .
- GOOS=darwin GOARCH=arm64 go build -v -ldflags "-s -w -X github.com/murphysecurity/murphysec/infra/buildinfo.version=$CI_COMMIT_TAG -buildid=" -trimpath -o out/bin/murphysec-darwin-arm64 .
- go build -v -ldflags "-s -w" -trimpath -o ci/push ./ci
pack:
tags:
- client-build-shell
stage: after_build
artifacts:
expire_in: 1 day
paths:
- out/zip/pro.zip
script:
- mkdir out/zip
- cd out/bin && (ls -1 | xargs -I {} sh -c "sha256sum {} | grep -Po '^\\w+' > {}.sha256") && cd ../..
- bash -c "cd out/bin/ && zip ../zip/pro.zip *"
internal-cos-upload:
image: iseki0/cos-uploader:v1.1.3
stage: after_pack
script:
- cos-uploader --local out/bin/murphysec-windows-amd64.exe --remote /client/$CI_BUILD_REF_NAME/murphysec-windows-amd64.exe
- cos-uploader --local out/bin/murphysec-windows-arm64.exe --remote /client/$CI_BUILD_REF_NAME/murphysec-windows-arm64.exe
- cos-uploader --local out/bin/murphysec-linux-amd64 --remote /client/$CI_BUILD_REF_NAME/murphysec-linux-amd64
- cos-uploader --local out/bin/murphysec-linux-arm64 --remote /client/$CI_BUILD_REF_NAME/murphysec-linux-arm64
- cos-uploader --local out/bin/murphysec-darwin-amd64 --remote /client/$CI_BUILD_REF_NAME/murphysec-darwin-amd64
- cos-uploader --local out/bin/murphysec-darwin-arm64 --remote /client/$CI_BUILD_REF_NAME/murphysec-darwin-arm64
- cos-uploader --local out/zip/pro.zip --remote /client/$CI_BUILD_REF_NAME/pro.zip
- cos-uploader --local out/bin/murphysec-windows-amd64.exe --remote /client/-/murphysec-windows-amd64.exe
- cos-uploader --local out/bin/murphysec-windows-arm64.exe --remote /client/-/murphysec-windows-arm64.exe
- cos-uploader --local out/bin/murphysec-linux-amd64 --remote /client/-/murphysec-linux-amd64
- cos-uploader --local out/bin/murphysec-linux-arm64 --remote /client/-/murphysec-linux-arm64
- cos-uploader --local out/bin/murphysec-darwin-amd64 --remote /client/-/murphysec-darwin-amd64
- cos-uploader --local out/bin/murphysec-darwin-arm64 --remote /client/-/murphysec-darwin-arm64
- cos-uploader --local out/zip/pro.zip --remote /client/-/pro.zip
lark-notify:
tags:
- client-build-shell
stage: after_pack
cache:
key: cli-deno-cache-1223
paths:
- .deno
script:
- chmod 755 ci/push && ci/push
test:
tags:
- client-build-shell
stage: test
dependencies: [ ]
script:
- gotestsum --junitfile report.xml --format testname
artifacts:
when: always
reports:
junit: report.xml