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/3] 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/3] 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/3] 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 = {