image: golang:1.14.2 variables: REPO_NAME: ci.itzana.me/qtdb/rbxcompile before_script: - mkdir -p $GOPATH/src/$(dirname $REPO_NAME) - ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME - cd $GOPATH/src/$REPO_NAME - echo -e "machine ci.itzana.me login gitlab-ci-token password ${CI_JOB_TOKEN}" > ~/.netrc stages: - test - build - deploy format: stage: test script: - go fmt $(go list ./... | grep -v /vendor/) - go vet $(go list ./... | grep -v /vendor/) - go test -race $(go list ./... | grep -v /vendor/) compile: stage: build script: - CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o $CI_PROJECT_DIR/rbxcompiler ./cmd/rbxcompiler artifacts: paths: - rbxcompiler docker-build-release: image: docker:latest stage: deploy services: - docker:dind before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - docker build --pull -t "$CI_REGISTRY_IMAGE/release" . - docker build --pull -t "$CI_REGISTRY_IMAGE/release:$CI_COMMIT_SHA" . - docker push "$CI_REGISTRY_IMAGE/release" - docker push "$CI_REGISTRY_IMAGE/release:$CI_COMMIT_SHA" only: refs: - master docker-build-dev: image: docker:latest stage: deploy services: - docker:dind before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - docker build --pull -t "$CI_REGISTRY_IMAGE/test:$CI_COMMIT_REF_SLUG" . - docker push "$CI_REGISTRY_IMAGE/test:$CI_COMMIT_REF_SLUG" except: refs: - master