-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
(refactor): Update circleci config to circleci workflowsv2 #3618
Changes from all commits
89d55ca
a7dbede
4aead73
05af248
7689659
0da28cb
2263f35
838939a
6c26846
40de5b1
f5dfe73
039fbd4
a9269f4
70a2963
bfa183e
1b1dc09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
version: 2 | ||
|
||
jobs: | ||
build: | ||
working_directory: /home/reaction | ||
# run automated tests | ||
tests: | ||
working_directory: ~/reaction | ||
|
||
docker: | ||
- image: node:8 | ||
- image: circleci/node:8.9.3-browsers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing this per comment made here |
||
|
||
environment: | ||
- DOCKER_VERSION: 17.05.0-ce | ||
|
@@ -14,62 +15,137 @@ jobs: | |
- TOOL_NODE_FLAGS: "--max-old-space-size=4096" | ||
|
||
steps: | ||
- setup_remote_docker | ||
- checkout | ||
|
||
# install OS dependencies | ||
- restore_cache: | ||
name: Restoring Meteor cache | ||
key: meteor | ||
key: meteor-{{ .Branch }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added branch name to the keys for the cache primarily because the old cache that was generated on previous node:8 image is to be linked/restored to root locations on the new 8.9.3 (which also resulted in permission denied errors). |
||
|
||
- run: .circleci/install.sh | ||
# Install Meteor | ||
- run: .circleci/install_meteor.sh | ||
|
||
- save_cache: | ||
name: Saving Meteor to cache | ||
key: meteor | ||
paths: | ||
- ~/.meteor | ||
# install OS dependencies | ||
- run: sudo apt-get update | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
- run: sudo apt-get install -y locales | ||
|
||
# fix Meteor/Mongo locale issue on Debian | ||
# https://github.com/meteor/meteor/issues/4019 | ||
- run: sudo locale-gen en_US.UTF-8 | ||
- run: sudo localedef -i en_GB -f UTF-8 en_US.UTF-8 | ||
|
||
# install app dependencies | ||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "package.json" }}-{{ .Branch }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies-{{ .Branch }} | ||
|
||
# Install dependencies | ||
- run: meteor npm install | ||
|
||
# run tests | ||
- restore_cache: | ||
name: Restoring Meteor dev_bundle cache | ||
key: dev_bundle | ||
key: dev_bundle-{{ .Branch }} | ||
|
||
# install Reaction CLI | ||
- run: sudo npm install -g reaction-cli | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was done previously with |
||
|
||
# run reaction tests | ||
- run: .circleci/tests.sh | ||
|
||
- save_cache: | ||
name: Saving Meteor dev_bundle to cache | ||
key: dev_bundle | ||
key: dev_bundle-{{ .Branch }} | ||
paths: | ||
- ~/reaction/.meteor/local | ||
|
||
- save_cache: | ||
paths: | ||
- /home/reaction/.meteor/local | ||
- ~/reaction/node_modules | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
|
||
- save_cache: | ||
name: Saving Meteor to cache | ||
key: meteor-{{ .Branch }} | ||
paths: | ||
- ~/.meteor | ||
|
||
|
||
# build a Reaction image and publish to DockerHub | ||
publish: | ||
working_directory: ~/reaction | ||
|
||
docker: | ||
- image: node:8.9.3 | ||
|
||
environment: | ||
- DOCKER_VERSION: 17.05.0-ce | ||
- DOCKER_COMPOSE_VERSION: 1.15.0 | ||
- METEOR_ALLOW_SUPERUSER: true | ||
- TOOL_NODE_FLAGS: "--max-old-space-size=4096" | ||
|
||
steps: | ||
- setup_remote_docker | ||
- checkout | ||
|
||
# Install Docker client & compose | ||
- run: .circleci/install.sh | ||
|
||
- run: | ||
command: .circleci/build.sh | ||
no_output_timeout: 30m | ||
|
||
- run: .circleci/deploy.sh | ||
|
||
|
||
# deploy reaction docs | ||
deployDocs: | ||
working_directory: ~/reaction | ||
|
||
docker: | ||
- image: node:8.9.3 | ||
|
||
environment: | ||
- DOCKER_VERSION: 17.05.0-ce | ||
- DOCKER_COMPOSE_VERSION: 1.15.0 | ||
- METEOR_ALLOW_SUPERUSER: true | ||
- TOOL_NODE_FLAGS: "--max-old-space-size=4096" | ||
|
||
steps: | ||
- checkout | ||
|
||
# install OS dependencies | ||
- run: apt-get update | ||
- run: apt-get install -y locales | ||
- run: | ||
command: .reaction/jsdoc/build.sh | ||
no_output_timeout: 2m | ||
|
||
# deploy the docs if on master branch | ||
- deploy: | ||
name: Deploy to S3 if tests pass and branch is Master | ||
# deploy the docs if on master branch (based on workflow filter) | ||
- run: | ||
command: | | ||
if [ "${CIRCLE_BRANCH}" == "master" ]; then | ||
if [[ "${API_DOC_BUCKET}" && "${API_DOC_BUCKET_REGION}" ]]; then | ||
aws s3 sync /tmp/reaction-docs ${API_DOC_BUCKET} --delete --region ${API_DOC_BUCKET_REGION} | ||
else | ||
echo "S3 bucket configuration not found for jsdocs" | ||
echo "Set API_DOC_BUCKET and API_DOC_BUCKET_REGION to build and deploy jsdocs to S3" | ||
fi | ||
if [[ "${API_DOC_BUCKET}" && "${API_DOC_BUCKET_REGION}" ]]; then | ||
aws s3 sync /tmp/reaction-docs ${API_DOC_BUCKET} --delete --region ${API_DOC_BUCKET_REGION} | ||
else | ||
echo "Not master branch so not deploying" | ||
echo "S3 bucket configuration not found for jsdocs" | ||
echo "Set API_DOC_BUCKET and API_DOC_BUCKET_REGION to build and deploy jsdocs to S3" | ||
fi | ||
- deploy: | ||
name: Docker Image Deploment | ||
command: .circleci/deploy.sh | ||
|
||
workflows: | ||
version: 2 | ||
|
||
test_publish_deploy: | ||
jobs: | ||
- tests | ||
|
||
- publish: | ||
requires: | ||
- tests | ||
|
||
- deployDocs: | ||
requires: | ||
- tests | ||
filters: | ||
branches: | ||
only: | ||
- master |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
# install Meteor if it's not already | ||
if [[ -f ~/.meteor/meteor ]]; then | ||
printf "\nMeteor already installed. Creating symlink.\n" | ||
sudo ln -s ~/.meteor/meteor /usr/local/bin/meteor; | ||
else | ||
printf "\Installing Meteor\n" | ||
curl https://install.meteor.com | /bin/sh | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed from
/home/reaction
to~/reaction
. The8.9.3-browsers
image throws permission denied error on root folder. Any better way?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @impactmass. This is a minor suggestion because I'm sure that this will work as-is.
~
is expanded to home by the shell when it's not prefixed. But~
is a typing convenience for the command line. In scripts it's generally preferred to use the$HOME
var.See:
That said, you did the right thing. The old path didn't work on that image because the user
reaction
doesn't exist incircleci/node:8.9.3-browsers
and therefore the/home/reaction
directory doesn't exist either.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I changed to $HOME. With that circleci fails on the checkout step.
Unable to create directory '$HOME/reaction
. Not sure why yet.Also, I did not get this part
The old path didn't work on that image because the user
reactiondoesn't exist ... and therefore the /home/reaction
. Were we creating areaction
user in the previous setup?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was never a
reaction
user. The previous container ran as root. That was just the directory I picked to checkout the code within the image. And~/
definitely was a problem previously, so that's why I explicitly set it to/home/
.