Various useful and handy GitLab CI YAML templates for typical GitLab CI tasks.
[[TOC]]
include
keyword in your .gitlab-ci.yml
filesinclude:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
# Building Go source files
go-build:
extends: .go-build
# Validating source file format, imports, errors and linting Go source files
go-lint:
extends: .go-lint
# Running tests, validating coverage and generating test and coverage reports
go-test:
extends: .go-test
# Checking licences for built Go binaries
go-license:
extends: .go-license
# Genering HTML source code documentation and HTML coverage report. Upload them
# to GitLab Pages site for browsing. Dependencies is needed to download
# generated coverage report artifact from previous test job
pages:
extends: .go-doc
dependencies:
- test
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
# It builds Docker image
docker-build:
extends: .docker-build
# It lints Dockerfiles
docker-lint:
extends: .docker-lint
# It tests built Docker image
docker-test:
extends: .docker-test
script:
- <run-my-tests-inside-docker>
# It deploys edge image to registry
docker-edge:
extends: .docker-edge
# It deploys latest image to registry
docker-latest:
extends: .docker-latest
# It deploys release image to registry
docker-deploy:
extends: .docker-deploy
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
shell-lint:
extends: .shell-lint
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
markdown-lint:
extends: .markdown-lint
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
yaml-lint:
extends: .yaml-lint
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
json-lint:
extends: .json-lint
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
workspace-lint:
extends: .workspace-lint
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
license-lint:
extends: .license-lint
include:
- project: 'tymonx/gitlab-ci'
ref: v1.11.2
file: '/templates.yml'
openapi-lint:
extends: .openapi-lint
pages:
extends: .openapi-doc
To run all linter tools locally:
./scripts/lint
To run specific linter tools locally:
./scripts/lint yaml json markdown workspace license
To run specific tool locally:
./scripts/yaml
To run specific linter tool locally:
./scripts/yaml lint
To build all Docker images:
./scripts/build
To build specific Docker images:
./scripts/build yaml json markdown
GitLab CI YAML templates documentation.