chore(deps): update actions/setup-node action to v4.0.1 #1302
Workflow file for this run
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
name: 'Build and Test' | |
on: | |
push: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') || github.event_name == 'workflow_dispatch' }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
disable-sudo: true | |
disable-file-monitoring: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
github.com:443 | |
nodejs.org:443 | |
registry.npmjs.org:443 | |
- name: Check out the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 | |
with: | |
node-version-file: package.json | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run all | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.wordpress.org:80 | |
api.wordpress.org:443 | |
wordpress.org:443 | |
develop.svn.wordpress.org:443 | |
plugins.svn.wordpress.org:443 | |
github.com:443 | |
- name: Check out the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up WordPress and WordPress Test Library | |
uses: ./ | |
with: | |
version: latest | |
dir: /tmp | |
- name: Verify | |
run: | | |
test -e /tmp/wordpress | |
test -e /tmp/wordpress-tests-lib | |
test -f /tmp/wordpress-tests-lib/wp-tests-config.php | |
integration: | |
name: Integration testing | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mariadb:latest | |
ports: | |
- '3306:3306' | |
env: | |
MYSQL_ROOT_PASSWORD: wordpress | |
MARIADB_INITDB_SKIP_TZINFO: 1 | |
MYSQL_USER: wordpress | |
MYSQL_PASSWORD: wordpress | |
MYSQL_DATABASE: wordpress_test | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
api.wordpress.org:80 | |
api.wordpress.org:443 | |
wordpress.org:443 | |
develop.svn.wordpress.org:443 | |
plugins.svn.wordpress.org:443 | |
github.com:443 | |
objects.githubusercontent.com:443 | |
packagist.org:443 | |
- name: Check out the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # 2.28.0 | |
with: | |
coverage: none | |
php-version: "8.0" | |
- name: Install PHP Dependencies | |
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # 2.2.0 | |
with: | |
working-directory: wptest | |
- name: Set up WordPress and WordPress Test Library | |
uses: ./ | |
with: | |
version: latest | |
- name: Verify MariaDB connection | |
run: | | |
while ! mysqladmin ping -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} --silent; do | |
sleep 1 | |
done | |
timeout-minutes: 1 | |
- name: Run tests | |
run: vendor/bin/phpunit | |
working-directory: wptest | |
check-dist: | |
name: Check dist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
disable-sudo: true | |
disable-file-monitoring: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
github.com:443 | |
nodejs.org:443 | |
registry.npmjs.org:443 | |
- name: Check out the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 | |
with: | |
node-version-file: package.json | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Rebuild the dist/ directory | |
run: npm run package | |
- name: Compare the expected and actual dist directories | |
run: | | |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff | |
exit 1 | |
fi | |
id: diff | |
- name: Upload the expected file | |
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 | |
if: ${{ failure() && steps.diff.conclusion == 'failure' }} | |
with: | |
name: dist | |
path: dist |