-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
88 lines (79 loc) · 2.26 KB
/
.gitlab-ci.yml
File metadata and controls
88 lines (79 loc) · 2.26 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# GitLab CI pipeline to build and push a Docker image to Docker Hub
#
# Required CI/CD variables (Settings > CI/CD > Variables):
# - DOCKERHUB_USERNAME: your Docker Hub username
# - DOCKERHUB_TOKEN: a Docker Hub Access Token (recommended) or password
# - DOCKERHUB_REPO: full repository name on Docker Hub, e.g. "myuser/gopro-immich-uploader"
#
# Tagging strategy:
# - latest on default branch
# - version from a VERSION file on default branch
# - sha-<shortsha> on all commits
stages:
- secret-detection
- lint
- build
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_DRIVER: overlay2
SECRET_DETECTION_ENABLED: 'true'
secret_detection:
stage: secret-detection
include:
- template: Security/Secret-Detection.gitlab-ci.yml
.release-rules:
rules:
# Skip build on chore commits
- if: '$CI_COMMIT_MESSAGE =~ /^chore:/'
when: never
# Run on default branch and merge requests
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH'
format-check:
extends: .release-rules
image: python:3.13-slim
stage: lint
before_script:
- pip install --no-cache-dir -r requirements-dev.txt
script:
- ruff format --check .
lint:
extends: .release-rules
image: python:3.13-slim
stage: lint
before_script:
- pip install --no-cache-dir -r requirements-dev.txt
script:
- ruff check .
type-check:
extends: .release-rules
image: python:3.13-slim
stage: lint
before_script:
- pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
script:
- mypy gopro_immich_uploader
build-and-push:
extends: .release-rules
image: docker:28.4.0
services:
- name: docker:28.4.0-dind
command: ["--mtu=1460"]
stage: build
before_script:
- apk add --no-cache bash
- |
if [ -z "$DOCKERHUB_USERNAME" ] || [ -z "$DOCKERHUB_TOKEN" ] || [ -z "$DOCKERHUB_REPO" ]; then
echo "ERROR: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN and DOCKERHUB_REPO variables must be set." >&2
exit 1
fi
- echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
script:
- ./ci/build_and_push.sh
after_script:
- docker logout
artifacts:
when: on_failure
reports:
dotenv: [] # keep minimal; no artifacts saved