-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Setup for Circle 2 #4149
Setup for Circle 2 #4149
Changes from all commits
e357958
94a406d
8ea07d9
94279fe
41a1730
c74b3f6
8a92112
73436e5
fa948d2
041b8b6
fc85b54
ef94054
b0ca73e
fd68258
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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
aliases: | ||
- &restore-cache | ||
keys: | ||
- dependencies-{{ .Branch }}-{{ checksum "package.json" }} | ||
# Fallback in case checksum fails | ||
- dependencies-{{ .Branch }}- | ||
|
||
- &save-cache | ||
paths: | ||
- node_modules | ||
- website/node_modules | ||
key: dependencies-{{ .Branch }}-{{ checksum "package.json" }} | ||
|
||
- &yarn-install | ||
run: | | ||
sudo npm i -g yarn@^0.27.5 | ||
yarn --no-progress | ||
|
||
- &yarn-install-no-sudo | ||
run: | | ||
npm i -g yarn@^0.27.5 | ||
yarn --no-progress | ||
|
||
- &deploy | ||
command: | | ||
# Deploy Jest website | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Website Deployment Script" | ||
echo "machine github.com login jest-bot password $GITHUB_TOKEN" > ~/.netrc | ||
# crowdin install start | ||
sudo apt-get install default-jre | ||
wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb | ||
sudo dpkg -i crowdin.deb | ||
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. Ideally all required software should be installed in a Docker image so that you don't incur the cost every single time the build runs (instead it's just a once-off cost whenever you build the Docker container). That's one of the main advantages of CircleCI 2.0 :) I might submit a PR to do that, if I get a chance. Basically, there should be some Jest dev Docker image that extends whichever other Docker images you're using, and has this stuff installed. |
||
# crowdin install end | ||
crowdin --config crowdin.yaml upload sources --auto-update -b master | ||
crowdin --config crowdin.yaml download -b master | ||
cd website && GIT_USER=jest-bot npm run gh-pages | ||
|
||
version: 2 | ||
jobs: | ||
test-browser: | ||
working_directory: ~/jest | ||
docker: | ||
- image: markhobson/node-chrome | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install-no-sudo | ||
- save-cache: *save-cache | ||
- run: yarn run test-ci-es5-build-in-browser | ||
|
||
test-node-8: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:8.1.4 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install | ||
- save-cache: *save-cache | ||
- run: yarn run test-ci-partial | ||
|
||
test-node-6: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:6.11.0 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install | ||
- save-cache: *save-cache | ||
- run: yarn run test-ci | ||
|
||
test-node-4: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:4.8.4 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install | ||
- save-cache: *save-cache | ||
- run: npm run test-ci-partial | ||
|
||
test-and-deploy-website: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:8.1.4 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- run: sudo npm i -g yarn@^0.27.5 | ||
- run: | | ||
cd website | ||
yarn --no-progress | ||
- save-cache: *save-cache | ||
- run: | | ||
cd website | ||
yarn run test | ||
- deploy: *deploy | ||
|
||
# Workflows enables us to run multiple jobs in parallel | ||
workflows: | ||
version: 2 | ||
build-and-deploy: | ||
jobs: | ||
- test-node-8 | ||
- test-node-6 | ||
- test-node-4 | ||
- test-browser | ||
- test-and-deploy-website |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* Adapted from node resolver: https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers/node | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const resolve = require('resolve'); | ||
const path = require('path'); | ||
|
||
const log = require('debug')('eslint-plugin-import:resolver:node'); | ||
|
||
module.exports.interfaceVersion = 2; | ||
|
||
module.exports.resolve = function(source, file, config) { | ||
log('Resolving:', source, 'from:', file); | ||
let resolvedPath; | ||
|
||
if (resolve.isCore(source)) { | ||
log('resolved to core'); | ||
return {found: true, path: null}; | ||
} | ||
|
||
source = applyModuleNameMapper(source, config); | ||
|
||
try { | ||
resolvedPath = resolve.sync(source, opts(file, config)); | ||
log('Resolved to:', resolvedPath); | ||
return {found: true, path: resolvedPath}; | ||
} catch (err) { | ||
log('resolve threw error:', err); | ||
return {found: false}; | ||
} | ||
}; | ||
|
||
function opts(file, config) { | ||
return Object.assign( | ||
{ | ||
// more closely matches Node (#333) | ||
extensions: ['.js', '.json'], | ||
}, | ||
config, | ||
{ | ||
// path.resolve will handle paths relative to CWD | ||
basedir: path.dirname(path.resolve(file)), | ||
packageFilter, | ||
} | ||
); | ||
} | ||
|
||
function packageFilter(pkg) { | ||
if (pkg['jsnext:main']) { | ||
pkg['main'] = pkg['jsnext:main']; | ||
} | ||
return pkg; | ||
} | ||
|
||
function applyModuleNameMapper(source, config) { | ||
Object.keys(config.moduleNameMapper).forEach(regex => { | ||
const mappedModuleName = config.moduleNameMapper[regex]; | ||
|
||
if (source.match(regex)) { | ||
const matches = source.match(regex); | ||
if (!matches) { | ||
source = mappedModuleName; | ||
} else { | ||
source = mappedModuleName.replace( | ||
/\$([0-9]+)/g, | ||
(_, index) => matches[parseInt(index, 10)] | ||
); | ||
} | ||
source = path.resolve(source); | ||
} | ||
}); | ||
|
||
return source; | ||
} |
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.
The Node.js Docker image already has Yarn installed, so you shouldn't need to do this. Also, we discourage installing Yarn via npm 😃
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.
isn't it a super old version of yarn though?
i remember i had to manually install it on travis
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.
Travis doesn't use the Node.js Docker image. I think the Node.js image has the latest Yarn.
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.
This docker image was using yarn 0.24, that's why I had to install it manually. Will check if that was updated
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.
If we do want to upgrade Yarn, we should do that in a Docker image that's layered on top of another one 😃
We should at least be installing Yarn using the Debian package if the image is Debian, based, too :D
Feel free to reach out to me if you need help with it!
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.
Would appreciate some help here, I'm not really experienced with Docker images 😄
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's docs on CircleCI's site: https://circleci.com/docs/2.0/custom-images/
I was going to submit a PR for this, but then I realised it's actually using a bunch of Docker images for various Node.js versions 😛 Initially I was going to do something like this: