diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec09aa8b7fa325eaf800d746d88c7ce88be05117..71fa2bb86d1ff35af4fbbbc7565673c4b23b8da0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,55 +2,43 @@ include: - local: 'prezbuilder-ci.yml' default: - tags: [docker] retry: 2 interruptible: true stages: - - build - test + - build - deploy -node_modules: - stage: build +lint: + stage: test + tags: [docker] image: node:12-buster variables: NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm" script: - npm install + - npm run lint cache: key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME" paths: - "$NPM_CONFIG_CACHE" - artifacts: - expire_in: 1 day - paths: - - node_modules/ docker-image: stage: build tags: [dind] variables: - PUBLIC_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" - PREZBUILDER_IMAGE: prezbuilder - PREZBUILDER_TAG: "$CI_COMMIT_SHA" - LOCAL_IMAGE: "$PREZBUILDER_IMAGE:$PREZBUILDER_TAG" + IMAGE: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}" + PREZBUILDER_IMAGE: "${CI_REGISTRY_IMAGE}" + PREZBUILDER_TAG: "${CI_COMMIT_REF_NAME}" script: - set -x - - docker pull "$PUBLIC_IMAGE" || exit 0 - - docker build --cache-from "node:buster-12,$PUBLIC_IMAGE" --tag "$LOCAL_IMAGE" --tag "$PUBLIC_IMAGE" . - - docker run --rm "$LOCAL_IMAGE" build + - docker pull "${IMAGE}" || exit 0 + - docker build --cache-from "node:buster-12,${IMAGE}" --tag "${IMAGE}" . + - docker run --rm "${IMAGE}" build - bash -x bin/prezbuilder-docker build src public - "[ -e public/index.html ]" - - docker push "$PUBLIC_IMAGE" - -lint: - stage: test - image: node:12-buster - needs: - - node_modules - script: - - npm run lint + - docker push "${IMAGE}" pages: extends: .prezbuilder