Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo standardization #66

Merged
merged 1 commit into from Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 58 additions & 18 deletions .circleci/config.yml
@@ -1,26 +1,66 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
version: 2.1

workflows:
build-test:
jobs:
- prep-deps
- test-lint:
requires:
- prep-deps
- test-unit:
requires:
- prep-deps
- all-tests-pass:
requires:
- test-lint
- test-unit

jobs:
build:
prep-deps:
docker:
# specify the version you desire here
- image: circleci/node:12
steps:
- checkout
- run:
name: Install deps
command: |
.circleci/scripts/deps-install.sh
- run:
name: Collect yarn install HAR logs
command: |
.circleci/scripts/collect-har-artifact.sh
- persist_to_workspace:
root: .
paths:
- node_modules
- build-artifacts

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/repo

test-lint:
docker:
- image: circleci/node:12
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Lint
command: yarn lint

# install dependencies
- run: npm install
test-unit:
docker:
- image: circleci/node:12
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Unit tests
command: yarn test

# run tests
- run: npm run test
all-tests-pass:
docker:
- image: circleci/node:12
steps:
- run:
name: All tests passed
command: echo 'Great success'
9 changes: 9 additions & 0 deletions .circleci/scripts/collect-har-artifact.sh
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -x
set -e
set -u
set -o pipefail

mkdir -p build-artifacts/yarn-install-har
mv ./*.har build-artifacts/yarn-install-har/
8 changes: 8 additions & 0 deletions .circleci/scripts/deps-install.sh
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -x
set -e
set -u
set -o pipefail

yarn --frozen-lockfile --har
3 changes: 3 additions & 0 deletions .gitattributes
@@ -0,0 +1,3 @@
* text=auto

yarn.lock linguist-generated=false
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
v12
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -45,8 +45,8 @@ Testing
-------
Run the following command:

```
npm test
```bash
yarn test
```


Expand Down
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -6,6 +6,9 @@
"files": [
"index.js"
],
"engines": {
"node": ">=12.0.0"
},
"scripts": {
"test": "mocha",
"lint": "eslint . --ext .js",
Expand Down