From 919b84f0722eb3226c0485268de298186278ef14 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Fri, 27 May 2022 21:33:13 -0700 Subject: [PATCH] release 2.2.1 (#36) - chore(ci): depend on shared GHA workflows --- .github/PULL_REQUEST_TEMPLATE.md | 1 - .github/workflows/ci-test.yml | 39 ---------------------- .github/workflows/ci.yml | 57 ++++++++++++++++++++++++++++++++ .github/workflows/codeql.yml | 14 ++++++++ .github/workflows/lint.yml | 32 ------------------ .github/workflows/master.yml | 48 --------------------------- .github/workflows/publish.yml | 16 +++++++++ Changes.md | 5 +++ README.md | 4 +-- index.js | 3 +- package.json | 2 +- 11 files changed, 96 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/ci-test.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/codeql.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/master.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a0393f2..afafec5 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,4 +9,3 @@ Checklist: - [ ] tests updated - [ ] Changes.md updated - [ ] package.json.version bumped -- [x] published to NPM (automatic, upon merge to master) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml deleted file mode 100644 index 4392618..0000000 --- a/.github/workflows/ci-test.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: CI Tests - -on: [ push ] - -env: - CI: true - -jobs: - - ci-test: - runs-on: ${{ matrix.os }} - - services: - redis: - image: redis - ports: - - 6379:6379 - - strategy: - matrix: - os: [ ubuntu-latest ] - node-version: [ 14, 16, 18 ] - fail-fast: false - - steps: - - uses: actions/checkout@v2 - name: git checkout - with: - fetch-depth: 1 - - - uses: actions/setup-node@v3 - name: Use Node.js ${{ matrix.node-version }} - with: - node-version: ${{ matrix.node-version }} - - - name: npm install - run: npm install && npm list --depth=0 - - - run: npm run test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b5f3eca --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +on: + push: + +env: + CI: true + +jobs: + lint: + uses: haraka/.github/.github/workflows/lint.yml@master + + coverage: + uses: haraka/.github/.github/workflows/coverage.yml@master + secrets: inherit + + test: + needs: lint + runs-on: ${{ matrix.os }} + services: + redis: + image: redis + ports: + - 6379:6379 + strategy: + matrix: + os: [ ubuntu-latest ] + node-version: [ 14, 16, 18 ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + name: Node ${{ matrix.node-version }} on ${{ matrix.os }} + with: + node-version: ${{ matrix.node-version }} + + - run: npm install + - run: npm test + + test-win: + needs: lint + if: ${{ false }} # needs redis server + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ windows-latest ] + node-version: [ 14, 16, 18 ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + name: Node ${{ matrix.node-version }} on ${{ matrix.os }} + with: + node-version: ${{ matrix.node-version }} + + - run: npm install + - run: npm test diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..3627451 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,14 @@ +name: CodeQL + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '18 7 * * 4' + +jobs: + codeql: + uses: haraka/.github/.github/workflows/codeql.yml@master diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index f1ae1ba..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Lint - -on: [ push ] - -env: - CI: true - -jobs: - - lint: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [ 16 ] - - steps: - - uses: actions/checkout@v2 - name: Checkout Code - with: - fetch-depth: 1 - - - uses: actions/setup-node@v3 - name: Use Node.js ${{ matrix.node-version }} - with: - node-version: ${{ matrix.node-version }} - - - run: npm install - - - name: Lint - run: npm run lint diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index c4db8ea..0000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,48 +0,0 @@ - -name: publish - -on: - push: - branches: - - master - -env: - node_version: 14 - -jobs: - - publish-npm: - runs-on: ubuntu-latest - - services: - redis: - image: redis - ports: - - 6379:6379 - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Setup node.js ${{ env.node_version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ env.node_version }} - registry-url: https://registry.npmjs.org/ - - - name: npm install - run: npm install - - - name: Run test suite - run: npm run test - - - name: publish to NPM - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - - name: GitHub Release - uses: justincy/github-action-npm-release@2.0.1 - id: release diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d489fbd --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,16 @@ +name: publish + +on: + push: + branches: + - master + paths: + - package.json + +env: + CI: true + +jobs: + publish: + uses: haraka/.github/.github/workflows/publish.yml@master + secrets: inherit \ No newline at end of file diff --git a/Changes.md b/Changes.md index 76e1832..e1575fe 100644 --- a/Changes.md +++ b/Changes.md @@ -1,4 +1,9 @@ +## 2.2.1 - 2022-05-27 + +- chore(ci): depend on shared GHA workflows + + ## 2.2.0 - 2022-05-23 - dep(node): require 14+ diff --git a/README.md b/README.md index 2dc5fcd..830564a 100644 --- a/README.md +++ b/README.md @@ -252,8 +252,8 @@ exports.redis_unsubscribe = function (next, connection) { ``` -[ci-img]: https://github.com/haraka/haraka-results/actions/workflows/ci-test.yml/badge.svg -[ci-url]: https://github.com/haraka/haraka-results/actions/workflows/ci-test.yml +[ci-img]: https://github.com/haraka/haraka-results/actions/workflows/ci.yml/badge.svg +[ci-url]: https://github.com/haraka/haraka-results/actions/workflows/ci.yml [cov-img]: https://codecov.io/github/haraka/haraka-results/coverage.svg [cov-url]: https://codecov.io/github/haraka/haraka-results [clim-img]: https://codeclimate.com/github/haraka/haraka-results/badges/gpa.svg diff --git a/index.js b/index.js index ae4d2fc..b467d3c 100644 --- a/index.js +++ b/index.js @@ -62,8 +62,7 @@ class ResultStore { redis_publish (name, obj) { if (!cfg.main.redis_publish) return; - if (!this.conn.server || !this.conn.server.notes) return; - if (!this.conn.server.notes.redis) return; + if (!this.conn.server?.notes?.redis) return; const channel = `result-${this.conn.transaction ? this.conn.transaction.uuid : this.conn.uuid}`; this.conn.server.notes.redis.publish(channel, JSON.stringify({ plugin: name, result: obj })); diff --git a/package.json b/package.json index 1ef73ef..467c9f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haraka-results", - "version": "2.2.0", + "version": "2.2.1", "description": "Haraka results store for connections and transactions", "main": "index.js", "directories": {