From 9d707b2773d89c11ce4a7792a41853ab1dcaba6f Mon Sep 17 00:00:00 2001 From: David Sanders Date: Wed, 20 Nov 2024 16:33:17 -0800 Subject: [PATCH] ci: switch to GHA (#127) --- .circleci/config.yml | 40 ------------------------------- .gitattributes | 6 +++++ .github/workflows/lint.yml | 26 -------------------- .github/workflows/release.yml | 35 +++++++++++++++++++++++++++ .github/workflows/test.yml | 45 +++++++++++++++++++++++++++++++++++ README.md | 2 +- package.json | 3 +++ 7 files changed, 90 insertions(+), 67 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .gitattributes delete mode 100644 .github/workflows/lint.yml 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 bf9a78c..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,40 +0,0 @@ -version: 2.1 - -orbs: - cfa: continuousauth/npm@2.1.1 - node: electronjs/node@2.3.1 - -workflows: - test_and_release: - # Run the test jobs first, then the release only when all the test jobs are successful - jobs: - - node/test: - name: test-<< matrix.executor >>-<< matrix.node-version >> - pre-steps: - - run: git config --global core.autocrlf input - test-steps: - - run: npx yarn test:ci - use-test-steps: true - matrix: - alias: test - parameters: - executor: - - node/linux - - node/macos - - node/windows - node-version: - - '20.10' - - '18.18' - - '16.20' - - '14.21' - exclude: - - executor: node/macos - node-version: '14.21' - - cfa/release: - requires: - - test - filters: - branches: - only: - - main - context: cfa-release diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2eec074 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Source code and markdown files should always use LF as line ending. +*.js text eol=lf +*.json text eol=lf +*.md text eol=lf +*.ts text eol=lf +*.yml text eol=lf diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 9a480cc..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Lint - -on: - push: - branches: - - main - pull_request: - branches: - - main - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Node.js - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: 20.x - - name: Lint - run: | - yarn - yarn lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4151940 --- /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@c32f05c950d4e6f4abd8d1d8a46269525e2dbf55 # v1.0.3 + 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..18f8a38 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Test + +on: + pull_request: + branches: + - main + schedule: + - cron: '0 22 * * 3' + workflow_call: + +permissions: + contents: read + +jobs: + test: + name: Test + strategy: + matrix: + node-version: + - '20.10' + - '18.18' + - '16.20' + - '14.21' + os: + - macos-latest + - ubuntu-latest + - windows-latest + exclude: + - os: macos-latest + node-version: '14.21' + runs-on: "${{ matrix.os }}" + 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: "${{ matrix.node-version }}" + cache: 'yarn' + - name: Install + run: yarn install --frozen-lockfile + - name: Lint + run: yarn lint + - name: Test + run: yarn test:ci diff --git a/README.md b/README.md index 7e8fb27..a5943f7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # @electron/fiddle-core -[![CircleCI](https://circleci.com/gh/electron/fiddle-core.svg?style=svg)](https://circleci.com/gh/electron/fiddle-core) +[![Test](https://github.com/electron/fiddle-core/actions/workflows/test.yml/badge.svg)](https://github.com/electron/fiddle-core/actions/workflows/test.yml) [![NPM](https://img.shields.io/npm/v/@electron/fiddle-core.svg?style=flat)](https://npmjs.org/package/@electron/fiddle-core) Run fiddles from anywhere, on any Electron release diff --git a/package.json b/package.json index c4b5aa8..020d6d6 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "dist", "README.md" ], + "publishConfig": { + "provenance": true + }, "scripts": { "build": "tsc -b", "docs": "api-extractor run --local",