Skip to content
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

Improve CI test job speed #2123

Merged
merged 9 commits into from Sep 6, 2022
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

joshuayoes marked this conversation as resolved.
Show resolved Hide resolved
version: 2.1
jobs:
tests:
<<: *defaults
parallelism: 4
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
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
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
- 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
joshuayoes marked this conversation as resolved.
Show resolved Hide resolved
- run:
name: Run jest tests
command: yarn test
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
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
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved

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
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
# 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
1 change: 1 addition & 0 deletions .prettierignore
@@ -0,0 +1 @@
/build
joshuayoes marked this conversation as resolved.
Show resolved Hide resolved
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}'",
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
"lint": "eslint src test --ext .ts --fix && yarn format",
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
"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",
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
"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",
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
"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"
]
jamonholmgren marked this conversation as resolved.
Show resolved Hide resolved
},
"prettier": {
"printWidth": 100,
Expand Down