ci: test if docs build and run task depending on the changes from PR (#11761)

This commit is contained in:
Piotr Kuczynski 2025-11-11 12:34:57 +01:00 committed by GitHub
parent ba3319d583
commit 5a28729b2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,20 +1,49 @@
name: Commit Validation
on:
push:
branches:
- "**"
paths-ignore:
- "docs/**"
pull_request:
branches:
- "**"
workflow_dispatch:
jobs:
formatting:
if: ${{ (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.fork) }}
detect-changes:
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.detect-changes.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: detect-changes
with:
filters: |
package-json: &package-json
- package.json
- package-lock.json
docs: &docs
- docs/**/*
src: &src
- extra/**/*.js
- src/**/*.ts
- gulpfile.js
- tsconfig.json
- *package-json
src-or-tests: &src-or-tests
- *src
- .github/workflows/test/**/*
- .github/workflows/**/*
- .mocharc.json
- .nycrc.json
lint: &lint
- *src-or-tests
- .prettierrc.json
- eslint.config.mjs
formatting:
if: contains(needs.detect-changes.outputs.changes, 'lint')
needs: detect-changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
@ -24,10 +53,25 @@ jobs:
- run: npm run lint
- run: npm run format:ci
build:
if: ${{ (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.fork) }}
docs:
if: contains(needs.detect-changes.outputs.changes, 'docs')
needs: detect-changes
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 20
- run: npm ci
- run: npm run build
build:
if: contains(needs.detect-changes.outputs.changes, 'src-or-tests')
needs: detect-changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
@ -35,16 +79,15 @@ jobs:
node-version: 20
- run: npm ci
- run: npm run compile
- name: Upload build
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: build
path: build/
retention-days: 1
tests-linux:
needs: build
if: contains(needs.detect-changes.outputs.changes, 'src-or-tests')
needs: [detect-changes, build]
strategy:
fail-fast: false
matrix:
@ -54,17 +97,17 @@ jobs:
node-version: ${{matrix.node-version}}
tests-windows:
needs: build
if: contains(needs.detect-changes.outputs.changes, 'src-or-tests')
needs: [detect-changes, build]
uses: ./.github/workflows/tests-windows.yml
with:
node-version: 20
# Run with most databases possible to provide the coverage of the tests
coverage:
if: contains(needs.detect-changes.outputs.changes, 'src-or-tests')
runs-on: ubuntu-latest
needs: [tests-linux, tests-windows]
needs: [detect-changes, tests-linux, tests-windows]
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
- uses: coverallsapp/github-action@v2
with:
parallel-finished: true