Skip to content

Commit

Permalink
ci: some changes to how CircleCI runs so that Codecov works
Browse files Browse the repository at this point in the history
... I hope
  • Loading branch information
spiltcoffee committed Apr 24, 2021
1 parent c1823ee commit 93da8f9
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 60 deletions.
188 changes: 129 additions & 59 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ executors:
node-executor:
docker:
- image: circleci/node:latest
working_directory: ~/repo
working_directory: ~/workspace

jobs:
install:
Expand All @@ -17,32 +17,83 @@ jobs:
- run: npm --version
- run: yarn --version

- checkout
- checkout:
path: postdfm

- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

- run:
command: yarn --frozen-lockfile
working_directory: postdfm

- save_cache:
paths:
- postdfm/node_modules
# for nearleyc
- postdfm/packages/@postdfm/dfm2ast/node_modules
key: node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

install-with-sourcemaps:
executor: node-executor
steps:
- checkout:
path: postdfm
- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

- run: yarn --frozen-lockfile
- run: mv postdfm postdfm-with-sourcemaps

- save_cache:
paths:
- node_modules
- postdfm-with-sourcemaps/node_modules
# for nearleyc
- packages/@postdfm/dfm2ast/node_modules
key: node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- postdfm-with-sourcemaps/packages/@postdfm/dfm2ast/node_modules
key: node-{{ .Environment.CACHE_VERSION }}-dependencies-with-sourcemaps-{{ checksum "postdfm-with-sourcemaps/yarn.lock" }}

compile:
executor: node-executor
steps:
- checkout
- checkout:
path: postdfm

- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

- run: yarn compile
- run:
command: yarn compile
working_directory: postdfm

- persist_to_workspace:
root: packages
root: postdfm/packages
paths:
- ./postdfm/dist
- ./@postdfm/ast/dist
- ./@postdfm/ast2dfm/dist
- ./@postdfm/dfm2ast/dist
- ./@postdfm/dfm2ast/src
- ./@postdfm/plugin/dist
- ./@postdfm/transform/dist

compile-with-sourcemaps:
executor: node-executor
steps:
- checkout:
path: postdfm-with-sourcemaps

- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-with-sourcemaps-{{ checksum "postdfm-with-sourcemaps/yarn.lock" }}

- run:
command: yarn compile:map
working_directory: postdfm-with-sourcemaps

- persist_to_workspace:
root: postdfm-with-sourcemaps/packages
paths:
- ./postdfm/dist
- ./@postdfm/ast/dist
Expand All @@ -55,142 +106,156 @@ jobs:
lint:
executor: node-executor
steps:
- checkout
- checkout:
path: postdfm

- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

- attach_workspace:
at: ~/repo/packages
at: postdfm/packages

- run: yarn lint:check
- run:
command: yarn lint:check
working_directory: postdfm

format:
executor: node-executor
steps:
- checkout
- checkout:
path: postdfm

- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

- run: yarn format:check
- run:
command: yarn format:check
working_directory: postdfm

test:
executor: node-executor
steps:
- checkout
- checkout:
path: postdfm-with-sourcemaps

- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- node-{{ .Environment.CACHE_VERSION }}-dependencies-with-sourcemaps-{{ checksum "postdfm-with-sourcemaps/yarn.lock" }}

- attach_workspace:
at: ~/repo/packages
at: postdfm-with-sourcemaps/packages

- run: yarn test
- run:
command: yarn test
working_directory: postdfm-with-sourcemaps

- store_test_results:
path: ~/repo/packages/postdfm/results
path: postdfm-with-sourcemaps/packages/postdfm/results

- codecov/upload:
flags: "postdfm"
file: ~/repo/packages/postdfm/results/lcov/coverage.info
file: postdfm-with-sourcemaps/packages/postdfm/results/lcov/coverage.info

- store_test_results:
path: ~/repo/packages/@postdfm/ast/results
path: postdfm-with-sourcemaps/packages/@postdfm/ast/results

- codecov/upload:
flags: "@postdfm/ast"
file: ~/repo/packages/@postdfm/ast/results/lcov/coverage.info
file: postdfm-with-sourcemaps/packages/@postdfm/ast/results/lcov/coverage.info

- store_test_results:
path: ~/repo/packages/@postdfm/ast2dfm/results
path: postdfm-with-sourcemaps/packages/@postdfm/ast2dfm/results

- codecov/upload:
flags: "@postdfm/ast2dfm"
file: ~/repo/packages/@postdfm/ast2dfm/results/lcov/coverage.info
file: postdfm-with-sourcemaps/packages/@postdfm/ast2dfm/results/lcov/coverage.info

- store_test_results:
path: ~/repo/packages/@postdfm/dfm2ast/results
path: postdfm-with-sourcemaps/packages/@postdfm/dfm2ast/results

- codecov/upload:
flags: "@postdfm/dfm2ast"
file: ~/repo/packages/@postdfm/dfm2ast/results/lcov/coverage.info
file: postdfm-with-sourcemaps/packages/@postdfm/dfm2ast/results/lcov/coverage.info

- store_test_results:
path: ~/repo/packages/@postdfm/plugin/results
path: postdfm-with-sourcemaps/packages/@postdfm/plugin/results

- codecov/upload:
flags: "@postdfm/plugin"
file: ~/repo/packages/@postdfm/plugin/results/lcov/coverage.info
file: postdfm-with-sourcemaps/packages/@postdfm/plugin/results/lcov/coverage.info

- store_test_results:
path: ~/repo/packages/@postdfm/transform/results
path: postdfm-with-sourcemaps/packages/@postdfm/transform/results

- codecov/upload:
flags: "@postdfm/transform"
file: ~/repo/packages/@postdfm/transform/results/lcov/coverage.info
file: postdfm-with-sourcemaps/packages/@postdfm/transform/results/lcov/coverage.info

docs:
executor: node-executor
steps:
- checkout
- checkout:
path: postdfm

- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

- attach_workspace:
at: ~/repo/packages

- run: yarn docs
at: postdfm/packages

# currently not used for anything
# - persist_to_workspace:
# root: docs
# paths:
# - ./*
- run:
command: yarn docs
working_directory: postdfm

release:
executor: node-executor
steps:
- checkout
- restore_cache:
keys:
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "yarn.lock" }}
- node-{{ .Environment.CACHE_VERSION }}-dependencies-{{ checksum "postdfm/yarn.lock" }}

- attach_workspace:
at: ~/repo/packages
at: postdfm/packages

# currently not used for anything
# - attach_workspace:
# at: ~/repo/docs

- run: yarn release
- run:
command: yarn release
working_directory: postdfm

- store_artifacts:
path: ~/repo/dist
path: postdfm/dist
- store_artifacts:
path: ~/repo/package.json
path: postdfm/package.json
- store_artifacts:
path: ~/repo/packages/postdfm/package.json
path: postdfm/packages/postdfm/package.json
- store_artifacts:
path: ~/repo/packages/@postdfm/ast/package.json
path: postdfm/packages/@postdfm/ast/package.json
- store_artifacts:
path: ~/repo/packages/@postdfm/ast2dfm/package.json
path: postdfm/packages/@postdfm/ast2dfm/package.json
- store_artifacts:
path: ~/repo/packages/@postdfm/dfm2ast/package.json
path: postdfm/packages/@postdfm/dfm2ast/package.json
- store_artifacts:
path: ~/repo/packages/@postdfm/plugin/package.json
- store_artifacts:
path: ~/repo/packages/@postdfm/transform/package.json
path: postdfm/packages/@postdfm/transform/package.json

workflows:
version: 2
ci:
jobs:
- install
- install-with-sourcemaps:
requires:
- install
- compile:
requires:
- install
- compile-with-sourcemaps:
requires:
- install-with-sourcemaps
- format:
requires:
- install
Expand All @@ -199,7 +264,7 @@ workflows:
- compile
- test:
requires:
- compile
- compile-with-sourcemaps
- docs:
requires:
- compile
Expand All @@ -209,3 +274,8 @@ workflows:
- format
- test
- docs
filters:
branches:
only:
- master
- beta
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
"type": "module",
"scripts": {
"postinstall": "husky install",
"ci": "yarn --frozen-lockfile && yarn run compile && yarn run lint:check && yarn run format:check && yarn test && yarn docs",
"ci": "yarn --frozen-lockfile && yarn run compile:map && yarn run lint:check && yarn run format:check && yarn test && yarn docs",
"lint": "eslint --ignore-path .gitignore \"**/*.{js,ts}\"",
"lint:fix": "yarn lint --fix",
"lint:check": "yarn lint",
"format": "prettier --ignore-path .gitignore \"**/*.{js,json,ts,yml,md}\"",
"format:fix": "yarn format --write --list-different",
"format:check": "yarn format --check",
"compile": "yarn workspaces run compile",
"compile:map": "yarn workspaces run compile:map",
"test": "yarn workspaces run test",
"docs": "yarn workspaces run docs",
"release": "semantic-release",
Expand Down
1 change: 1 addition & 0 deletions packages/@postdfm/ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"scripts": {
"compile": "tsc --listEmittedFiles",
"compile:map": "yarn compile --sourcemap",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --verbose",
"docs": "typedoc --options typedoc.config.cjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/@postdfm/ast2dfm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"scripts": {
"compile": "tsc --listEmittedFiles",
"compile:map": "yarn compile --sourcemap",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --verbose",
"docs": "typedoc --options typedoc.config.cjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/@postdfm/dfm2ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"precompile": "nearleyc ne/grammar.ne -o src/grammar.ts",
"compile": "tsc --listEmittedFiles",
"compile:map": "yarn compile --sourcemap",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --verbose",
"docs": "typedoc --options typedoc.config.cjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/@postdfm/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"scripts": {
"compile": "tsc --listEmittedFiles",
"compile:map": "yarn compile --sourcemap",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --verbose",
"docs": "typedoc --options typedoc.config.cjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/@postdfm/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"scripts": {
"compile": "tsc --listEmittedFiles",
"compile:map": "yarn compile --sourcemap",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --verbose",
"docs": "typedoc --options typedoc.config.cjs"
},
Expand Down
1 change: 1 addition & 0 deletions packages/postdfm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"scripts": {
"compile": "tsc --listEmittedFiles",
"compile:map": "yarn compile --sourcemap",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --verbose",
"docs": "typedoc --options typedoc.config.cjs"
},
Expand Down

0 comments on commit 93da8f9

Please sign in to comment.