.gitlab-ci.yml 1.06 KB
Newer Older
Tomas's avatar
Tomas committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
image: privacybydesign/golang-dep:latest

cache:
  key: $CI_COMMIT_REF_SLUG
  paths:
  - vendor/

stages:
  - test
  - build

variables:
  PACKAGE_NAME: github.com/privacybydesign/irmago
  PLATFORMS: linux/amd64 darwin/amd64 windows/amd64 linux/arm linux/arm64

before_script:
  - set -euxo pipefail
  - mkdir -p "$GOPATH/src/$(dirname "$PACKAGE_NAME")"
  - ln -s "$CI_PROJECT_DIR" "$GOPATH/src/$PACKAGE_NAME"
  - cd "$GOPATH/src/$PACKAGE_NAME"
Tomas's avatar
Tomas committed
21
  - dep ensure -v
Tomas's avatar
Tomas committed
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

unit_tests:
  stage: test
  script:
  - go test -tags=local_tests -p 1 ./...

binaries:
  stage: build
  artifacts:
    paths:
      - artifacts/*
  script:
    - mkdir -p artifacts
    - for PLATFORM in $PLATFORMS; do
        export GOOS=${PLATFORM%/*};
        export GOARCH=${PLATFORM#*/};
        export CGO_ENABLED=0;
        export GOARM=7;

        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;