From cb2238c5761f87228aa619c6f86c4a0b74cd99cb Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Tue, 9 Jan 2018 20:47:03 +0100 Subject: [PATCH] Should now run frontend tests on gitlab --- .gitlab-ci.yml | 43 ++++++++++++++++++++++++++++++++----------- front/Dockerfile | 6 +++--- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 91b11e8bd1..cde12894ac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: IMAGE_NAME: funkwhale/funkwhale IMAGE: $IMAGE_NAME:$CI_COMMIT_REF_NAME IMAGE_LATEST: $IMAGE_NAME:latest - + PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache" stages: @@ -14,40 +14,61 @@ test_api: services: - postgres:9.4 stage: test - image: funkwhale/funkwhale:base + image: funkwhale/funkwhale:latest + cache: + key: "$CI_PROJECT_ID/pip_cache" + paths: + - "$PIP_CACHE_DIR" variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache" DATABASE_URL: "postgresql://postgres@postgres/postgres" before_script: - - python3 -m venv --copies virtualenv - - source virtualenv/bin/activate - cd api - pip install -r requirements/base.txt - pip install -r requirements/local.txt - pip install -r requirements/test.txt script: - pytest + tags: + - docker + + +test_front: + stage: test + image: node:9 + before_script: + - cd front + + script: + - yarn install + - yarn run unit cache: - key: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" + key: "$CI_PROJECT_ID/front_dependencies" paths: - - "$CI_PROJECT_DIR/pip-cache" + - front/node_modules + - front/yarn.lock + artifacts: + name: "front_${CI_COMMIT_REF_NAME}" + paths: + - front/dist/ tags: - docker + build_front: stage: build - image: node:6-alpine + image: node:9 before_script: - cd front script: - - npm install - - npm run build + - yarn install + - yarn run build cache: - key: "$CI_COMMIT_REF_NAME" + key: "$CI_PROJECT_ID/front_dependencies" paths: - front/node_modules + - front/yarn.lock artifacts: name: "front_${CI_COMMIT_REF_NAME}" paths: diff --git a/front/Dockerfile b/front/Dockerfile index b22359b467..cdf92446b1 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -1,10 +1,10 @@ -FROM node:6 +FROM node:9 EXPOSE 8080 WORKDIR /app/ ADD package.json . -RUN npm install --only=production -RUN npm install --only=dev +RUN yarn install --only=production +RUN yarn install --only=dev VOLUME ["/app/node_modules"] COPY . . -- GitLab