Files
akvorado/.gitlab-ci.yml
2025-07-27 21:44:28 +02:00

73 lines
1.9 KiB
YAML

---
stages:
- tests
- build
run tests:
stage: tests
image: golang:1.24-alpine
cache:
- key:
files:
- go.sum
paths:
- .go-cache/
- bin/
- key:
files:
- console/frontend/package-lock.json
paths:
- .npm-cache
script:
# Tests on GitLab do not include functional tests. This was the case in the
# past but this is a slight burden to maintain in addition to GitHub CI.
# Check commit ceaa6ebf8ef6 for the last version supporting functional
# tests.
- time apk add --no-cache git make gcc musl-dev shared-mime-info npm curl
- export GOMODCACHE=$PWD/.go-cache
- npm config --user set cache $PWD/.npm-cache
- time go mod download
- time make && ./bin/akvorado version
- time make test-race
- time make test-js
- time make test-coverage
coverage: '/Code coverage: [0-9.]+/'
artifacts:
reports:
junit:
- test/go/tests.xml
- test/js/tests.xml
coverage_report:
coverage_format: cobertura
path: test/go/coverage.xml
# To execute manually:
# gitlab-runner exec docker "run tests"
build docker image:
stage: build
image: docker:stable
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_MERGE_REQUEST_ID
script:
- |
mkdir -p ~/.docker
cat <<EOF > ~/.docker/config.json
{
"proxies":
{
"default":
{
"httpProxy": "$http_proxy",
"httpsProxy": "$https_proxy",
"noProxy": "127.0.0.1/8${NO_PROXY:+,}NO_PROXY${no_proxy:+,}$no_proxy"
}
}
}
EOF
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -f docker/Dockerfile -t $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH$CI_MERGE_REQUEST_ID .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH$CI_MERGE_REQUEST_ID