-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
82 lines (77 loc) · 2.38 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
services:
- docker:dind
stages:
- test
- build
- deploy
# Run flake8 to check for code quality
# And also optionally run unit tests
tests:
image: python:3-bullseye
stage: test
script:
- pip install flake8
- flake8 api
# Run unit tests
- cd api
- pip install -r requirements.txt
- python -m pytest
# # Build API Image:
# # This job builds the API docker image and pushes it to the GitLab docker registry
# # When this job finishes you will need to use the glv-cloud-cli reset command
# # To deploy the new image
build-api-image:
stage: build
image: docker:git
needs:
- tests
variables:
GITLAB_IMAGE: ${CI_REGISTRY_IMAGE}/api
before_script:
# $CI_JOB_TOKEN is variable automatically added by Gitlab: see https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token registry.gitlab.com --password-stdin
script:
- docker build --tag $GITLAB_IMAGE:latest ./api
- docker push $GITLAB_IMAGE:latest
only:
- main
# # Build the React/JavaScript front-end
build-front-end-job:
stage: build
image: node:lts-bullseye
needs:
- tests
variables:
# If either of these variables is defined in the GitLab
# CI/CD variables, that value will override the value here.
# You need to substitute in your real values for
# GROUP_NAME, PROJECT_NAME, & WEBSERVICE_NAME below.
# Don't forget to also replace PROJECT NAME in the npm run build line as well
PROJECT_NAME: https://purveyors-of-progress.gitlab.io/life-link-project-gamma/
VITE_API_HOST: https://oct-2023-8-et-api.mod3projects.com
VITE_PUBLIC_URL: https://life-link-project-gamma-purveyors-of-progress-cbd3ad7e97f6d732f.gitlab.io/
script:
- cd ghi
- npm install
- npm run lint
- npm run build
# -- --base=https://purveyors-of-progress.gitlab.io/life-link-project-gamma/
# The following line creates a _redirects file to redirect all URLs to index.html
- echo "/* /index.html 200" > dist/_redirects
artifacts:
paths:
- ghi/dist/
# # Deploy the React/JavaScript front-end to GitLab pages
pages:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
dependencies:
- build-front-end-job
needs:
- build-front-end-job
script:
- mv ghi/dist/ public
artifacts:
paths:
- public