From d27bbbf7ee632e1618f111ae526ccc820473c83f Mon Sep 17 00:00:00 2001 From: David Sanders Date: Wed, 4 Dec 2024 17:46:52 -0800 Subject: [PATCH] ci: switch to GHA --- .circleci/config.yml | 64 ------------------- .../workflows}/mocha-reporter-config.json | 0 .github/workflows/release.yml | 35 ++++++++++ .github/workflows/test.yml | 62 ++++++++++++++++++ README.md | 2 +- package.json | 7 +- 6 files changed, 103 insertions(+), 67 deletions(-) delete mode 100644 .circleci/config.yml rename {.circleci => .github/workflows}/mocha-reporter-config.json (100%) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 325e237..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,64 +0,0 @@ -version: 2.1 - -orbs: - cfa: continuousauth/npm@2.1.1 - node: electronjs/node@2.3.1 - -jobs: - test-electron: - docker: - - image: cimg/node:18.12.1-browsers - parameters: - electron-version: - type: integer - steps: - - checkout - - node/install-packages - - run: yarn add "electron@<< parameters.electron-version >>" - - run: yarn tsc - - run: | - if [[ << parameters.electron-version >> -eq 12 ]]; then - yarn test:ci --in-process-gpu; - else - yarn test:ci; - fi - - store_test_results: - path: test-results - -workflows: - test_and_release: - jobs: - - test-electron: - matrix: - parameters: - electron-version: - - 12 - - 13 - - 14 - - 15 - - 16 - - 17 - - 18 - - 19 - - 20 - - 21 - - 22 - - 23 - - 24 - - 25 - - 26 - - 27 - - 28 - - 29 - - 30 - - 31 - - 32 - - 33 - - cfa/release: - requires: - - test-electron - filters: - branches: - only: - - main - context: cfa-release diff --git a/.circleci/mocha-reporter-config.json b/.github/workflows/mocha-reporter-config.json similarity index 100% rename from .circleci/mocha-reporter-config.json rename to .github/workflows/mocha-reporter-config.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a4b607d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + test: + uses: ./.github/workflows/test.yml + + release: + name: Release + runs-on: ubuntu-latest + needs: test + environment: npm + permissions: + id-token: write # for CFA and npm provenance + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 20.x + cache: 'yarn' + - name: Install + run: yarn install --frozen-lockfile + - uses: continuousauth/action@4e8a2573eeb706f6d7300d6a9f3ca6322740b72d # v1.0.5 + with: + project-id: ${{ secrets.CFA_PROJECT_ID }} + secret: ${{ secrets.CFA_SECRET }} + npm-token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0cc7209 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,62 @@ +name: Test + +on: + pull_request: + branches: + - main + schedule: + - cron: '0 22 * * 3' + workflow_call: + +permissions: + contents: read + +jobs: + test: + name: Test + strategy: + matrix: + electron-version: + - 12 + - 13 + - 14 + - 15 + - 16 + - 17 + - 18 + - 19 + - 20 + - 21 + - 22 + - 23 + - 24 + - 25 + - 26 + - 27 + - 28 + - 29 + - 30 + - 31 + - 32 + - 33 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Setup Node.js + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: '18.20' + cache: 'yarn' + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Install Electron + run: yarn add "electron@${{ matrix.electron-version }}" + - name: Build + run: yarn tsc + - name: Test (Electron 12) + if : ${{ matrix.electron-version == 12 }} + run: yarn test:ci --in-process-gpu + - name: Test (Electron 13+) + if : ${{ matrix.electron-version != 12 }} + run: yarn test:ci diff --git a/README.md b/README.md index 2a29c79..e23a39c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # @electron/remote -[![CircleCI build status](https://circleci.com/gh/electron/remote/tree/main.svg?style=shield)](https://circleci.com/gh/electron/remote/tree/main) +[![Test](https://github.com/electron/remote/actions/workflows/test.yml/badge.svg)](https://github.com/electron/remote/actions/workflows/test.yml) [![npm version](http://img.shields.io/npm/v/@electron/remote.svg)](https://npmjs.org/package/@electron/remote) `@electron/remote` is an [Electron](https://electronjs.org) module that bridges diff --git a/package.json b/package.json index 28d8620..345af56 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "scripts": { "prepare": "tsc", "test": "electron test --extension=ts --require=ts-node/register --exit --js-flags=--expose_gc", - "test:ci": "yarn test --reporter=mocha-multi-reporters --reporter-options=configFile=.circleci/mocha-reporter-config.json" + "test:ci": "yarn test --reporter=mocha-multi-reporters --reporter-options=configFile=.github/workflows/mocha-reporter-config.json" }, "files": [ "README.md", @@ -41,5 +41,8 @@ "dist/src", "index.d.ts" ], - "types": "index.d.ts" + "types": "index.d.ts", + "publishConfig": { + "provenance": true + } }