Skip to content

Commit ce0d6d8

Browse files
committed
Move path filter to workflow level
1 parent 0119ff9 commit ce0d6d8

2 files changed

Lines changed: 21 additions & 41 deletions

File tree

.github/workflows/TestPWTCommands.yml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@ name: Script tests
22

33
on:
44
push:
5-
branches: [master]
5+
branches:
6+
- master
7+
paths:
8+
- 'pnpm-lock.yaml'
9+
- 'packages/generator-widget/**'
10+
- 'packages/pluggable-widgets-tools/**'
11+
- 'packages/command-tests/**'
612
pull_request:
7-
branches: [master]
13+
branches:
14+
- master
15+
paths:
16+
- 'pnpm-lock.yaml'
17+
- 'packages/generator-widget/**'
18+
- 'packages/pluggable-widgets-tools/**'
19+
- 'packages/command-tests/**'
820

921
jobs:
1022
test:
@@ -20,20 +32,6 @@ jobs:
2032
with:
2133
submodules: false
2234

23-
- name: "Checking changed files"
24-
id: filter
25-
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
26-
if: github.event_name == 'pull_request'
27-
with:
28-
filters: |
29-
packages:
30-
- 'packages/generator-widget/*'
31-
- 'packages/pluggable-widgets-tools/*'
32-
tests:
33-
- 'packages/command-tests/*'
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
3735
- name: Setup pnpm
3836
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
3937
if: matrix.node == 16
@@ -52,14 +50,12 @@ jobs:
5250
cache: 'pnpm'
5351

5452
- name: "Installing dependencies"
55-
if: steps.filter.outputs.packages == 'true' || steps.filter.outputs.tests == 'true'
5653
run: pnpm install
5754

5855
- name: Increase number of watchers
59-
if: (steps.filter.outputs.packages == 'true' || steps.filter.outputs.tests == 'true') && startsWith(matrix.os, 'ubuntu')
56+
if: startsWith(matrix.os, 'ubuntu')
6057
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
6158

6259
- name: "Testing PWT commands"
6360
working-directory: ./packages/command-tests
64-
if: steps.filter.outputs.packages == 'true' || steps.filter.outputs.tests == 'true'
6561
run: pnpm test

.github/workflows/UnitTests.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ name: Run unit tests
33
on:
44
push:
55
branches: [master]
6+
paths:
7+
- 'pnpm-lock.yaml'
8+
- 'packages/**'
69
pull_request:
710
branches: [master]
11+
paths:
12+
- 'pnpm-lock.yaml'
13+
- 'packages/**'
814

915
jobs:
1016
test:
@@ -17,25 +23,6 @@ jobs:
1723
with:
1824
submodules: false
1925

20-
- name: "Checking changed files"
21-
id: filter
22-
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
23-
if: github.event_name == 'pull_request'
24-
with:
25-
filters: |
26-
packages:
27-
- 'packages/**/*'
28-
env:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
31-
- name: "Defining cache"
32-
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
33-
env:
34-
cache-name: cache-node-modules
35-
with:
36-
path: ~/.pnpm-store
37-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
38-
3926
- name: Setup pnpm
4027
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
4128
with:
@@ -48,14 +35,11 @@ jobs:
4835
cache: 'pnpm'
4936

5037
- name: "Installing dependencies"
51-
if: steps.filter.outputs.packages == 'true'
5238
run: pnpm install
5339

5440
- name: "Running unit tests"
55-
if: steps.filter.outputs.packages == 'true'
5641
run: pnpm -r test
5742

5843
- name: "Linting generator-widget"
5944
working-directory: ./packages/generator-widget
60-
if: steps.filter.outputs.packages == 'true'
6145
run: pnpm run lint

0 commit comments

Comments
 (0)