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

Adds CircleCI configuration #39

Merged
merged 6 commits into from
Jun 20, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .circleci/checksum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /bin/sh
#
# Usage: checksum.sh filename
#
# checksum.sh computes the checksum of the repo's top level `package.json`
# and `package.json` files in package/, putting the hashes into a file in
# alphabetical order. Must be run at the top level of the repository.


if [ -z $1 ]; then
echo "Usage: checksum.sh filename"
exit 1
fi

FILE=$1

# remove existing file
if [ -f $FILE ]; then
rm $FILE
fi

openssl md5 package.json >> $FILE

find packages/*/package.json | xargs -I{} openssl md5 {} >> $FILE

sort -o $FILE $FILE
33 changes: 33 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 2

jobs:
build:
docker:
- image: circleci/node:12
steps:
- checkout
- run:
name: Create Checksum
command: sh .circleci/checksum.sh /tmp/checksums.txt
- restore_cache:
keys:
- npm-cache-{{ checksum "/tmp/checksums.txt" }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be done by package instead, which will be a lot faster since only the modules for that package will be redownloaded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this comment, just saw in the PR it's simple on purpose.

- run:
name: Install Dependencies
command: yarn install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be lerna bootstrap instead? How are individual packages installed and linked together with yarn install?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to add "postinstall": "yarn run bootstrap" script.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- save_cache:
key: npm-cache-{{ checksum "/tmp/checksums.txt" }}
paths:
- ./node_modules
- ./yarn.lock
- ./packages/*/node_modules
- ./packages/*/yarn.lock
- run:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a step for lints (and checks for formatting problems): yarn run check?

name: Lint
command: yarn run check
- run:
name: Compile
command: yarn run compile
- run:
name: Test
command: yarn run test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests should be parallelized by package. Is there a way to install dependencies only for select packages?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this comment, just saw in the PR it's simple on purpose.

1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"lerna": "3.13.4",
"npmClient": "yarn",
"packages": [
"packages/*"
],
Expand Down