From a20162cb2d5afd992fe257e433d0c78f35407c3f Mon Sep 17 00:00:00 2001 From: ryanml Date: Fri, 30 Apr 2021 15:20:58 -0700 Subject: [PATCH] Repo standardization, use GitHhub Actions for CI (#101) * Repo standardization, using GH actions Enforcing minimum node version of 12 Removing circleci config, adding GH actions * Adding node 14 and 16 to test matrix --- .circleci/config.yml | 81 ----------------------- .circleci/scripts/collect-har-artifact.sh | 9 --- .circleci/scripts/deps-install.sh | 8 --- .github/workflows/build-lint-test.yml | 32 +++++++++ .nvmrc | 2 +- README.md | 6 ++ package.json | 3 + 7 files changed, 42 insertions(+), 99 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100755 .circleci/scripts/collect-har-artifact.sh delete mode 100755 .circleci/scripts/deps-install.sh create mode 100644 .github/workflows/build-lint-test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 6059f62..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,81 +0,0 @@ -version: 2.1 - -workflows: - build-test: - jobs: - - prep-deps - - test-build: - requires: - - prep-deps - - test-lint: - requires: - - prep-deps - - test-unit: - requires: - - prep-deps - - all-tests-pass: - requires: - - test-build - - test-lint - - test-unit - -jobs: - prep-deps: - docker: - - image: circleci/node:10 - steps: - - checkout - - run: - name: Install deps - command: | - .circleci/scripts/deps-install.sh - - run: - name: Collect yarn install HAR logs - command: | - .circleci/scripts/collect-har-artifact.sh - - persist_to_workspace: - root: . - paths: - - node_modules - - build-artifacts - - test-build: - docker: - - image: circleci/node:10 - steps: - - checkout - - attach_workspace: - at: . - - run: - name: Build project - command: yarn build - - test-lint: - docker: - - image: circleci/node:10 - steps: - - checkout - - attach_workspace: - at: . - - run: - name: Lint - command: yarn lint - - test-unit: - docker: - - image: circleci/node:10 - steps: - - checkout - - attach_workspace: - at: . - - run: - name: Unit tests - command: yarn test - - all-tests-pass: - docker: - - image: circleci/node:10 - steps: - - run: - name: All tests passed - command: echo 'Great success' diff --git a/.circleci/scripts/collect-har-artifact.sh b/.circleci/scripts/collect-har-artifact.sh deleted file mode 100755 index 85d7dcc..0000000 --- a/.circleci/scripts/collect-har-artifact.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -x -set -e -set -u -set -o pipefail - -mkdir -p build-artifacts/yarn-install-har -mv ./*.har build-artifacts/yarn-install-har/ diff --git a/.circleci/scripts/deps-install.sh b/.circleci/scripts/deps-install.sh deleted file mode 100755 index 303897c..0000000 --- a/.circleci/scripts/deps-install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -x -set -e -set -u -set -o pipefail - -yarn --frozen-lockfile --ignore-scripts --har diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml new file mode 100644 index 0000000..b4d113e --- /dev/null +++ b/.github/workflows/build-lint-test.yml @@ -0,0 +1,32 @@ +name: Build, Lint, and Test + +on: + push: + branches: [main] + pull_request: + +jobs: + build-lint-test: + name: Build, Lint, and Test + runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: yarn --frozen-lockfile --ignore-scripts + - run: yarn build + - run: yarn lint + - run: yarn test + all-jobs-pass: + name: All jobs pass + runs-on: ubuntu-20.04 + needs: + - build-lint-test + steps: + - uses: actions/checkout@v2 + - run: echo "Great success!" diff --git a/.nvmrc b/.nvmrc index e338b86..dae199a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v10 +v12 diff --git a/README.md b/README.md index 88354b4..f4c8091 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,9 @@ The project follows the same release process as the other libraries in the MetaM 6. Once approved, the PR is squashed & merged 7. The commit on the base branch is tagged 8. The tag can be published as needed + +## Running tests + +```bash +yarn test +``` diff --git a/package.json b/package.json index 8ccc834..31dcc8f 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,9 @@ "index.d.ts", "index.js.map" ], + "engines": { + "node": ">=12.0.0" + }, "scripts": { "prepublishOnly": "yarn build", "build": "tsc --project .",