|
| 1 | +# Copyright (C) 2018-present Arctic Ice Studio <[email protected]> |
| 2 | +# Copyright (C) 2018-present Sven Greb <[email protected]> |
| 3 | +# |
| 4 | +# Project: Nord Docs |
| 5 | +# Repository: https://github.com/arcticicestudio/nord-docs |
| 6 | +# License: MIT |
| 7 | + |
| 8 | +# Configuration for Circle CI. |
| 9 | +# |
| 10 | +# References: |
| 11 | +# - https://circleci.com/docs/2.0 |
| 12 | +# - https://circleci.com/docs/2.0/circleci-images |
| 13 | +# - https://circleci.com/docs/2.0/contexts |
| 14 | + |
| 15 | +version: 2.1 |
| 16 | + |
| 17 | +commands: |
| 18 | + build: |
| 19 | + description: "Build a production bundle with Gatsby" |
| 20 | + steps: |
| 21 | + - run: |
| 22 | + name: Build production bundle |
| 23 | + command: npm run build:gatsby |
| 24 | + post-process: |
| 25 | + description: "Post-process the build" |
| 26 | + steps: |
| 27 | + - save-npm-cache |
| 28 | + - store_artifacts: |
| 29 | + path: ./build/reports |
| 30 | + - store_artifacts: |
| 31 | + path: ./public |
| 32 | + - store_artifacts: |
| 33 | + path: ./node_modules.tgz |
| 34 | + - codecov/upload: |
| 35 | + file: ./build/reports/coverage/coverage-final.json |
| 36 | + flags: unit |
| 37 | + pre-process: |
| 38 | + description: "Pre-process the build" |
| 39 | + steps: |
| 40 | + - checkout |
| 41 | + - print-env-info |
| 42 | + - restore-npm-cache |
| 43 | + - run: |
| 44 | + name: Install dependencies |
| 45 | + command: npm ci |
| 46 | + print-env-info: |
| 47 | + description: "Print build & environment information" |
| 48 | + steps: |
| 49 | + - run: |
| 50 | + name: NPM and NodeJS Version Information |
| 51 | + command: npm version |
| 52 | + - run: |
| 53 | + name: OS Information |
| 54 | + command: uname -a |
| 55 | + - run: |
| 56 | + name: Git and Build Metadata |
| 57 | + command: | |
| 58 | + echo $CIRCLE_COMPARE_URL | cut -d/ -f7 |
| 59 | + echo "Git branch: $CIRCLE_BRANCH" |
| 60 | + echo "Git commit: $CIRCLE_SHA1" |
| 61 | + echo "Job: $CIRCLE_JOB" |
| 62 | + echo "Build: $CIRCLE_BUILD_NUM" |
| 63 | + restore-npm-cache: |
| 64 | + steps: |
| 65 | + - restore_cache: |
| 66 | + keys: |
| 67 | + - v1-npm-cache--{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }} |
| 68 | + - v1-npm-cache--{{ arch }}-{{ .Branch }} |
| 69 | + - v1-npm-cache--{{ arch }} |
| 70 | + save-npm-cache: |
| 71 | + steps: |
| 72 | + - save_cache: |
| 73 | + key: v1-npm-cache--{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }} |
| 74 | + paths: |
| 75 | + - node_modules |
| 76 | + test: |
| 77 | + steps: |
| 78 | + - run: |
| 79 | + name: Lint |
| 80 | + command: npm run lint |
| 81 | + - run: |
| 82 | + name: Run tests with coverage |
| 83 | + command: npm run test:cov |
| 84 | + |
| 85 | +jobs: |
| 86 | + nodejs-v8: |
| 87 | + docker: |
| 88 | + - image: node:8 |
| 89 | + steps: |
| 90 | + - pre-process |
| 91 | + - test |
| 92 | + - build |
| 93 | + - post-process |
| 94 | + nodejs-v10: |
| 95 | + docker: |
| 96 | + - image: node:10 |
| 97 | + steps: |
| 98 | + - pre-process |
| 99 | + - test |
| 100 | + - build |
| 101 | + - post-process |
| 102 | + nodejs-latest: |
| 103 | + docker: |
| 104 | + - image: node:latest |
| 105 | + steps: |
| 106 | + - pre-process |
| 107 | + - test |
| 108 | + - build |
| 109 | + - post-process |
| 110 | + |
| 111 | +orbs: |
| 112 | + codecov: codecov/[email protected] |
| 113 | + |
| 114 | +workflows: |
| 115 | + version: 2.1 |
| 116 | + build-multi-version: |
| 117 | + jobs: |
| 118 | + - nodejs-v8 |
| 119 | + - nodejs-v10 |
| 120 | + - nodejs-latest |
0 commit comments