From cd9743a650b643d112e0c58dc6f1aba97d120445 Mon Sep 17 00:00:00 2001 From: Vikram Venkataramanan <231742443+vikram-ecobee@users.noreply.github.com> Date: Thu, 24 Sep 2026 13:27:28 -0400 Subject: [PATCH 1/5] Migrate CI to GitHub Actions Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .circleci/config.yml | 82 ---------------------------------------- .github/workflows/ci.yml | 77 +++++++++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 78 insertions(+), 83 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2b3eb0d..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,82 +0,0 @@ -version: 2.1 - -references: - workspace_root: &workspace_root /tmp/nodejs-gcloud-pubsub-module - - container_config: &container_config - docker: - - image: circleci/node:lts - working_directory: *workspace_root - - attach_workspace: &attach_workspace - attach_workspace: - at: *workspace_root - -jobs: - setup: - <<: *container_config - steps: - - checkout - - restore_cache: - key: dependency-cache-{{ checksum "package.json" }} - - run: - name: install-nodejs-gcloud-pubsub-module-dependencies - command: npm install - - save_cache: - key: dependency-cache-{{ checksum "package.json" }} - paths: - - ./node_modules - - persist_to_workspace: - root: *workspace_root - paths: - - ./* - test-unit: - <<: *container_config - steps: - - *attach_workspace - - run: - name: Run unit tests - command: npx jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage - environment: - JEST_JUNIT_OUTPUT: 'reports/jest/results.xml' - - run: - name: codecov - command: 'curl -s https://codecov.io/bash | bash' - - store_artifacts: - path: ./coverage/lcov-report - prefix: coverage - - store_test_results: - path: ./reports - build: - <<: *container_config - steps: - - *attach_workspace - - run: - name: Build - command: npm run build - publish: - <<: *container_config - steps: - - *attach_workspace - - run: - name: Publish - command: npm publish --access public - -workflows: - version: 2.1 - build_test_deploy: - jobs: - - setup - - build: - requires: - - setup - - test-unit: - requires: - - setup - - publish: - requires: - - build - - test-unit - filters: - branches: - only: master diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d835ad2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +permissions: + contents: read + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run build + + test: + name: Unit tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - name: Run unit tests + run: npx jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage + env: + JEST_JUNIT_OUTPUT: reports/jest/results.xml + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-results + path: reports + if-no-files-found: warn + - uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage-report + path: coverage/lcov-report + if-no-files-found: warn + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + publish: + name: Publish + needs: + - build + - test + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + registry-url: https://registry.npmjs.org + - run: npm ci + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 8720913..d58b21c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NodeJS GCloud Pub/Sub module -[![CircleCI](https://circleci.com/gh/ecobee/nodejs-gcloud-pubsub-module.svg?style=svg&circle-token=fbf98de8e837e22ab817ad943bd540fd40684955)](https://circleci.com/gh/ecobee/nodejs-gcloud-pubsub-module) +[![CI](https://github.com/ecobee/nodejs-gcloud-pubsub-module/actions/workflows/ci.yml/badge.svg)](https://github.com/ecobee/nodejs-gcloud-pubsub-module/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/ecobee/nodejs-gcloud-pubsub-module/branch/master/graph/badge.svg?token=F93WezHhBy)](https://codecov.io/gh/ecobee/nodejs-gcloud-pubsub-module) A Google Cloud Pub/Sub library for the [NestJS](https://github.com/nestjs/nest) framework. Easily subscribe or publish to topics in Google Pub/Sub. From bb10cbc857a35ce7e7b0548fe4ff00123573c9ba Mon Sep 17 00:00:00 2001 From: Vikram Venkataramanan <231742443+vikram-ecobee@users.noreply.github.com> Date: Thu, 24 Sep 2026 16:15:39 -0400 Subject: [PATCH 2/5] Re-trigger CI to validate Codecov token Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> From 4d16fb595ca1dc1b5d7da49d1ef9912a4b19c0ff Mon Sep 17 00:00:00 2001 From: Vikram Venkataramanan <231742443+vikram-ecobee@users.noreply.github.com> Date: Thu, 24 Sep 2026 16:27:21 -0400 Subject: [PATCH 3/5] comments to code --- src/helpers/constants.ts | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/helpers/constants.ts b/src/helpers/constants.ts index 79f2ca8..824f575 100644 --- a/src/helpers/constants.ts +++ b/src/helpers/constants.ts @@ -1,13 +1,23 @@ +const ABORTED = 10 +const CANCELLED = 1 +const DEADLINE_EXCEEDED = 4 +const INTERNAL = 13 +const RESOURCE_EXHAUSTED = 8 +const UNAVAILABLE = 14 +const UNKNOWN = 2 +const NOT_FOUND = 5 +const PERMISSION_DENIED = 7 + export const PUB_SUB_DEFAULT_RETRY_CODES = [ - 10, // 'ABORTED' - 1, // 'CANCELLED', - 4, // 'DEADLINE_EXCEEDED' - 13, // 'INTERNAL' - 8, // 'RESOURCE_EXHAUSTED' - 14, // 'UNAVAILABLE' - 2, // 'UNKNOWN' - 5, // NOT_FOUND' - 7, // PERMISSION_DENIED + ABORTED, + CANCELLED, + DEADLINE_EXCEEDED, + INTERNAL, + RESOURCE_EXHAUSTED, + UNAVAILABLE, + UNKNOWN, + NOT_FOUND, + PERMISSION_DENIED, ] export const PUB_SUB_DEFAULT_BACKOFF_SETTINGS = { From b8dc3d9e988596929ad13416f734bc80c038ba33 Mon Sep 17 00:00:00 2001 From: Vikram Venkataramanan <231742443+vikram-ecobee@users.noreply.github.com> Date: Fri, 16 Oct 2026 10:25:12 -0400 Subject: [PATCH 4/5] Pin GitHub Actions runners to Ubuntu 24.04 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d835ad2..a2095a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ permissions: jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -26,7 +26,7 @@ jobs: test: name: Unit tests - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -60,7 +60,7 @@ jobs: - build - test if: github.event_name == 'push' && github.ref == 'refs/heads/master' - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: read id-token: write From 7ecd56a142bfe212b72771e04f155c84352f6778 Mon Sep 17 00:00:00 2001 From: Vikram Venkataramanan <231742443+vikram-ecobee@users.noreply.github.com> Date: Fri, 16 Oct 2026 10:30:25 -0400 Subject: [PATCH 5/5] Centralize CI configuration and support main branch Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/ci.yml | 18 ++++++++++++------ package.json | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2095a1..c125929 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,15 @@ on: push: branches: - master + - main pull_request: branches: - master + - main + +env: + NODE_VERSION: '20' + NPM_REGISTRY_URL: https://registry.npmjs.org permissions: contents: read @@ -19,7 +25,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: ${{ env.NODE_VERSION }} cache: npm - run: npm ci - run: npm run build @@ -31,11 +37,11 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: ${{ env.NODE_VERSION }} cache: npm - run: npm ci - name: Run unit tests - run: npx jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage + run: npm run test:ci env: JEST_JUNIT_OUTPUT: reports/jest/results.xml - uses: actions/upload-artifact@v4 @@ -59,7 +65,7 @@ jobs: needs: - build - test - if: github.event_name == 'push' && github.ref == 'refs/heads/master' + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') runs-on: ubuntu-24.04 permissions: contents: read @@ -68,9 +74,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: ${{ env.NODE_VERSION }} cache: npm - registry-url: https://registry.npmjs.org + registry-url: ${{ env.NPM_REGISTRY_URL }} - run: npm ci - run: npm publish --access public env: diff --git a/package.json b/package.json index 846767e..985bf46 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ ], "scripts": { "test": "jest", + "test:ci": "jest --ci --runInBand --reporters=default --reporters=jest-junit --coverage", "test:cov": "jest --coverage", "test:dev": "jest --watch", "build": "rm -rf ./dist && tsc && npm run build:index",