forked from privacybydesign/irmago
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
52 lines (43 loc) · 1.25 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
image: privacybydesign/golang_sql:latest
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- vendor/go/pkg/mod/
stages:
- test
- build
variables:
GOFLAGS: -mod=readonly
GOPATH: ${CI_PROJECT_DIR}/vendor/go
PACKAGE_NAME: github.com/privacybydesign/irmago
PLATFORMS: linux/amd64 darwin/amd64 darwin/arm64 windows/amd64 linux/arm linux/arm64
before_script:
- set -euxo pipefail
- service mysql start
- mysql -e "create database test"
- mysql -e "grant all privileges on *.* to 'testuser'@'localhost' identified by 'testpassword'"
- mysql -e "flush privileges"
unit_tests:
stage: test
script:
- go test -tags=local_tests -p 1 ./...
binaries:
stage: build
artifacts:
# Disabling artifact expiry is not supported yet, so make
expire_in: 100 year
paths:
- artifacts/*
script:
- mkdir -p artifacts
- for PLATFORM in $PLATFORMS; do
export GOOS=${PLATFORM%/*};
export GOARCH=${PLATFORM#*/};
export CGO_ENABLED=0;
export GOARM=6;
OUTPUT_NAME="irma-${CI_COMMIT_REF_SLUG}-${GOOS}-${GOARCH}";
if [[ "$GOOS" == "windows" ]]; then
OUTPUT_NAME="${OUTPUT_NAME}.exe";
fi;
go build -a -ldflags '-extldflags "-static"' -o "artifacts/$OUTPUT_NAME" ./irma;
done;