Skip to content
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

Tools: Try adding infrastructure for PHPUnit tests #299

Merged
merged 20 commits into from
Nov 4, 2022
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
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches: [ trunk, try/phpunit-tests ]
pull_request:
branches: [ trunk ]

workflow_dispatch:

jobs:
run-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

- name: Install NodeJS
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
with:
node-version-file: '.nvmrc'
cache: yarn

- name: Install dependencies & setup configs
run: |
yarn setup:tools

- name: Install dependencies
run: |
yarn
composer install
yarn build
yarn wp-env start

- name: Run PHP unit tests
run: |
yarn test:php
18 changes: 18 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"core": "WordPress/WordPress#master",
"mappings": {
"wp-content/mu-plugins": "./mu-plugins"
},
"env": {
"tests": {
"config": {
"WP_ENVIRONMENT_TYPE": false
},
"mappings": {
"vendor": "./vendor",
"phpunit": "./phpunit",
"phpunit.xml.dist": "./phpunit.xml.dist"
}
}
}
}
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
"url": "[email protected]:WordPress/wporg-repo-tools.git"
}
],
"require": {
"composer/installers": "~1.0"
},
"require-dev": {
"composer/installers": "~1.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcompatibility/phpcompatibility-wp": "*",
"phpunit/phpunit": "^9.5",
"wp-coding-standards/wpcs": "2.*",
"wporg/wporg-repo-tools": "dev-trunk"
"wp-phpunit/wp-phpunit": "~6.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure we don't need phpunit/phpunit or wp-phpunit/wp-phpunit since it's using the wp-env container & wp installation, but I've left it in from #204 in case it's necessary for running phpunit locally.

"wporg/wporg-repo-tools": "dev-trunk",
"yoast/phpunit-polyfills": "^1.0"
},
"config": {
"allow-plugins": {
Expand Down
Loading