File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,12 +81,13 @@ jobs:
8181 cache-dependency-path : package-lock.json
8282
8383 - name : Cache node_modules
84+ id : cache-node-modules
8485 uses : actions/cache@v4
8586 with :
8687 path : node_modules
87- key : node- ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
88+ key : ${{ runner.os }}-node_modules -${{ hashFiles('**/package-lock.json') }}
8889 restore-keys : |
89- node- ${{ runner.os }}-
90+ ${{ runner.os }}-node_modules -
9091
9192 - name : Set up PHP
9293 uses : shivammathur/setup-php@v2
@@ -95,21 +96,21 @@ jobs:
9596 tools : composer
9697 coverage : none
9798
99+ - name : Cache Composer dependencies
100+ uses : actions/cache@v4
101+ with :
102+ path : vendor
103+ key : ${{ runner.os }}-composer-vendor-${{ hashFiles('**/composer.lock') }}
104+ restore-keys : |
105+ ${{ runner.os }}-composer-vendor-
106+
98107 - name : Install Composer dependencies
99108 run : |
100- if [ -f composer.json ]; then composer install --no-dev --prefer-dist --no-progress --no-interaction; else echo "No composer.json"; fi
109+ if [ -f composer.json ]; then composer install --no-dev --prefer-dist --prefer-offline -- no-progress --no-interaction; else echo "No composer.json"; fi
101110
102111 - name : Install npm dependencies
103- run : |
104- if [ -f package.json ]; then
105- if [ -d node_modules ]; then
106- echo "node_modules cache hit, skipping install"
107- else
108- npm ci --prefer-offline --no-audit
109- fi
110- else
111- echo "No package.json"
112- fi
112+ if : steps.cache-node-modules.outputs.cache-hit != 'true' && hashFiles('package.json') != ''
113+ run : npm ci --prefer-offline --no-audit
113114
114115 - name : Extract plugin version and commit hash
115116 id : version
Original file line number Diff line number Diff line change 6464 ${{ runner.os }}-docker-
6565
6666 - name : Install npm dependencies
67- run : |
68- # Skip postinstall scripts to avoid Cypress download issues in CI
69- npm config set ignore-scripts true
70- npm install
71- npm config set ignore-scripts false
67+ run : npm ci --ignore-scripts --prefer-offline --no-audit
7268
7369 - name : Install Composer dependencies
7470 run : |
Original file line number Diff line number Diff line change 11name : CS
22
33on :
4- # Run on all pushes (except to main) and on all pull requests.
4+ # Run on direct pushes to integration branches and on all pull requests.
55 push :
66 branches :
7- - ' *'
7+ - develop
8+ - main
9+ - master
10+ - trunk
811 pull_request :
9- branches :
10- - ' *'
1112 # Allow manually triggering the workflow.
1213 workflow_dispatch :
1314
Original file line number Diff line number Diff line change @@ -26,10 +26,18 @@ jobs:
2626 restore-keys : |
2727 ${{ runner.os }}-node-
2828
29+ - name : Cache node_modules
30+ id : cache-node-modules
31+ uses : actions/cache@v4
32+ with :
33+ path : node_modules
34+ key : ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
35+ restore-keys : |
36+ ${{ runner.os }}-node_modules-
37+
2938 - name : Install dependencies (skipping postinstall)
30- run : |
31- npm config set ignore-scripts true
32- npm install
39+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
40+ run : npm ci --prefer-offline --no-audit --ignore-scripts
3341
3442 - name : Run Jest tests
3543 run : npm run test:jest
Original file line number Diff line number Diff line change 11name : Lint JS
22
33on :
4- # Run on pushes to select branches and on all pull requests.
4+ # Run on direct pushes to integration branches and on all pull requests.
55 push :
66 branches :
7- - main
87 - develop
8+ - main
9+ - master
910 - trunk
10- - ' feature/**'
11- - ' release/**'
12- - ' hotfix/[0-9]+.[0-9]+*'
1311 pull_request :
1412 # Allow manually triggering the workflow.
1513 workflow_dispatch :
@@ -31,15 +29,17 @@ jobs:
3129 uses : actions/checkout@v3
3230
3331 - name : Cache Node.js modules
32+ id : cache-node-modules
3433 uses : actions/cache@v4
3534 with :
3635 path : node_modules
37- key : ${{ runner.os }}-node -${{ hashFiles('**/package-lock.json') }}
36+ key : ${{ runner.os }}-node_modules -${{ hashFiles('**/package-lock.json') }}
3837 restore-keys : |
39- ${{ runner.os }}-node -
38+ ${{ runner.os }}-node_modules -
4039 # The lint stage doesn't run the unit tests or use code style, so no need for PHPUnit, WPCS or phpcompatibility.
4140 - name : ' Install NPM packages'
42- run : npm install --ignore-scripts
41+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
42+ run : npm ci --prefer-offline --no-audit --ignore-scripts
4343
4444 - name : Get only files changed in this PR
4545 id : changed-files
Original file line number Diff line number Diff line change 11name : Lint PHP
22
33on :
4- # Run on pushes to select branches and on all pull requests.
4+ # Run on direct pushes to integration branches and on all pull requests.
55 push :
66 branches :
7- - master
87 - develop
8+ - main
9+ - master
910 - trunk
10- - ' feature/**'
11- - ' release/**'
12- - ' hotfix/[0-9]+.[0-9]+*'
1311 pull_request :
1412 # Allow manually triggering the workflow.
1513 workflow_dispatch :
Original file line number Diff line number Diff line change @@ -45,15 +45,17 @@ jobs:
4545 node-version : ' 20'
4646
4747 - name : Cache Node.js modules
48+ id : cache-node-modules
4849 uses : actions/cache@v4
4950 with :
50- path : ~/.npm
51- key : ${{ runner.os }}-node -${{ hashFiles('**/package-lock.json') }}
51+ path : node_modules
52+ key : ${{ runner.os }}-node_modules -${{ hashFiles('**/package-lock.json') }}
5253 restore-keys : |
53- ${{ runner.os }}-node -
54+ ${{ runner.os }}-node_modules -
5455
5556 - name : Install dependencies
56- run : npm install --ignore-scripts
57+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
58+ run : npm ci --prefer-offline --no-audit --ignore-scripts
5759
5860 - name : Build plugin (dotorg dist)
5961 run : npm run dist:dotorg
Original file line number Diff line number Diff line change 11name : Test
22
33on :
4- # Run on pushes to select branches and on all pull requests.
4+ # Run on direct pushes to integration branches and on all pull requests.
55 push :
6+ branches :
7+ - develop
8+ - main
9+ - master
10+ - trunk
611 pull_request :
712 # Allow manually triggering the workflow.
813 workflow_dispatch :
8792 github-token : ${{ secrets.GITHUB_TOKEN }}
8893 env :
8994 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
95+
96+ - name : Cache WordPress test library
97+ if : matrix.wp_version != 'latest'
98+ uses : actions/cache@v4
99+ with :
100+ path : |
101+ /tmp/wordpress-tests-lib
102+ /tmp/wordpress
103+ key : ${{ runner.os }}-wordpress-${{ matrix.wp_version }}-${{ github.run_id }}
104+ restore-keys : |
105+ ${{ runner.os }}-wordpress-${{ matrix.wp_version }}-
106+
90107 # Some images won't have svn available. Install it if that's the case.
91108 - name : Install SVN
92109 run : |
You can’t perform that action at this time.
0 commit comments