diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index fb76dd47..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Check https://circleci.com/docs/2.0/language-javascript/ for more details - -version: 2 -jobs: - build: - docker: - - image: circleci/node:11-browsers - - working_directory: ~/repo - - steps: - - checkout - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - run: npm install - - save_cache: - paths: - - node_modules - key: v1-dependencies-{{ checksum "package.json" }} - - run: npm run test - - run: npm run lint:prod - - run: npm run build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..ed64b4c7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,61 @@ +include: + - template: Auto-DevOps.gitlab-ci.yml + +build: + stage: build + image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image:v0.4.0" + cache: {} + variables: + DOCKER_TLS_CERTDIR: "" + services: + - docker:19.03.12-dind + script: + - | + if [[ -z "$CI_COMMIT_TAG" ]]; then + export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG} + export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_SHA} + else + export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE} + export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG} + fi + - ./bin/build.sh + rules: + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - .npm + - node_modules + +variables: + AUTO_DEVOPS_BUILD_IMAGE_CNB_ENABLED: "true" + AUTO_DEVOPS_BUILD_IMAGE_CNB_BUILDER: "heroku/buildpacks:20" + BUILDPACK_URL: "heroku/nodejs" + npm_config_cache: "$CI_PROJECT_DIR/.npm" + +test: + stage: test + image: node:12.20.0-stretch + before_script: + - npm ci --cache .npm --prefer-offline + script: + - npm install + - npm run test + rules: + - if: '$TEST_DISABLED' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + +lint: + stage: test + image: node:12.20.0-stretch + before_script: + - npm ci --cache .npm --prefer-offline + script: + - npm install + - npm run lint:prod + rules: + - if: '$TEST_DISABLED' + when: never + - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' diff --git a/.tool-versions b/.tool-versions index 6d0c49d0..ce931746 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -nodejs 11.7.0 +nodejs 12.20.0 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 3d8bfc2b..00000000 --- a/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM node:lts-alpine - -# install simple http server for serving static content -RUN npm install -g http-server - -# make the 'app' folder the current working directory -WORKDIR /app - -# copy both 'package.json' and 'package-lock.json' (if available) -COPY package*.json ./ - -# install project dependencies -RUN npm install - -# copy project files and folders to the current working directory (i.e. 'app' folder) -COPY . . - -# build app for development -RUN npm run build - -EXPOSE 8080 -CMD [ "http-server", "dist" ] \ No newline at end of file diff --git a/README.md b/README.md index 15d4443e..5835b258 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > Online tutoring platform built with Vue.js and Webpack -[![CircleCI](https://circleci.com/gh/UPchieve/web.svg?style=svg)](https://circleci.com/gh/UPchieve/web) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md) ## GITLAB diff --git a/bin/build.sh b/bin/build.sh new file mode 100755 index 00000000..73557545 --- /dev/null +++ b/bin/build.sh @@ -0,0 +1,50 @@ +#!/bin/bash -e + +# build stage script for Auto-DevOps + +if ! docker info &>/dev/null; then + if [ -z "$DOCKER_HOST" ] && [ "$KUBERNETES_PORT" ]; then + export DOCKER_HOST='tcp://localhost:2375' + fi +fi + +if [[ -n "$CI_REGISTRY" && -n "$CI_REGISTRY_USER" ]]; then + echo "Logging to GitLab Container Registry with CI credentials..." + echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" +fi + +image_previous="$CI_APPLICATION_REPOSITORY:$CI_COMMIT_BEFORE_SHA" +image_tagged="$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG" +image_latest="$CI_APPLICATION_REPOSITORY:latest" + +builder=${AUTO_DEVOPS_BUILD_IMAGE_CNB_BUILDER:-"heroku/buildpacks:18"} +echo "Building Cloud Native Buildpack-based application with builder ${builder}..." +buildpack_args=() +if [[ -n "$BUILDPACK_URL" ]]; then + buildpack_args=('--buildpack' "$BUILDPACK_URL") +fi +env_args=() +if [[ -n "$AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES" ]]; then + mapfile -t env_arg_names < <(echo "$AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES" | tr ',' "\n") + for env_arg_name in "${env_arg_names[@]}"; do + env_args+=('--env' "$env_arg_name") + done +fi +pack build "$image_tagged" \ + --builder "$builder" \ + "${env_args[@]}" \ + "${buildpack_args[@]}" \ + --env HTTP_PROXY \ + --env http_proxy \ + --env HTTPS_PROXY \ + --env https_proxy \ + --env FTP_PROXY \ + --env ftp_proxy \ + --env NO_PROXY \ + --env no_proxy \ + --env "NODE_ENV=production" + +docker tag "$image_tagged" "$image_latest" + +docker push "$image_tagged" +docker push "$image_latest" diff --git a/package.json b/package.json index ddd7506e..313a3f56 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ "vuex": "^3.0.1" }, "engines": { - "node": ">= 11.7.0", - "npm": ">= 6.0.0" + "node": "^12.20.0", + "npm": "^6.14.8" }, "devDependencies": { "cypress-file-upload": "^4.0.7", diff --git a/src/components/App/AppModal/ModalTemplate.vue b/src/components/App/AppModal/ModalTemplate.vue index 516f91fc..cb8a56c7 100644 --- a/src/components/App/AppModal/ModalTemplate.vue +++ b/src/components/App/AppModal/ModalTemplate.vue @@ -1,8 +1,10 @@