Skip to content

Commit

Permalink
fix(ci): use correct cache path per circleci documentation (#9160)
Browse files Browse the repository at this point in the history
* fix(ci): use correct cache path per circleci documentation

Thanks @LekoArts for the tip!

* chore: remove comment

* chore: remove sudo command

* chore: add frozen lockfile option

* chore: use cypress browser image

* chore: little tweaks (@pieh)
  • Loading branch information
DSchau authored and pieh committed Oct 16, 2018
1 parent 01bf282 commit a2aced4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
40 changes: 20 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,26 @@ executors:

aliases:
e2e-executor: &e2e-executor
executor:
name: node
image: 10-browsers
docker:
- image: cypress/browsers:chrome69

restore_node_modules: &restore_node_modules
restore_cache: &restore_cache
restore_cache:
name: Restore node_modules cache
keys:
- node-modules-{{ checksum "yarn.lock" }}
- yarn-cypress-cache-{{ checksum "yarn.lock" }}

install_node_modules: &install_node_modules
run:
name: Install node modules
command: |
yarn
command: yarn --frozen-lockfile

persist_node_modules: &persist_node_modules
persist_cache: &persist_cache
save_cache:
name: Save node modules cache
key: node-modules-{{ checksum "yarn.lock" }}
key: yarn-cypress-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- ~/.cache

attach_to_bootstrap: &attach_to_bootstrap
attach_workspace:
Expand All @@ -45,10 +43,10 @@ aliases:
test_template: &test_template
steps:
- checkout
- run: ./scripts/assert-changed-files.sh "packages/*|integration-tests/*"
- <<: *restore_node_modules
- run: ./scripts/assert-changed-files.sh "packages/*|.circleci/*"
- <<: *restore_cache
- <<: *install_node_modules
- <<: *persist_node_modules
- <<: *persist_cache
- <<: *attach_to_bootstrap
- run: yarn jest -w 1

Expand All @@ -68,8 +66,9 @@ commands:
steps:
- checkout
- run: ./scripts/assert-changed-files.sh "<< parameters.trigger_pattern >>|<< parameters.test_path >>/*"
- <<: *restore_node_modules
- <<: *restore_cache
- <<: *install_node_modules
- <<: *persist_cache
- <<: *attach_to_bootstrap
- run: ./scripts/e2e-test.sh "<< parameters.test_path >>"

Expand All @@ -80,10 +79,10 @@ jobs:
executor: node
steps:
- checkout
- run: ./scripts/assert-changed-files.sh "packages/*|(e2e|integration)-tests/*"
- <<: *restore_node_modules
- run: ./scripts/assert-changed-files.sh "packages/*|(e2e|integration)-tests/*|.circleci/*"
- <<: *restore_cache
- <<: *install_node_modules
- <<: *persist_node_modules
- <<: *persist_cache
- run: yarn bootstrap
- persist_to_workspace:
root: packages
Expand All @@ -94,9 +93,9 @@ jobs:
executor: node
steps:
- checkout
- <<: *restore_node_modules
- <<: *restore_cache
- <<: *install_node_modules
- <<: *persist_node_modules
- <<: *persist_cache
- run: yarn lint

unit_tests_node6:
Expand All @@ -120,8 +119,9 @@ jobs:
steps:
- checkout
- run: ./scripts/assert-changed-files.sh "packages/*|integration-tests/*|.circleci/*"
- <<: *restore_node_modules
- <<: *restore_cache
- <<: *install_node_modules
- <<: *persist_cache
- <<: *attach_to_bootstrap
- run: yarn test:integration

Expand Down
4 changes: 2 additions & 2 deletions scripts/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ SRC_PATH=$1
CUSTOM_COMMAND="${2:-test}"
GATSBY_PATH="${CIRCLE_WORKING_DIRECTORY:-../../}"

sudo npm install -g gatsby-dev-cli &&
npm install -g gatsby-dev-cli &&

# setting up child integration test link to gatsby packages
cd $SRC_PATH &&
yarn &&
gatsby-dev --set-path-to-repo $GATSBY_PATH &&
gatsby-dev --scan-once --copy-all --quiet && # copies _all_ files in gatsby/packages
sudo chmod +x ./node_modules/.bin/gatsby && # this is sometimes necessary to ensure executable
chmod +x ./node_modules/.bin/gatsby && # this is sometimes necessary to ensure executable
yarn $CUSTOM_COMMAND &&
echo "e2e test run succeeded"

0 comments on commit a2aced4

Please sign in to comment.