From 93da8f9e27fe21d9af3af725022955ee4cd0bc25 Mon Sep 17 00:00:00 2001 From: spiltcoffee Date: Sun, 25 Apr 2021 00:23:01 +1000 Subject: [PATCH] ci: some changes to how CircleCI runs so that Codecov works ... I hope --- .circleci/config.yml | 188 ++++++++++++++++------- package.json | 3 +- packages/@postdfm/ast/package.json | 1 + packages/@postdfm/ast2dfm/package.json | 1 + packages/@postdfm/dfm2ast/package.json | 1 + packages/@postdfm/plugin/package.json | 1 + packages/@postdfm/transform/package.json | 1 + packages/postdfm/package.json | 1 + 8 files changed, 137 insertions(+), 60 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1841c44c..ae3acd69 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ executors: node-executor: docker: - image: circleci/node:latest - working_directory: ~/repo + working_directory: ~/workspace jobs: install: @@ -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 @@ -55,99 +106,109 @@ 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 @@ -155,42 +216,46 @@ jobs: - 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 @@ -199,7 +264,7 @@ workflows: - compile - test: requires: - - compile + - compile-with-sourcemaps - docs: requires: - compile @@ -209,3 +274,8 @@ workflows: - format - test - docs + filters: + branches: + only: + - master + - beta diff --git a/package.json b/package.json index 6eaf550b..51671a01 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "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", @@ -16,6 +16,7 @@ "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", diff --git a/packages/@postdfm/ast/package.json b/packages/@postdfm/ast/package.json index 3d83de91..1e7f1b7d 100644 --- a/packages/@postdfm/ast/package.json +++ b/packages/@postdfm/ast/package.json @@ -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" }, diff --git a/packages/@postdfm/ast2dfm/package.json b/packages/@postdfm/ast2dfm/package.json index 42c88311..278e8c1f 100644 --- a/packages/@postdfm/ast2dfm/package.json +++ b/packages/@postdfm/ast2dfm/package.json @@ -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" }, diff --git a/packages/@postdfm/dfm2ast/package.json b/packages/@postdfm/dfm2ast/package.json index 6a00365f..3a27d637 100644 --- a/packages/@postdfm/dfm2ast/package.json +++ b/packages/@postdfm/dfm2ast/package.json @@ -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" }, diff --git a/packages/@postdfm/plugin/package.json b/packages/@postdfm/plugin/package.json index dc49701c..48b23525 100644 --- a/packages/@postdfm/plugin/package.json +++ b/packages/@postdfm/plugin/package.json @@ -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" }, diff --git a/packages/@postdfm/transform/package.json b/packages/@postdfm/transform/package.json index 8d32097b..614b2573 100644 --- a/packages/@postdfm/transform/package.json +++ b/packages/@postdfm/transform/package.json @@ -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" }, diff --git a/packages/postdfm/package.json b/packages/postdfm/package.json index de98cb74..9fb068c2 100644 --- a/packages/postdfm/package.json +++ b/packages/postdfm/package.json @@ -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" },