-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
104 lines (89 loc) · 2.79 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
# Define the pipeline stages
stages:
- build
- code-style
- unit-tests
- integration-tests
- deploy
- release
# Define the default image
image: docker:27-cli
# Define the docker-dind service that is started for each job
services:
- name: docker:27-dind
# Define the preliminary scripts to run before every job
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build:
stage: build
script:
- docker compose build --build-arg BUILDKIT_INLINE_CACHE=1
- docker compose push
"code style / control-plane":
stage: code-style
script:
- docker compose run --no-deps control-plane npm run lint
- docker compose run --no-deps control-plane npx prettier --check "**/*.{js,json,md,ts,vue,yml}"
"code style / worker":
stage: code-style
script:
- docker compose run --no-deps worker cargo fmt --check
- docker compose run --no-deps worker cargo clippy
"unit tests / control-plane":
stage: unit-tests
script:
- docker compose run control-plane npx turbo run test --filter=@france-nuage/control-plane
"unit tests / worker":
stage: unit-tests
script:
- docker compose run --no-deps worker cargo test -- --test-threads=1
"integration tests":
stage: integration-tests
artifacts:
when: always
paths:
- apps/platform/playwright-report/
- docker-compose.log
expire_in: 1 day
after_script:
- docker compose logs > docker-compose.log
script:
- docker compose up --detach
- sleep 30 # TODO: replace by health check
- docker compose exec -e PW_TEST_HTML_REPORT_OPEN='never' platform npx playwright test --project=firefox --reporter=dot,html --trace=on
"Deploy / control-plane (staging)":
stage: deploy
script:
- docker build --target=release --file=apps/control-plane/Dockerfile --tag=${CI_REGISTRY_IMAGE}/control-plane:staging --push .
only:
- staging
"Deploy / control-plane (production)":
stage: deploy
script:
- docker build --target=release --file=apps/control-plane/Dockerfile --tag=${CI_REGISTRY_IMAGE}/control-plane:production --push .
only:
- master
"Deploy / worker (staging)":
stage: deploy
script:
- docker build --target=release --file=apps/worker-vm-status/Dockerfile --tag=${CI_REGISTRY_IMAGE}/worker:staging --push ./apps/worker-vm-status/
only:
- staging
"Deploy / worker (production)":
stage: deploy
script:
- docker build --target=release --file=apps/worker-vm-status/Dockerfile --tag=${CI_REGISTRY_IMAGE}/worker:production --push ./apps/worker-vm-status/
only:
- master
"Release":
image: node:22
stage: release
variables:
CI: "true"
before_script:
- git remote set-url origin "https://oauth2:${GITLAB_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git"
- npm install
script:
- npx semantic-release
only:
- master