2022-06-09 20:50:34 +02:00
|
|
|
image: "golang:latest"
|
|
|
|
|
|
|
|
variables:
|
|
|
|
# Tell 'docker:dind' to enable TLS (recommended)
|
|
|
|
# and generate certificates in the specified directory.
|
|
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
|
|
|
|
|
|
|
test-lint:
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- go install github.com/client9/misspell/cmd/misspell@latest
|
|
|
|
- find . -type f -not -path "./webroot/assets" | grep -v "models/.*_testdata.*.go" | xargs misspell -error
|
|
|
|
- ./.ci/check-gofmt
|
|
|
|
- ./.ci/check-testfiles
|
|
|
|
|
|
|
|
build-linux:
|
|
|
|
stage: build
|
|
|
|
except:
|
|
|
|
- tags
|
|
|
|
- master
|
|
|
|
- main
|
|
|
|
script:
|
|
|
|
# build app with version
|
|
|
|
- go install
|
|
|
|
- mv "/go/bin/$CI_PROJECT_NAME" "$CI_PROJECT_DIR/$CI_PROJECT_NAME"
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- config_example.toml
|
|
|
|
- "$CI_PROJECT_NAME"
|
|
|
|
|
2022-08-01 21:13:26 +02:00
|
|
|
build-docker-latest:
|
2022-06-09 20:50:34 +02:00
|
|
|
stage: build
|
|
|
|
image: docker:latest
|
|
|
|
services:
|
|
|
|
- docker:dind
|
2022-08-01 21:13:26 +02:00
|
|
|
only:
|
|
|
|
- main
|
|
|
|
- master
|
|
|
|
script:
|
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
|
|
- docker build --build-arg VERSION=$CI_COMMIT_TAG
|
|
|
|
-t $CI_REGISTRY_IMAGE:latest
|
|
|
|
.
|
|
|
|
- docker push $CI_REGISTRY_IMAGE:latest
|
|
|
|
|
|
|
|
build-docker-release:
|
|
|
|
stage: build
|
|
|
|
image: docker:latest
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
only:
|
|
|
|
- tags
|
2022-06-09 20:50:34 +02:00
|
|
|
script:
|
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
2022-08-01 21:13:26 +02:00
|
|
|
- docker build --build-arg VERSION=$CI_COMMIT_TAG
|
|
|
|
-t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
|
|
|
-t $CI_REGISTRY_IMAGE:${CI_COMMIT_TAG%\.[0-9]*}
|
|
|
|
-t $CI_REGISTRY_IMAGE:${CI_COMMIT_TAG%\.[0-9]*\.[0-9]*}
|
|
|
|
.
|
|
|
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
|
|
|
- docker push $CI_REGISTRY_IMAGE:${CI_COMMIT_TAG%\.[0-9]*}
|
|
|
|
- docker push $CI_REGISTRY_IMAGE:${CI_COMMIT_TAG%\.[0-9]*\.[0-9]*}
|
2022-06-09 20:50:34 +02:00
|
|
|
|
|
|
|
build-release:
|
|
|
|
stage: build
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
script:
|
|
|
|
# build app with version
|
|
|
|
- go install
|
|
|
|
- mv "/go/bin/$CI_PROJECT_NAME" "$CI_PROJECT_DIR/$CI_PROJECT_NAME"
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- config_example.toml
|
|
|
|
- "$CI_PROJECT_NAME"
|
|
|
|
expire_in: never
|