Skip to content

Commit

Permalink
ci: Improve CI test job speed (#2123 by @joshuayoes)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuayoes committed Sep 6, 2022
1 parent bf4c1c0 commit 9f099e6
Show file tree
Hide file tree
Showing 6 changed files with 454 additions and 456 deletions.
82 changes: 9 additions & 73 deletions .circleci/config.yml
Expand Up @@ -9,16 +9,11 @@ defaults: &defaults
- image: cimg/node:14.19
working_directory: /mnt/ramdisk/repo

# mac: &mac
# macos:
# xcode: "13.2.1"
# working_directory: ~/repo

version: 2.1
jobs:
tests:
<<: *defaults
parallelism: 4
resource_class: large
steps:
- checkout
- restore_cache:
Expand All @@ -45,83 +40,22 @@ jobs:
command: |
git config --global user.email "ci@infinite.red"
git config --global user.name "Infinite Red"
- run:
name: Install PNPM for tests
command: |
sudo chmod 777 /usr/local/bin
curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7
pnpm config set store-dir ../.pnpm-store
- restore_cache:
name: Restore ignite dependency cache
key: ignite-deps-cache-{{ .Environment.IGNITE_DEPS_PACKAGER }}-{{ checksum "boilerplate/package.json" }}-{{ arch }}-{{ .Environment.IGNITE_DEPS_KEY_SUFFIX }}
- run:
name: Run tests
command: yarn ci:test
name: Run static tests
command: yarn format:check && yarn lint && yarn typecheck
- run:
name: Run jest tests
command: yarn test
no_output_timeout: 5m
- save_cache:
name: Save ignite dependency cache
paths:
- ~/.cache/ignite
key: ignite-deps-cache-{{ .Environment.IGNITE_DEPS_PACKAGER }}-{{ checksum "boilerplate/package.json" }}-{{ arch }}-{{ .Environment.IGNITE_DEPS_KEY_SUFFIX }}

# detox:
# <<: *mac
# steps:
# - checkout
# - restore_cache:
# name: Restore node modules
# keys:
# - v1-dependencies-mac-{{ checksum "package.json" }}
# # fallback to using the latest cache if no exact match is found
# - v1-dependencies-mac-
# - run:
# name: Install dependencies
# command: |
# yarn install
# - save_cache:
# name: Save node modules
# paths:
# - node_modules
# key: v1-dependencies-mac-{{ checksum "package.json" }}
# - run:
# name: Install Detox CLI
# command: |
# sudo yarn global add detox-cli
# - run:
# name: Install Ruby and CocoaPods
# command: |
# sudo apt-get update &&
# sudo apt-get install ruby-full &&
# sudo gem install cocoapods --no-ri --no-rdoc
# - run:
# name: Install CocoaPods Specs
# command: |
# curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
# - run:
# name: Change Permissions
# command: sudo chown -R $(whoami) /Users/distiller/.config/
# - run:
# name: Install applesimutils
# command: brew tap wix/brew && brew install applesimutils
# - run:
# name: Install fbsimctl
# command: brew tap facebook/fb
# - run:
# name: Create temp directory
# command: mkdir tempApp
# - run:
# name: Ignite app
# command: cd tempApp && ignite new DetoxTests --detox --skip-git -b ../
# - run:
# name: Build Detox in ignited app
# command: cd tempApp/DetoxTests && yarn ci:build:e2e
# - run:
# name: Run detox tests in ignited app
# command: cd tempApp/DetoxTests && yarn ci:test:e2e
# - run:
# name: Remove temp directory
# command: rm -rf tempApp

publish:
<<: *defaults
steps:
Expand All @@ -133,6 +67,9 @@ jobs:
- v1-dependencies-{{ checksum "package.json" }}-{{ arch }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Build package
command: yarn build
# Run semantic-release after all the above is set.
- run:
name: Publish to npm
Expand All @@ -143,7 +80,6 @@ workflows:
test_and_release:
jobs:
- tests
# - detox # disabled until we can figure out detox CircleCI problems
- publish:
requires:
- tests
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
@@ -0,0 +1,2 @@
/build
/boilerplate
24 changes: 11 additions & 13 deletions package.json
Expand Up @@ -24,21 +24,16 @@
},
"scripts": {
"compile": "tsc -p .",
"typecheck": "tsc -p . --noEmit",
"build": "yarn compile && cp ./boilerplate/.gitignore ./boilerplate/.gitignore.template",
"format": "yarn format:js && yarn format:json && yarn format:md && yarn format:ts;",
"format:js": "prettier --write '**/*.js'",
"format:json": "prettier --write '**/*.json'",
"format:md": "prettier --write '**/*.md'",
"format:ts": "prettier --write '**/*.ts{,x}'",
"lint": "eslint src test --ext .ts --fix && yarn format",
"format": "prettier '**/*{.js,.ts,.tsx,.json,.md}'",
"format:write": "yarn format --write",
"format:check": "yarn format --check",
"lint": "eslint 'src/**' 'test/**'",
"test": "jest",
"watch": "jest --watch",
"watch:debug": "yarn watch --runInBand --verbose",
"coverage": "jest --coverage",
"ci:prep": "yarn build && yarn ci:lint",
"ci:lint": "eslint src test --ext .ts && yarn format",
"ci:test:vanilla": "jest ./test/vanilla",
"ci:test": "yarn ci:prep && yarn test && yarn clean",
"ci:publish": "yarn build && yarn semantic-release && yarn clean",
"semantic-release": "semantic-release",
"clean": "rm -rf ./build && rm ./boilerplate/.gitignore.template",
Expand All @@ -61,8 +56,8 @@
"@types/jest": "^27.0.1",
"@types/node": "16.6.1",
"@types/sharp": "^0.30.2",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"babel-eslint": "^10.1.0",
"eslint": "^7.23.0",
"eslint-config-prettier": "^8.1.0",
Expand Down Expand Up @@ -122,7 +117,10 @@
"no-use-before-define": "off",
"quotes": 0,
"space-before-function-paren": 0
}
},
"ignorePatterns": [
"**/*.snap"
]
},
"prettier": {
"printWidth": 100,
Expand Down

0 comments on commit 9f099e6

Please sign in to comment.