1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00
Files
go-chasquid-smtp/.gitlab-ci.yml
Alberto Bertogli a48af00162 gitlab-ci: Run go tests on multiple versions
This patch makes the GitLab CI config run go tests on Go 1.11 and the
latest Go release.

This is in addition to existing tests (which are renamed for clarity).

This replaces the main use case of Travis CI, which was to test on
multiple Go versions.
2020-05-17 11:49:03 +01:00

76 lines
2.0 KiB
YAML

stages:
- test
- image
# Go tests, on various Go versions.
.golang_template: &golang
stage: test
before_script:
- useradd --create-home --user-group testing
- chown -R testing:testing $GOPATH/ .
script:
- su testing -c "go mod download"
- su testing -c "go get ./..."
- su testing -c "make all"
- su testing -c "go test ./..."
- su testing -c "go test -race ./..."
golang_1.11:
<<: *golang
image: golang:1.11 # Version in Debian stable.
variables:
GO111MODULE: "on"
golang_latest:
<<: *golang
image: golang:latest
# Integration test, using the module versions from the repository.
integration_stable:
stage: test
image: docker:stable
services:
- docker:dind
script:
- docker info
- docker build -t chasquid-test -f test/Dockerfile .
- docker run chasquid-test env
- docker run chasquid-test make test
# Integration test, using the latest module versions.
integration_latest:
stage: test
image: docker:stable
services:
- docker:dind
script:
- docker info
- docker build -t chasquid-test --build-arg GO_GET_ARGS="-u=patch" -f test/Dockerfile .
- docker run chasquid-test env
- docker run chasquid-test make test
# Build docker image, upload to gitlab registry.
gitlab:
stage: image
image: docker:stable
services:
- docker:dind
script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME -f docker/Dockerfile .
- docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
# Build docker image, upload to dockerhub registry.
dockerhub:
stage: image
image: docker:stable
services:
- docker:dind
script:
- docker info
- docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD docker.io
- docker build -t index.docker.io/albertito/chasquid:$CI_BUILD_REF_NAME -f docker/Dockerfile .
- docker push index.docker.io/albertito/chasquid:$CI_BUILD_REF_NAME