-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
116 lines (99 loc) · 2.95 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
114
115
116
stages:
- test
- compatibility
- release
.common: &common
tags:
- shell
interruptible: true
before_script:
- export TAG=$(date '+%Y.%m.%d')
# - printenv
#-----------------------------------------
eslint:
stage: test
interruptible: true
image: registry.gitlab.com/pipeline-components/eslint:0.72.0
script:
- (cd back && eslint --color .)
- (cd compatibility && eslint --color .)
clean:
<<: *common
stage: test
image: node:alpine
script:
- docker container prune -f
- docker volume prune --all -f
- docker system prune --all --volumes -f
#-----------------------------------------
.compatibility: &compatibility
<<: *common
stage: compatibility
image: docker:latest
script:
- (cd back && npm run docker:build)
- cd compatibility
- npm install --prod --frozen-lockfile
- npm run test:app
- npm run test:report || echo
- npm run fail:junit
short_compatibility:
<<: *compatibility
rules:
- if: $CI_PIPELINE_SOURCE != "schedule"
when: on_success
full_compatibility:
<<: *compatibility
timeout: 2h
stage: compatibility
image: docker:latest
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
artifacts:
expire_in: never
paths:
- ./compatibility/report.xml
#-----------------------------------------
release:
<<: *common
dependencies:
- short_compatibility
stage: release
rules:
- if: $CI_PIPELINE_SOURCE != "schedule"
when: on_success
image: docker:latest
variables:
IMAGE_NAME: webdb/app
script:
- sed -i "s/PACKAGE_VERSION/${TAG}/g" back/package.json
- sed -i "s/PACKAGE_VERSION/${TAG}/g" front/package.json
- cd front
- pnpm install --prod --frozen-lockfile
- pnpm run build
- rm -rf dist/webdb/*.map
- ./changelog.js ./dist/webdb/changelog.html
- cp -fr ./dist/webdb/* ../back/static/
- cd ../back
- docker login -u 'aleluff' -p $DOCKER_PASS
- docker buildx create --use
- >
if [ "$CI_COMMIT_REF_NAME" == "main" ]; then
docker buildx build \
--platform linux/arm64,linux/amd64 \
--sbom=true \
--provenance=true \
-t $IMAGE_NAME:$CI_COMMIT_REF_NAME \
-t $IMAGE_NAME:$TAG \
-t $IMAGE_NAME \
--push .
else
docker buildx build \
--platform linux/arm64,linux/amd64 \
--sbom=true \
--provenance=true \
-t $IMAGE_NAME:$CI_COMMIT_REF_NAME \
--push .
fi
- docker rm -f $(docker ps -a -q --filter ancestor=moby/buildkit:buildx-stable-1)