Skip to content

Commit

Permalink
Always run yarn after restoring modules cache (facebook#15712)
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite authored May 22, 2019
1 parent b9ebc37 commit 1c0bdb7
Showing 1 changed file with 49 additions and 35 deletions.
84 changes: 49 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ aliases:
- &environment
TZ: /usr/share/zoneinfo/America/Los_Angeles

- &restore_node_modules
name: Restore node_modules cache
keys:
- v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v1-node-{{ arch }}-{{ .Branch }}-
- v1-node-{{ arch }}-
- &restore_yarn_cache
restore_cache:
name: Restore node_modules cache
keys:
- v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v1-node-{{ arch }}-{{ .Branch }}-
- v1-node-{{ arch }}-
- &run_yarn
run:
name: Install Packages
command: yarn --frozen-lockfile

- &attach_workspace
at: build

Expand All @@ -23,26 +29,25 @@ jobs:

steps:
- checkout
- restore_cache: *restore_node_modules
- run:
name: Nodejs Version
command: node --version
- run:
name: Install Packages
command: yarn install --frozen-lockfile
- *restore_yarn_cache
- *run_yarn
- save_cache:
name: Save node_modules cache
key: v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- ~/.cache/yarn

lint:
docker: *docker
environment: *environment

steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: node ./scripts/prettier/index
- run: node ./scripts/tasks/eslint
- run: ./scripts/circleci/check_license.sh
Expand All @@ -55,61 +60,68 @@ jobs:

steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: node ./scripts/tasks/flow-ci

test-source:
test_source:
docker: *docker
environment: *environment

steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: yarn test --maxWorkers=2

test-source-persistent:
test_source_persistent:
docker: *docker
environment: *environment

steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: yarn test-persistent --maxWorkers=2

test-source-prod:
test_source_prod:
docker: *docker
environment: *environment

steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: yarn test-prod --maxWorkers=2

test-source-fire:
test_source_fire:
docker: *docker
environment: *environment

steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: yarn test-fire --maxWorkers=2
- run: yarn test-fire-prod --maxWorkers=2

test-coverage:
test_coverage:
docker: *docker
environment: *environment

steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: ./scripts/circleci/test_coverage.sh

build:
docker: *docker
environment: *environment
steps:
- checkout
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: ./scripts/circleci/add_build_info_json.sh
- run: ./scripts/circleci/update_package_versions.sh
- run: ./scripts/circleci/build.sh
Expand All @@ -134,22 +146,24 @@ jobs:
- node_modules
- react-native

test-build:
test_build:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: yarn test-build --maxWorkers=2

test-build-prod:
test_build_prod:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- restore_cache: *restore_node_modules
- *restore_yarn_cache
- *run_yarn
- run: yarn test-build-prod --maxWorkers=2

workflows:
Expand All @@ -163,27 +177,27 @@ workflows:
- flow:
requires:
- setup
- test-source:
- test_source:
requires:
- setup
- test-source-prod:
- test_source_prod:
requires:
- setup
- test-source-persistent:
- test_source_persistent:
requires:
- setup
- test-source-fire:
- test_source_fire:
requires:
- setup
- test-coverage:
- test_coverage:
requires:
- setup
- build:
requires:
- setup
- test-build:
- test_build:
requires:
- build
- test-build-prod:
- test_build_prod:
requires:
- build

0 comments on commit 1c0bdb7

Please sign in to comment.