Skip to content

Commit

Permalink
Save CI-built node_modules as build artifacts (facebook#14205)
Browse files Browse the repository at this point in the history
* Store node_modules generated by CI script as an artifact
* NPM pack artifacts before archiving
  • Loading branch information
bvaughn authored and n8schloss committed Jan 31, 2019
1 parent b435ff7 commit 11395e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ jobs:
key: v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules

- store_artifacts:
path: ./node_modules.tgz
11 changes: 11 additions & 0 deletions scripts/circleci/pack_and_store_artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e

# NPM pack all modules to ensure we archive the correct set of files
for dir in ./build/node_modules/* ; do
npm pack "$dir"
done

# Wrap everything in a single zip file for easy download by the publish script
tar -zcvf ./node_modules.tgz ./*.tgz
1 change: 1 addition & 0 deletions scripts/circleci/test_entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('yarn test-build-prod --maxWorkers=2')
COMMANDS_TO_RUN+=('node ./scripts/tasks/danger')
COMMANDS_TO_RUN+=('./scripts/circleci/upload_build.sh')
COMMANDS_TO_RUN+=('./scripts/circleci/pack_and_store_artifact.sh')
fi

if [ $((3 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
Expand Down

0 comments on commit 11395e6

Please sign in to comment.