Skip to content

Commit dd1a155

Browse files
Implement the Circle CI configuration file
Circle CI (1) is one of the most popular and proven CI providers that allows to automate pipelines from commit to deploy with a quick, safe, and scaled process. They support many languages and provide great and unique features like orbs (2), job orchestration, powerful caching, SSH or local builds for easy debugging and first-class Docker and GitHub integration (apps, hooks, etc.) support. The extensive and well-written documentations (3) make it easy to set up and configure it for the usage in projects. Circle CI has been used for almost all open source projects of Arctic Ice Studio and will be used as primary CI provider for _Nord Docs_ too. Before starting to run builds, Circle CI must be authorized on a per project basis to access the code on GitHub. After the process has been authorized (GitHub OAuth) the project will be added to the dashboard and required webhooks to listen for new Git events will be automatically set up. See the documentation about how to get started and add a project to the dashboard (4). NOTE: The latest config 2.1 features (5) are currently still in Beta Preview and must be enabled explicitly for each project via Settings -> Advanced Settings -> "Enable build processing (preview)"! See the "Enabling Build Processing" (6) documentation for more details. The Docker image of the CI container (7) will be the currently latest stable Node.js (8) LTS version `10.x.x` and the previous LTS version `8`. The `-browsers-legacy` tag suffix (9) can be used later on for end-to-end tests (GH-38) with Cypress (10). Next to Node.js these images currently include Chrome, Firefox, Java 8, and PhantomJS. To gather and upload all created coverage reports the "codecov/codecov" (11) Circle CI orb (12) which provides the `upload` command for easy integration into jobs and workflows. References: (1) https://circleci.com (2) https://circleci.com/orbs (3) https://circleci.com/docs (4) https://circleci.com/docs/2.0/first-steps (5) https://github.com/CircleCI-Public/config-preview-sdk/blob/master/docs/README.md (6) https://circleci.com/docs/2.0/build-processing (7) https://hub.docker.com/r/circleci/node/tags (8) https://nodejs.org (9) https://circleci.com/docs/2.0/circleci-images/#language-image-variants (10) https://www.cypress.io (11) https://circleci.com/orbs/registry/orb/codecov/codecov (12) https://circleci.com/docs/2.0/orb-intro GH-44
1 parent 7eccff4 commit dd1a155

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-0
lines changed

.circleci/config.yml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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

content/blog/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A stub to prevent the "gatsby-source-filesystem" plugin to error on CI builds when this folder doesn't exist.

content/docs/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A stub to prevent the "gatsby-source-filesystem" plugin to error on CI builds when this folder doesn't exist.

src/assets/images/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A stub to prevent the "gatsby-source-filesystem" plugin to error on CI builds when this folder doesn't exist.

0 commit comments

Comments
 (0)