From ea26297b6fe44547ccf0fe8cb97e92e382c77d2e Mon Sep 17 00:00:00 2001 From: Louis Brunner Date: Thu, 12 Dec 2024 15:38:31 +0000 Subject: [PATCH] ci: improve GHA + upgrade node versions (#331) --- .github/dependabot.yaml | 31 +++++++++--- .github/workflows/build.yml | 90 +++++++++++++++++----------------- .github/workflows/lint-gha.yml | 28 +++++++++++ esbuild/build.js | 2 +- package-lock.json | 21 ++++---- package.json | 2 +- 6 files changed, 112 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/lint-gha.yml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 9cf12420..f3cb0043 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,10 +1,29 @@ version: 2 updates: - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "monthly" - package-ecosystem: "github-actions" - directory: "/" + directory: / + schedule: + interval: weekly + groups: + actions-deps: + patterns: + - "*" + + - package-ecosystem: npm + directory: / schedule: - interval: "weekly" + interval: monthly + groups: + security-updates: + applies-to: security-updates + patterns: + - "*" + major-updates: + applies-to: version-updates + update-types: + - "major" + minor-updates: + applies-to: version-updates + update-types: + - "minor" + - "patch" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a31865f..e093752b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,32 +10,32 @@ jobs: strategy: matrix: - node-version: [16, 18, 20] + node-version: [18, 20, 22] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - name: Install dependencies - run: npm install - - run: npm run test:ci - - run: npm run lint - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - flag-name: node-${{ matrix.node }} - parallel: true - - run: npm run build:examples - - name: Upload examples build - uses: actions/upload-artifact@v4 - if: ${{ matrix.node-version == 'latest' }} - with: - name: Examples - path: examples + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - name: Install dependencies + run: npm install + - run: npm run test:ci + - run: npm run lint + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: node-${{ matrix.node }} + parallel: true + - run: npm run build:examples + - name: Upload examples build + uses: actions/upload-artifact@v4 + if: ${{ matrix.node-version == 'latest' }} + with: + name: Examples + path: examples finish: name: Coverage @@ -44,11 +44,11 @@ jobs: needs: build steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true deploy: name: Deploy @@ -58,19 +58,19 @@ jobs: if: github.ref == 'refs/heads/main' steps: - - name: Checkout - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Download examples build - uses: actions/download-artifact@v4 - with: - name: Examples - path: examples - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - enable_jekyll: true - publish_dir: ./ - force_orphan: true + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Download examples build + uses: actions/download-artifact@v4 + with: + name: Examples + path: examples + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + enable_jekyll: true + publish_dir: ./ + force_orphan: true diff --git a/.github/workflows/lint-gha.yml b/.github/workflows/lint-gha.yml new file mode 100644 index 00000000..662e4eed --- /dev/null +++ b/.github/workflows/lint-gha.yml @@ -0,0 +1,28 @@ +name: Lint Github Actions + +on: + push: + branches: [main] + paths: + - ".github/**" + pull_request: + paths: + - ".github/**" + +jobs: + lint: + name: Lint YAML files + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ibiqlik/action-yamllint@v3 + with: + file_or_dir: .github + config_data: | + extends: default + rules: + line-length: + max: 120 + level: warning + document-start: disable + truthy: disable diff --git a/esbuild/build.js b/esbuild/build.js index bd5fcf5e..20ce95eb 100644 --- a/esbuild/build.js +++ b/esbuild/build.js @@ -1,6 +1,6 @@ import esbuild from 'esbuild'; -import tsConfig from '../tsconfig.json' assert { type: 'json' }; import { nodeExternalsPlugin } from 'esbuild-node-externals'; +import tsConfig from '../tsconfig.json' with { type: 'json' }; esbuild.build({ entryPoints: ['./src/index.ts'], diff --git a/package-lock.json b/package-lock.json index f5751118..12353ea5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7471,10 +7471,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -17568,10 +17569,11 @@ } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -21010,10 +21012,11 @@ } }, "node_modules/sane/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, + "license": "MIT", "dependencies": { "nice-try": "^1.0.4", "path-key": "^2.0.1", diff --git a/package.json b/package.json index b6171d44..cd65b45c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ ], "engines": { "npm": ">=7.0.0", - "node": ">=15.0.0" + "node": ">=18.0.0" }, "funding": { "type": "individual",