-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
42 lines (38 loc) · 1.23 KB
/
.gitlab-ci.yml
File metadata and controls
42 lines (38 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# https://docs.gitlab.com/ci/yaml
stages: # List of stages for jobs, and their order of execution
- test
- build
docker-build:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
image: docker:cli
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
variables:
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script:
# Try to build the image
- docker build --pull --tag "$DOCKER_IMAGE_NAME" --target prod .
# But only push it in the registry when it is a long-term branch
- if [[ $PUSH == true ]]; then docker push "$DOCKER_IMAGE_NAME"; fi
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:latest
PUSH: "true"
- if: $CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_BRANCH == "fake-dev"
variables:
PUSH: "true"
- if: $CI_COMMIT_BRANCH
variables:
PUSH: "false"
checks:
image: ghcr.io/astral-sh/uv:0.7.20-bookworm-slim
stage: test
script:
- uv sync --locked --no-cache --extra dev
- uv run pytest
- uv run ruff check
- uv run ruff format --check