Skip to content

Commit

Permalink
[core] Should run the tests when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 14, 2018
1 parent 75b988d commit 82a630a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
45 changes: 39 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,62 @@ jobs:
- run:
name: material-ui-icons
command: |
if [[ ((`git diff --raw master | grep packages/material-ui-icons` > 0))]]; then
# latest commit
LATEST_COMMIT=$(git rev-parse HEAD)
# latest commit where packages/material-ui-icons was changed
FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/material-ui-icons)
if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then
echo "changes, let's run the tests"
cd packages/material-ui-icons && yarn test
else
echo "no changes "
echo "no changes"
fi
- run:
name: material-ui-codemod
command: |
if [[ ((`git diff --raw master | grep packages/material-ui-codemod` > 0))]]; then
# latest commit
LATEST_COMMIT=$(git rev-parse HEAD)
# latest commit where packages/material-ui-codemod was changed
FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/material-ui-codemod)
if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then
echo "changes, let's run the tests"
cd packages/material-ui-codemod && yarn test
else
echo "no changes "
echo "no changes"
fi
- run:
name: material-ui-lab
command: |
# latest commit
LATEST_COMMIT=$(git rev-parse HEAD)
# latest commit where packages/material-ui-lab was changed
FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/material-ui-lab)
if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then
echo "changes, let's run the tests"
cd packages/material-ui-lab && yarn test
else
echo "no changes"
fi
- run:
name: eslint-plugin-material-ui
command: |
if [[ ((`git diff --raw master | grep packages/eslint-plugin-material-ui` > 0))]]; then
# latest commit
LATEST_COMMIT=$(git rev-parse HEAD)
# latest commit where packages/eslint-plugin-material-ui was changed
FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/eslint-plugin-material-ui)
if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then
echo "changes, let's run the tests"
cd packages/eslint-plugin-material-ui && yarn test
else
echo "no changes "
echo "no changes"
fi
test_build:
<<: *defaults
Expand Down
3 changes: 2 additions & 1 deletion packages/material-ui-icons/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ async function worker({ svgPath, options, renameFilter, template }) {
.replace(/ clip-path=".+?"/g, '') // Fix visibility issue and save some bytes.
.replace(/<clipPath.+?<\/clipPath>/g, ''); // Remove unused definitions

const size = Number(svgPath.match(/^.*_([0-9]+)px.svg$/)[1]);
const sizeMatch = svgPath.match(/^.*_([0-9]+)px.svg$/);
const size = sizeMatch ? Number(sizeMatch[1]) : null;

if (size !== 24) {
const scale = Math.round((24 / size) * 100) / 100; // Keep a maximum of 2 decimals
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-icons/builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('builder', () => {
'svg',
'000000',
'transparent',
'dice-six-faces-four.js',
'Dice-six-faces-four.js',
);
assert.strictEqual(fs.existsSync(actualFilePath), true);

Expand Down

0 comments on commit 82a630a

Please sign in to comment.