.gitlab-ci-server.yml 1.8 KB
Newer Older
Simon Kirsten's avatar
Simon Kirsten committed
1
# This is the CI file for the stream-server
2

Simon Kirsten's avatar
Simon Kirsten committed
3
4
server:
  stage: build
5
  image: golang:1.14
6
7
8

  before_script:
    - go mod download
9
10
    # load version from prep stage
    - export VERSION=$(cat version)
11
      # TWITCH_CLIENT_ID is supplied via the GitLab CI/CD environment variables. This way only project owners can see the private key
12
    - export LDFLAGS="-s -X stream-server.DefaultTwitchClientID=$TWITCH_CLIENT_ID -X stream-server.Version=$VERSION"
13

Simon Kirsten's avatar
Simon Kirsten committed
14
  script:
15
    # run pkger to pack /internal/static
16
    - go run github.com/markbates/pkger/cmd/pkger -o internal/server
17
18
19

    - env GOOS=darwin   GOARCH=386    go build -ldflags "$LDFLAGS" -o bin/$VERSION/darwin-x86/stream-server          ./cmd/stream-server
    - env GOOS=darwin   GOARCH=amd64  go build -ldflags "$LDFLAGS" -o bin/$VERSION/darwin-x86_64/stream-server       ./cmd/stream-server
Simon Kirsten's avatar
Simon Kirsten committed
20

21
22
23
24
    - env GOOS=linux    GOARCH=386    go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-x86/stream-server           ./cmd/stream-server
    - env GOOS=linux    GOARCH=amd64  go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-x86_64/stream-server        ./cmd/stream-server
    - env GOOS=linux    GOARCH=arm    go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-arm/stream-server           ./cmd/stream-server
    - env GOOS=linux    GOARCH=arm64  go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-arm64/stream-server         ./cmd/stream-server
Simon Kirsten's avatar
Simon Kirsten committed
25

26
27
    - env GOOS=windows  GOARCH=386    go build -ldflags "$LDFLAGS" -o bin/$VERSION/windows-x86/stream-server.exe     ./cmd/stream-server
    - env GOOS=windows  GOARCH=amd64  go build -ldflags "$LDFLAGS" -o bin/$VERSION/windows-x86_64/stream-server.exe  ./cmd/stream-server
Simon Kirsten's avatar
Simon Kirsten committed
28
29

  artifacts:
30
31
    paths: # pass bin directory to deploy stage
      - bin/
Simon Kirsten's avatar
Simon Kirsten committed
32
33
34

    # We don't really need to keep old builds. We can always just rebuild them
    expire_in: 1d