Skip to content

Improve unit test path filtering rules #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
---
name: Unit tests
on:
push:
paths-ignore:
- '**/*.md'
- '**/*.asciidoc'
- '**/*.txt'
- 'docs/**'
- '.ci/**'
- '.buildkite/**'
- 'scripts/**'
- 'catalog-info.yaml'
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.asciidoc'
- '**/*.txt'
- 'docs/**'
- '.ci/**'
- '.buildkite/**'
- 'scripts/**'
- 'catalog-info.yaml'
pull_request: {}

jobs:
paths-filter:
name: Detect files changed
runs-on: ubuntu-latest
outputs:
skip: '${{ steps.changes.outputs.skip }}'
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter/@v2.11.1
id: changes
with:
filters: |
skip:
- '**/*.md'
- '**/*.asciidoc'
- '**/*.txt'
- 'docs/**'
- '.ci/**'
- '.buildkite/**'
- 'scripts/**'
- 'catalog-info.yaml'

test:
name: Test
runs-on: ${{ matrix.os }}
needs: paths-filter
# only run if files not in `skip` filter were changed
if: needs.paths-filter.outputs.skip != 'true'

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down Expand Up @@ -61,7 +66,7 @@ jobs:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "tsc",
"clean-build": "rimraf ./lib && mkdir lib",
"prepublishOnly": "npm run build",
"test": "npm run build && npm run lint && tap test/unit/{*,**/*}.test.ts && npm run license-checker",
"test": "npm run build && npm run lint && tap test/unit/{*,**/*}.test.ts",
"test:coverage-100": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --100",
"test:coverage-report": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage && nyc report --reporter=text-lcov > coverage.lcov",
"test:coverage-ui": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --coverage-report=html",
Expand Down