Commit ebac475a authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Refactoring du .gitlab-ci.yml.

parent 7661d723
......@@ -2,33 +2,32 @@ include:
- local: 'prezbuilder-ci.yml'
default:
image: node:12-buster
tags: [docker]
retry: 2
interruptible: true
stages:
- lint
- build
- test
- deploy
lint:
stage: lint
tags: [docker]
image: node:12-buster
node_modules:
stage: build
variables:
NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm"
before_script:
- node --version
- npm --version
- npm install
script:
- npm run lint
- npm install
cache:
key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
paths:
- "$NPM_CONFIG_CACHE"
artifacts:
expire_in: 1 day
paths:
- node_modules/
docker:
docker-image:
stage: build
tags: [dind]
variables:
......@@ -37,32 +36,40 @@ docker:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
script:
- docker build --tag "$IMAGE" .
- docker run --rm "$IMAGE" build
- docker run --rm "$IMAGE" build src public
- "[ -e public/index.html ]"
- rm -rf public/*
- bin/prezbuilder-docker build src public
- docker push "$IMAGE"
npm-test:
lint:
stage: test
image: node:12
before_script:
- apt-get update -yq && apt-get install -yq pandoc wkhtmltopdf
- mkdir -p $HOME/prezbuilder
- cd $HOME/prezbuilder
- npm install "git+${CI_REPOSITORY_URL}#${CI_COMMIT_REF_NAME}"
- ln -s $HOME/prezbuilder/node_modules/.bin/prezbuilder /usr/local/bin/prezbuilder
- cd $CI_PROJECT_DIR
needs:
- node_modules
script:
- npm run lint
run-from-sources:
stage: test
needs:
- node_modules
script:
- prezbuilder build src public
- bin/prezbuilder build src public
- "[ -e public/index.html ]"
docker-test:
run-from-npm:
stage: test
tags: [dind]
variables:
GIT_STRATEGY: none
before_script:
- wget "${CI_PROJECT_URL}/-/raw/${CI_COMMIT_REF_NAME}/bin/prezbuilder-docker?inline=false" -O /usr/local/bin/prezbuilder-docker
- chmod a+rx /usr/local/bin/prezbuilder-docker
- apt-get update -yq && apt-get install -yq pandoc wkhtmltopdf
- set -x
- mkdir -p $HOME/prezbuilder
- cd $HOME/prezbuilder
- npm install "git+${CI_REPOSITORY_URL}#${CI_COMMIT_REF_NAME}"
script:
- prezbuilder-docker build src public
- "[ -e public/index.html ]"
- node_modules/.bin/prezbuilder build $CI_PROJECT_DIR/src $CI_PROJECT_DIR/public
- "[ -e $CI_PROJECT_DIR/public/index.html ]"
pages:
extends: .prezbuilder
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment