-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #810 from 10up/feature/efficient-actions
Update our GitHub Action Workflows
- Loading branch information
Showing
23 changed files
with
356 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
steps: | ||
- name: 'Checkout Repository' | ||
uses: actions/checkout@v4 | ||
|
||
- name: Dependency Review | ||
uses: actions/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: JS Linting | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- trunk | ||
paths: | ||
- '**.js' | ||
- '**.json' | ||
pull_request: | ||
branches: | ||
- develop | ||
paths: | ||
- '**.js' | ||
- '**.json' | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup node and npm cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: npm | ||
|
||
- name: Install Node dependencies | ||
run: npm ci --omit=optional | ||
|
||
- name: Get updated JS files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
files: | | ||
**/*.js | ||
**/*.json | ||
- name: Run JS linting | ||
run: | | ||
if [[ "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ]]; then | ||
npx wp-scripts lint-js ${{ steps.changed-files.outputs.all_changed_files }} | ||
elif [[ "${{ github.event_name }}" == "push" ]]; then | ||
npm run lint:js | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: PHP Compatibility | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- trunk | ||
paths: | ||
- "**.php" | ||
pull_request: | ||
branches: | ||
- develop | ||
paths: | ||
- "**.php" | ||
|
||
jobs: | ||
php-compatibility: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup proper PHP version | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist | ||
|
||
- name: Run PHP Compatibility | ||
run: ./vendor/bin/phpcs --standard=./phpcs-compat.xml.dist -p . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: PHP Linting | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- trunk | ||
paths: | ||
- "**.php" | ||
pull_request: | ||
branches: | ||
- develop | ||
paths: | ||
- "**.php" | ||
|
||
jobs: | ||
phpcs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup proper PHP version | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
files: | | ||
**/*.php | ||
- name: Install dependencies | ||
run: composer install --prefer-dist | ||
|
||
- name: Run PHP_CodeSniffer | ||
run: | | ||
HEAD_REF=$(git rev-parse HEAD) | ||
git checkout $HEAD_REF | ||
./vendor/bin/phpcs-changed -s --git --git-base origin/${{ github.base_ref }} ${{ steps.changed-files.outputs.all_changed_files }} | ||
vipcs: | ||
name: vipcs | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: VIPCS check | ||
uses: 10up/wpcs-action@stable | ||
with: | ||
enable_warnings: true | ||
standard: 'WordPress-VIP-Go' | ||
excludes: 'tests' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.