From a9dd99a76532b1677c407575418cd8ceaa8ad2f9 Mon Sep 17 00:00:00 2001 From: Jordan Paulino Date: Fri, 27 Feb 2026 13:31:46 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8D=95=20Migrate=20from=20CircleCI=20?= =?UTF-8?q?to=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": { From 5901c84cd4b3a59ab08ddc3e6ae9492f074c699f Mon Sep 17 00:00:00 2001 From: Jordan Paulino Date: Mon, 13 Apr 2026 17:41:31 -0400 Subject: [PATCH 2/3] fix(ci): harden GitHub Actions and stabilize tests on modern Node - Use npm ci --legacy-peer-deps for reproducible installs with current lockfile - Add concurrency, workflow_dispatch, fail-fast false, explicit npm cache path - Replace apt-get awscli + env with aws-actions/configure-aws-credentials - Upload coverage via coverallsapp/github-action with GITHUB_TOKEN - Drop invalid website package-lock cache path (no lockfile) - Relax JSON error assertions for Node 20+ parse messages - README: swap CircleCI badge for Actions workflow badge Made-with: Cursor --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++++--------------- README.md | 2 +- lib/cmd/import.test.js | 8 ++++++-- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef696e5d..ede01d47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,21 @@ on: tags: - '**' pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read jobs: test: name: Test (Node ${{ matrix.node-version }}) runs-on: ubuntu-latest strategy: + fail-fast: false matrix: node-version: [18, 20, 22] steps: @@ -22,19 +31,21 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'npm' + cache: npm + cache-dependency-path: package-lock.json - name: Install dependencies - run: npm install + run: npm ci --legacy-peer-deps - 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 }} + if: success() && matrix.node-version == 20 + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage/lcov.info continue-on-error: true deploy-docs: @@ -50,19 +61,18 @@ jobs: 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: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - 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 @@ -77,11 +87,12 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - cache: 'npm' + cache: npm + cache-dependency-path: package-lock.json registry-url: 'https://registry.npmjs.org' - name: Install dependencies - run: npm install + run: npm ci --legacy-peer-deps - name: Publish to npm run: | diff --git a/README.md b/README.md index 46d3dea6..f2643cc9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # claycli A CLI For Clay! -[![CircleCI](https://circleci.com/gh/clay/claycli.svg?style=svg)](https://circleci.com/gh/clay/claycli) [![Coverage Status](https://coveralls.io/repos/github/clay/claycli/badge.svg?branch=master)](https://coveralls.io/github/clay/claycli?branch=master) +[![CI](https://github.com/nymag/clay-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/nymag/clay-cli/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/clay/claycli/badge.svg?branch=master)](https://coveralls.io/github/clay/claycli?branch=master) # Installation diff --git a/lib/cmd/import.test.js b/lib/cmd/import.test.js index f2c163e6..f38fb511 100644 --- a/lib/cmd/import.test.js +++ b/lib/cmd/import.test.js @@ -27,7 +27,11 @@ describe('import', () => { it('returns error if bad JSON', () => { return lib(']{"a"\:}', url).toPromise(Promise).then((res) => { - expect(res).toEqual({ type: 'error', message: 'JSON syntax error: Unexpected token ] in JSON at position 0', details: ']{"a":}' }); + expect(res).toMatchObject({ + type: 'error', + details: ']{"a":}', + message: expect.stringMatching(/^JSON syntax error:/), + }); }); }); @@ -246,7 +250,7 @@ describe('import', () => { it('returns error if bad json', () => { return fn(JSON.stringify({ a: 'hi' }) + 'a', url).toPromise(Promise).catch((e) => { - expect(e.message).toBe('JSON parser error: Unexpected token a in JSON at position 10'); + expect(e.message).toMatch(/^JSON parser error:/); }); }); From 93aca46d44295382ee5b6f31e2695eed22884abc Mon Sep 17 00:00:00 2001 From: Jordan Paulino Date: Mon, 13 Apr 2026 17:56:13 -0400 Subject: [PATCH 3/3] docs(readme): point CI badge at clay/claycli Made-with: Cursor --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2643cc9..9680c35d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # claycli A CLI For Clay! -[![CI](https://github.com/nymag/clay-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/nymag/clay-cli/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/clay/claycli/badge.svg?branch=master)](https://coveralls.io/github/clay/claycli?branch=master) +[![CI](https://github.com/clay/claycli/actions/workflows/ci.yml/badge.svg)](https://github.com/clay/claycli/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/clay/claycli/badge.svg?branch=master)](https://coveralls.io/github/clay/claycli?branch=master) # Installation