image: node:latest stages: - setup - test - build - package cache: &global_cache key: files: - yarn.lock - frontend/yarn.lock paths: - .yarn - node_modules - frontend/.yarn - frontend/node_modules policy: pull before_script: - yarn install --cache-folder .yarn --frozen-lockfile - cd frontend - yarn install --cache-folder .yarn --frozen-lockfile - cd .. test_build_dto: stage: setup cache: <<: *global_cache policy: pull-push 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"] stage: test script: - yarn lint test_frontend: needs: ["test_build_dto"] stage: test script: - cd frontend - yarn lint build_backend: stage: build needs: - job: test_backend artifacts: false script: - yarn webpack artifacts: paths: - dist/ expire_in: 1h build_frontend: stage: build needs: - job: test_frontend artifacts: false script: - cd frontend - yarn build artifacts: paths: - frontend/dist/ expire_in: 1h package_server: stage: package cache: [] before_script: [] 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 * - rm -r .* || true - mv "$TMP/"* . artifacts: paths: - package.json - server.js - frontend/