2022-08-22 15:30:23 +00:00
|
|
|
image: node:latest
|
|
|
|
|
|
|
|
stages:
|
2022-08-25 13:13:44 +00:00
|
|
|
- setup
|
2022-08-22 15:30:23 +00:00
|
|
|
- test
|
|
|
|
- build
|
|
|
|
- package
|
|
|
|
|
2022-08-24 08:06:18 +00:00
|
|
|
cache: &global_cache
|
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- yarn.lock
|
|
|
|
- frontend/yarn.lock
|
|
|
|
paths:
|
|
|
|
- .yarn
|
|
|
|
- node_modules
|
|
|
|
- frontend/.yarn
|
|
|
|
- frontend/node_modules
|
|
|
|
policy: pull
|
2022-08-22 15:42:11 +00:00
|
|
|
|
|
|
|
before_script:
|
2022-08-23 18:35:30 +00:00
|
|
|
- yarn install --cache-folder .yarn --frozen-lockfile
|
|
|
|
- cd frontend
|
|
|
|
- yarn install --cache-folder .yarn --frozen-lockfile
|
|
|
|
- cd ..
|
2022-08-22 15:42:11 +00:00
|
|
|
|
2022-08-25 13:13:44 +00:00
|
|
|
test_build_dto:
|
|
|
|
stage: setup
|
2022-08-24 08:06:18 +00:00
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
|
|
|
policy: pull-push
|
2022-08-25 13:13:44 +00:00
|
|
|
before_script: []
|
|
|
|
script:
|
|
|
|
- cd dto
|
|
|
|
- yarn install --frozen-lockfile
|
|
|
|
- yarn lint
|
|
|
|
- yarn build
|
|
|
|
- cd ..
|
|
|
|
- yarn install --cache-folder .yarn --frozen-lockfile
|
|
|
|
- yarn add ./dto
|
|
|
|
- cd frontend
|
|
|
|
- yarn install --cache-folder .yarn --frozen-lockfile
|
|
|
|
- yarn add ../dto
|
|
|
|
|
|
|
|
|
|
|
|
test_backend:
|
|
|
|
needs: ["test_build_dto"]
|
2022-08-22 15:30:23 +00:00
|
|
|
stage: test
|
|
|
|
script:
|
2022-08-22 16:10:41 +00:00
|
|
|
- yarn lint
|
2022-08-22 15:30:23 +00:00
|
|
|
|
|
|
|
test_frontend:
|
2022-08-25 13:13:44 +00:00
|
|
|
needs: ["test_build_dto"]
|
2022-08-22 15:30:23 +00:00
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- cd frontend
|
2022-08-22 16:10:41 +00:00
|
|
|
- yarn lint
|
2022-08-22 15:30:23 +00:00
|
|
|
|
|
|
|
build_backend:
|
|
|
|
stage: build
|
|
|
|
needs:
|
|
|
|
- job: test_backend
|
|
|
|
artifacts: false
|
|
|
|
script:
|
2022-08-22 16:10:41 +00:00
|
|
|
- yarn webpack
|
2022-08-22 15:30:23 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- dist/
|
|
|
|
expire_in: 1h
|
|
|
|
|
|
|
|
build_frontend:
|
|
|
|
stage: build
|
|
|
|
needs:
|
|
|
|
- job: test_frontend
|
|
|
|
artifacts: false
|
|
|
|
script:
|
|
|
|
- cd frontend
|
2022-08-22 16:10:41 +00:00
|
|
|
- yarn build
|
2022-08-22 15:30:23 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- frontend/dist/
|
|
|
|
expire_in: 1h
|
|
|
|
|
|
|
|
package_server:
|
|
|
|
stage: package
|
2022-08-22 15:42:11 +00:00
|
|
|
cache: []
|
2022-08-23 09:32:50 +00:00
|
|
|
before_script: []
|
2022-08-22 15:30:23 +00:00
|
|
|
needs:
|
|
|
|
- job: build_backend
|
|
|
|
artifacts: true
|
|
|
|
- job: build_frontend
|
|
|
|
artifacts: true
|
|
|
|
script:
|
|
|
|
- TMP=$(mktemp -d)
|
|
|
|
- mv dist/* "$TMP"
|
|
|
|
- mkdir "$TMP/frontend"
|
|
|
|
- mv frontend/dist/* "$TMP/frontend"
|
|
|
|
- rm -r *
|
2022-08-22 17:06:20 +00:00
|
|
|
- rm -r .* || true
|
2022-08-23 09:30:27 +00:00
|
|
|
- mv "$TMP/"* .
|
2022-08-22 15:30:23 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2022-08-23 18:35:30 +00:00
|
|
|
- package.json
|
|
|
|
- server.js
|
|
|
|
- frontend/
|