Skip to content

Commit

Permalink
feat!: Require Node20 (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Oct 17, 2023
1 parent 65cd8f7 commit 78e59d1
Show file tree
Hide file tree
Showing 20 changed files with 5,281 additions and 5,249 deletions.
74 changes: 35 additions & 39 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
module.exports = {
env: {
node: true,
jest: true,
es2020: true,
},
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
ignorePatterns: [
'action/',
'**/*.d.ts',
'**/node_modules/**'
],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
'quotes': [ 'warn', 'single', { 'avoidEscape': true } ],
env: {
node: true,
jest: true,
es2020: true,
},
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
ignorePatterns: ['action/', '**/*.d.ts', '**/node_modules/**', 'fixtures'],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
quotes: ['warn', 'single', { avoidEscape: true }],

// e.g. "@typescript-eslint/explicit-function-return-type": "off",
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [ 'warn', { ignoreRestSiblings: true, argsIgnorePattern: '^_' } ],
},
overrides: [
{
files: ['*.json'],
rules: {
'quotes': [ 'error', 'double' ],
}
}
],
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true, argsIgnorePattern: '^_' }],
},
overrides: [
{
files: ['*.json'],
rules: {
quotes: ['error', 'double'],
},
},
],
};
34 changes: 11 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,36 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --frozen-lockfile
- uses: streetsidesoftware/actions/public/setup-node-pnpm@v1
- run: pnpm i
- run: git --no-pager diff --compact-summary --exit-code

unit-test: # make sure unit-tests run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --frozen-lockfile
- uses: streetsidesoftware/actions/public/setup-node-pnpm@v1
- run: pnpm i
# Build should not be necessary to run tests
- run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} GITHUB_OUTPUT="" yarn test
- run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} GITHUB_OUTPUT="" pnpm test

clean-build: # make sure nothing changes with a clean build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --frozen-lockfile
- uses: streetsidesoftware/actions/public/setup-node-pnpm@v1
- run: pnpm i
# Ensure the repository is clean after build
- run: yarn clean-build
- run: pnpm clean-build
- run: git --no-pager diff --compact-summary --exit-code

coverage: # run coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --frozen-lockfile
- run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} GITHUB_OUTPUT="" yarn coverage
- uses: streetsidesoftware/actions/public/setup-node-pnpm@v1
- run: pnpm i
- run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} GITHUB_OUTPUT="" pnpm coverage

- name: Upload coverage Coveralls
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # 2.2.3
Expand Down
105 changes: 70 additions & 35 deletions .github/workflows/update-cspell.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: " 📚 Update CSpell"

on:
workflow_dispatch:
inputs:
base:
description: The Base Ref to apply the diff
required: false
default: "main"

push:
branches:
- main
workflow_dispatch:

schedule:
- cron: "0 12 * * *"

Expand All @@ -16,76 +23,104 @@ jobs:
if: github.repository_owner == 'streetsidesoftware'
runs-on: ubuntu-latest
env:
NEW_BRANCH: "update-cspell"
REF_BRANCH: main
NEW_BRANCH: update-cspell-${{ inputs.base || 'main' }}
REF_BRANCH: ${{ inputs.base || 'main' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.REF_BRANCH }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: yarn

- uses: streetsidesoftware/actions/public/setup-node-pnpm@v1

- name: Install
run: yarn --frozen-lockfile
run: pnpm i

- name: Update CSpell
run: |
cd action-src
echo CSPELL_VERSION_OLD=$(yarn exec -s cspell -- -V) >> $GITHUB_ENV
yarn add cspell@latest cspell-glob@latest
yarn
yarn exec -s cspell -- -V
echo "CSPELL_VERSION=$(yarn exec -s cspell -- -V)" >> $GITHUB_ENV
echo CSPELL_VERSION_OLD=$(pnpm exec cspell -V) >> $GITHUB_ENV
pnpm add cspell@latest cspell-glob@latest
pnpm i
pnpm exec cspell -V
echo "CSPELL_VERSION=$(pnpm exec cspell -V)" >> $GITHUB_ENV
- name: Minor Versions
run: |
echo CSPELL_MINOR_OLD=$(echo '"${{ env.CSPELL_VERSION_OLD }}"' | jq 'sub("\\.[0-9]+$";"")') >> $GITHUB_ENV
echo CSPELL_MINOR_NEW=$(echo '"${{ env.CSPELL_VERSION }}"' | jq 'sub("\\.[0-9]+$";"")') >> $GITHUB_ENV
- name: Determine Update type
env:
type: ${{ (env.CSPELL_MINOR_OLD == env.CSPELL_MINOR_NEW && 'fix') || 'feat' }}
run: |
echo PR_TYPE=$type >> $GITHUB_ENV
- name: Update Dictionaries
run: |
cd action
yarn add @cspell/cspell-bundled-dicts@latest
- name: Install Updates
run: |
yarn install
npx package-json-dependency-updater -u
yarn
pnpm i
- name: Update packages Src
run: yarn clean-build
run: pnpm clean-build

- name: Git Status
id: git-status
uses: streetsidesoftware/actions/public/dirty@v1

- name: Has changes
run: |
git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV
git --no-pager diff --compact-summary
- name: Echo git_status
env:
REPORT: |
Dirty: ${{ steps.git-status.outputs.isDirty && 'yes' || 'no' }}
Status: ${{ env.git_status }}
CSpell Version: ${{ env.CSPELL_VERSION }}
Old Version: ${{ env.CSPELL_VERSION_OLD }}
run: |
echo Status: ${{ env.git_status }}
echo CSpell Version: ${{ env.CSPELL_VERSION }}
echo "$REPORT"
- name: Gen Body
run: |
echo 'git_body<<DIFF' >> $GITHUB_ENV
git --no-pager diff --compact-summary >> $GITHUB_ENV
echo 'DIFF' >> $GITHUB_ENV
- uses: tibdex/github-app-token@v2 # cspell:ignore tibdex
if: env.git_status == 'dirty'
id: generate-token
- name: Summary
id: summary
uses: streetsidesoftware/actions/public/output@v1
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Create Pull Request
if: env.git_status == 'dirty'
uses: peter-evans/create-pull-request@v5
value: |
CSpell Version: ${{ env.CSPELL_VERSION }}
Old Version: ${{ env.CSPELL_VERSION_OLD }}
Type: ${{ env.PR_TYPE }}
Status: ${{ steps.git-status.outputs.isDirty && 'dirty' || 'clean' }}
```
${{ steps.git-status.outputs.status }}
```
diff:
```
${{ env.git_body }}
```
- name: Show Summary
uses: streetsidesoftware/actions/public/summary@v1
with:
text: ${{ steps.summary.outputs.value }}

- name: PR
if: steps.git-status.outputs.isDirty
uses: streetsidesoftware/actions/.github/actions/pr@v1
with:
commit-message: "${{ env.PR_TYPE }}: Update CSpell to (${{ env.CSPELL_VERSION }})"
branch: ${{ env.NEW_BRANCH }}
base: ${{ env.REF_BRANCH }}
title: "${{ env.PR_TYPE }}: Update CSpell to (${{ env.CSPELL_VERSION }}) (${{ env.REF_BRANCH }})"
token: ${{ steps.generate-token.outputs.token }}
body: ${{ env.git_body }}
delete-branch: true
body: ${{ steps.summary.outputs.value }}
app_id: ${{ secrets.AUTOMATION_APP_ID }}
app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
Loading

0 comments on commit 78e59d1

Please sign in to comment.