-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
113 lines (100 loc) · 2.82 KB
/
.gitlab-ci.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
include:
- project: 'kmohrf/gitlabfilet'
ref: 'v1.4.0'
file:
- '/templates/python.gitlab-ci.yml'
- '/templates/container.gitlab-ci.yml'
variables:
GITLABFILET_IMAGE: git-registry.hack-hro.de:443/kmohrf/docker-recipes/debbuild-python-webdev:bookworm
workflow:
rules:
# Run manually triggered pipelines
- if: $CI_PIPELINE_SOURCE == "web"
# Skip if there's a wip commit
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_MESSAGE =~ /^wip:.*/'
when: never
# Prevent duplicate pipelines
# See: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
# Run in merge requests
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Don't run branch pipelines for merge requests
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
# Run branch pipelines when there's no merge request open
- if: $CI_COMMIT_BRANCH
# Run tag pipelines
- if: $CI_COMMIT_TAG
default:
tags:
- fast-io
- fast-network
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .npm/
stages:
- test
- build
- deploy
.js-tests:
stage: test
image: node:lts-alpine
before_script:
- ADBLOCK=true npm ci --cache .npm --prefer-offline
lint::js:
extends: .js-tests
script:
- npm run lint
test::js:
extends: .js-tests
script:
- npm run test
test::python:
services:
- postgis/postgis:15-3.4-alpine
variables:
TOX_SKIP_ENV: lint-*
POSTGRES_DB: turtlemail
POSTGRES_USER: turtlemail
POSTGRES_PASSWORD: 'turtlemail'
DATABASE_URL: 'postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgis-postgis/$POSTGRES_DB'
TOX_TESTENV_PASSENV: DATABASE_URL
before_script:
- apt update -y
- apt install -y binutils libproj-dev gdal-bin
lint::python:
before_script:
- apt update -y
# Needed to run the "check-migrations" pre-commit hook
- apt install -y binutils libproj-dev gdal-bin
deploy::container-image:
variables:
KANIKO_ARGS: --target production
.deploy-to-env:
stage: deploy
image: alpine
before_script:
- apk add curl
script:
- curl --fail-with-body --form "environment=$CI_ENVIRONMENT_SLUG" --user "$DEPLOYMENT_HOOK_AUTH" "$DEPLOYMENT_HOOK_URL"
deploy::to-staging:
extends: .deploy-to-env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
needs:
- job: deploy::container-image
environment:
name: staging
url: https://staging.turtlemail.app
deploy::to-production:
extends: .deploy-to-env
rules:
- if: $CI_COMMIT_TAG
needs:
- job: deploy::bump-container-image
environment:
name: production
url: https://turtlemail.app
when: manual
# TODO: uncomment once the GitLab is updated to v17.1
# manual_confirmation: "Are you sure you want deploy $CI_COMMIT_TAG to PRODUCTION on turtlemail.app?"