From a9dd99a76532b1677c407575418cd8ceaa8ad2f9 Mon Sep 17 00:00:00 2001 From: Jordan Paulino Date: Fri, 27 Feb 2026 13:31:46 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=95=20Migrate=20from=20CircleCI=20to?= =?UTF-8?q?=20GitHub=20Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace .circleci/ config and scripts with equivalent GitHub Actions workflows under .github/workflows/ci.yml and .github/scripts/. Made-with: Cursor --- .circleci/config.yml | 144 ------------------ {.circleci => .github}/scripts/deploy-docs.sh | 7 +- {.circleci => .github}/scripts/release.sh | 0 .github/workflows/ci.yml | 94 ++++++++++++ package.json | 2 +- 5 files changed, 100 insertions(+), 147 deletions(-) delete mode 100644 .circleci/config.yml rename {.circleci => .github}/scripts/deploy-docs.sh (68%) mode change 100644 => 100755 rename {.circleci => .github}/scripts/release.sh (100%) create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 81188d0c..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,144 +0,0 @@ ---- -version: 2 - -references: - - filter_all: &filter_all - filters: - branches: - only: /.*/ - tags: - only: /.*/ - - filter_stg: &filter_head - filters: - branches: - only: master - tags: - only: stg - - filter_prd: &filter_release - filters: - branches: - ignore: /.*/ - tags: - only: /v[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?/ - -jobs: - - test_node10: - docker: - - image: circleci/node:10 - working_directory: ~/src - steps: - - checkout - - restore_cache: - keys: - - v2-node10-dependencies-{{ checksum "package.json" }} - - v2-node10-dependencies- - - run: npm install - - save_cache: - key: v2-node10-dependencies-{{ checksum "package.json" }} - paths: - - node_modules - - run: npm test - - test_node12: - docker: - - image: circleci/node:12 - working_directory: ~/src - steps: - - checkout - - restore_cache: - keys: - - v2-node12-dependencies-{{ checksum "package.json" }} - - v2-node12-dependencies- - - run: npm install - - save_cache: - key: v2-node12-dependencies-{{ checksum "package.json" }} - paths: - - node_modules - - run: npm test - - run: cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js - - test_node14: - docker: - - image: circleci/node:14 - working_directory: ~/src - steps: - - checkout - - restore_cache: - keys: - - v2-node14-dependencies-{{ checksum "package.json" }} - - v2-node14-dependencies- - - run: npm install - - save_cache: - key: v2-node14-dependencies-{{ checksum "package.json" }} - paths: - - node_modules - - run: npm test - - deploy_docs: - docker: - - image: circleci/node:14 - working_directory: ~/src - steps: - - checkout - - restore_cache: - key: v1-website-dependencies-{{ checksum "website/package.json" }} - - run: - name: Build - command: | - sudo apt-get -y install awscli - bash ./.circleci/scripts/deploy-docs.sh - - save_cache: - key: v1-website-dependencies-{{ checksum "website/package.json" }} - paths: - - website/node_modules - - deploy_package: - docker: - - image: circleci/node:12 - working_directory: ~/repo - steps: - - checkout - - restore_cache: - keys: - - v2-node12-dependencies-{{ checksum "package.json" }} - - v2-node12-dependencies- - - run: npm install - - run: | - echo "$NPMRC" > ~/.npmrc - chmod 600 ~/.npmrc - if [[ "$CIRCLE_TAG" = *-* ]]; then - npm publish --tag=prerelease - else - npm publish - fi - -workflows: - version: 2 - test: - jobs: - - test_node10: - <<: *filter_all - - test_node12: - <<: *filter_all - - test_node14: - <<: *filter_all - - deploy_docs: - <<: *filter_head - context: - - Documentation - requires: - - test_node10 - - test_node12 - - test_node14 - - deploy_package: - <<: *filter_release - context: - - npm-publish - requires: - - test_node10 - - test_node12 - - test_node14 diff --git a/.circleci/scripts/deploy-docs.sh b/.github/scripts/deploy-docs.sh old mode 100644 new mode 100755 similarity index 68% rename from .circleci/scripts/deploy-docs.sh rename to .github/scripts/deploy-docs.sh index 85fd8a85..08225762 --- a/.circleci/scripts/deploy-docs.sh +++ b/.github/scripts/deploy-docs.sh @@ -11,11 +11,14 @@ red(){ >&2 printf "\e[31m$1\e[39m\n" } -export PROJECT_NAME="${PROJECT_NAME:-$CIRCLE_PROJECT_REPONAME}" +export PROJECT_NAME="${PROJECT_NAME:-$GITHUB_REPOSITORY}" if [[ -z "$PROJECT_NAME" ]]; then - red "PROJECT_NAME not set and could not be derived from CIRCLE_PROJECT_REPONAME" + red "PROJECT_NAME not set and could not be derived from GITHUB_REPOSITORY" exit 1 fi + +# Strip the org prefix if GITHUB_REPOSITORY was used (e.g. "org/repo" -> "repo") +PROJECT_NAME="${PROJECT_NAME##*/}" green "PROJECT_NAME: $PROJECT_NAME" export BUILD_DIR="${BUILD_DIR:-website}" diff --git a/.circleci/scripts/release.sh b/.github/scripts/release.sh similarity index 100% rename from .circleci/scripts/release.sh rename to .github/scripts/release.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..ef696e5d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: CI + +on: + push: + branches: + - '**' + tags: + - '**' + pull_request: + +jobs: + test: + name: Test (Node ${{ matrix.node-version }}) + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18, 20, 22] + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm test + + - name: Upload coverage to Coveralls + if: matrix.node-version == 20 + run: cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + continue-on-error: true + + deploy-docs: + name: Deploy Docs + runs-on: ubuntu-latest + needs: test + if: github.ref == 'refs/heads/master' || github.ref == 'refs/tags/stg' + environment: Documentation + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + cache-dependency-path: website/package-lock.json + + - name: Install AWS CLI + run: sudo apt-get -y install awscli + + - name: Deploy docs + run: bash ./.github/scripts/deploy-docs.sh + env: + PROJECT_NAME: ${{ github.event.repository.name }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} + + deploy-package: + name: Publish to npm + runs-on: ubuntu-latest + needs: test + if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref_name, '.') + environment: npm-publish + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm install + + - name: Publish to npm + run: | + if [[ "${{ github.ref_name }}" = *-* ]]; then + npm publish --tag=prerelease + else + npm publish + fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 56ad92ba..04c18c06 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "lint": "eslint lib cli index.js", "test": "npm run lint && jest", "coveralls": "cat ./coverage/lcov.info | coveralls", - "release": "./.circleci/scripts/release.sh", + "release": "./.github/scripts/release.sh", "watch": "jest --watch" }, "jest": {