rbxcompiler/.gitlab-ci.yml

60 lines
1.5 KiB
YAML
Raw Normal View History

2020-09-29 20:58:00 +00:00
image: golang:1.14.2
variables:
2021-08-11 00:16:40 +00:00
REPO_NAME: git.itzana.me/qtdb/rbxcompile
2020-09-29 20:58:00 +00:00
before_script:
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
- cd $GOPATH/src/$REPO_NAME
2021-08-11 00:16:40 +00:00
- echo -e "machine git.itzana.me login gitlab-ci-token password ${CI_JOB_TOKEN}" > ~/.netrc
2020-09-29 20:58:00 +00:00
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