From c1e06e5bb4552906ce6060a44186a09aa76adff0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 14:39:43 -0400 Subject: [PATCH 001/178] Experimenting with GitHub Actions. --- .github/workflows/test-wordpress.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/test-wordpress.yml diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml new file mode 100644 index 0000000000000..81ec3825c5161 --- /dev/null +++ b/.github/workflows/test-wordpress.yml @@ -0,0 +1,13 @@ +name: WordPress Core Test Suite + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + - run: npm install -g grunt-cli + - run: grunt-cli -v From 2f99e0b401544f019fe1c080c91d51ab0598288a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 14:43:30 -0400 Subject: [PATCH 002/178] Run `npm install` and `npm run grunt`. --- .github/workflows/test-wordpress.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 81ec3825c5161..5c5379b6f2d6e 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,9 +5,8 @@ on: [push] jobs: build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - - run: npm install -g grunt-cli - - run: grunt-cli -v + - run: npm install + - run: npm run grunt From 57e88b7239720dd07db2e985ccf95be179e149f9 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 14:49:18 -0400 Subject: [PATCH 003/178] Try v2 of `actions/setup-node`. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 5c5379b6f2d6e..2ca8685c3c548 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -7,6 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 - run: npm install - run: npm run grunt From 9f94b1a7111eb1f2cb252377d2699fa34b42f2d8 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 14:54:08 -0400 Subject: [PATCH 004/178] Remove `actions/setup-node` and use `nvm` to install correct version of NodeJS --- .github/workflows/test-wordpress.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 2ca8685c3c548..79ff4df44e81d 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -3,10 +3,16 @@ name: WordPress Core Test Suite on: [push] jobs: - build: + set-up: + name: Set up the environment runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - run: npm install - - run: npm run grunt + - name: Checkout repository + uses: actions/checkout@v2 + - name: Use the desired version of Node using nvm + shell: bash -l {0} + run: nvm install + - name: Install Dependencies + run: npm install + - name: Build WordPress + run: npm run build From 0362939c62977019b645692763e052ec9b251408 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:04:04 -0400 Subject: [PATCH 005/178] Start adding PHP specific test jobs. --- .github/workflows/test-wordpress.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 79ff4df44e81d..2c670f1e0d7ba 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -2,6 +2,9 @@ name: WordPress Core Test Suite on: [push] +env: + LOCAL_DIR: build + jobs: set-up: name: Set up the environment @@ -16,3 +19,21 @@ jobs: run: npm install - name: Build WordPress run: npm run build + test-php-8: + name: Test PHP 8 + needs: set-up + steps: + - env: + LOCAL_PHP: 8.0-fpm + - run: npm run env:start + - run: npm run env:install + + test-php-7-4: + name: Test PHP 7.4 + needs: set-up + steps: + - env: + LOCAL_PHP: 7.4-fpm + - run: npm run env:start + - run: npm run env:install + From bf8954d7b40d88f4fb8824ca275de7419126ed0d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:05:50 -0400 Subject: [PATCH 006/178] Fix expected syntax. --- .github/workflows/test-wordpress.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 2c670f1e0d7ba..ba40bdc0997c7 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -22,18 +22,17 @@ jobs: test-php-8: name: Test PHP 8 needs: set-up + env: + LOCAL_PHP: 8.0-fpm steps: - - env: - LOCAL_PHP: 8.0-fpm - run: npm run env:start - run: npm run env:install test-php-7-4: name: Test PHP 7.4 needs: set-up + env: + LOCAL_PHP: 7.4-fpm steps: - - env: - LOCAL_PHP: 7.4-fpm - run: npm run env:start - run: npm run env:install - From 7fc31db1022ee6acc5454bcc2ce9ceb09dd8cc31 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:11:03 -0400 Subject: [PATCH 007/178] Each job requires a `runs-on`. --- .github/workflows/test-wordpress.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index ba40bdc0997c7..9cea3bd5ab852 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -22,6 +22,7 @@ jobs: test-php-8: name: Test PHP 8 needs: set-up + runs-on: ubuntu-latest env: LOCAL_PHP: 8.0-fpm steps: @@ -31,6 +32,7 @@ jobs: test-php-7-4: name: Test PHP 7.4 needs: set-up + runs-on: ubuntu-latest env: LOCAL_PHP: 7.4-fpm steps: From c4222156127f1ed351de70a78ebae0cb8d86ee8f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:21:12 -0400 Subject: [PATCH 008/178] Results of jobs don't get shared. --- .github/workflows/test-wordpress.yml | 39 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 9cea3bd5ab852..28d41294b1515 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -6,9 +6,12 @@ env: LOCAL_DIR: build jobs: - set-up: - name: Set up the environment + test-php-8: + name: Test PHP 8 + needs: set-up runs-on: ubuntu-latest + env: + LOCAL_PHP: 8.0-fpm steps: - name: Checkout repository uses: actions/checkout@v2 @@ -19,15 +22,12 @@ jobs: run: npm install - name: Build WordPress run: npm run build - test-php-8: - name: Test PHP 8 - needs: set-up - runs-on: ubuntu-latest - env: - LOCAL_PHP: 8.0-fpm - steps: - - run: npm run env:start - - run: npm run env:install + - name: Start Docker environment + run: npm run env:start + - name: Install WordPress within the Docker environment + run: npm run env:install + - name: Run PHPUnit + run: npm run test:php test-php-7-4: name: Test PHP 7.4 @@ -36,5 +36,18 @@ jobs: env: LOCAL_PHP: 7.4-fpm steps: - - run: npm run env:start - - run: npm run env:install + - name: Checkout repository + uses: actions/checkout@v2 + - name: Use the desired version of Node using nvm + shell: bash -l {0} + run: nvm install + - name: Install Dependencies + run: npm install + - name: Build WordPress + run: npm run build + - name: Start Docker environment + run: npm run env:start + - name: Install WordPress within the Docker environment + run: npm run env:install + - name: Run PHPUnit + run: npm run test:php From 3669b9afb2509ef57c4b24ee4a6cf749d0625ee4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:21:58 -0400 Subject: [PATCH 009/178] Remove job dependencies. --- .github/workflows/test-wordpress.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 28d41294b1515..a9b3dc6af3e1c 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -8,7 +8,6 @@ env: jobs: test-php-8: name: Test PHP 8 - needs: set-up runs-on: ubuntu-latest env: LOCAL_PHP: 8.0-fpm @@ -31,7 +30,6 @@ jobs: test-php-7-4: name: Test PHP 7.4 - needs: set-up runs-on: ubuntu-latest env: LOCAL_PHP: 7.4-fpm From 5b1db04fadb337f6776fcb684e8086d0fab32190 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:37:03 -0400 Subject: [PATCH 010/178] Add a delay so the MySQL container finishes setting up. --- .github/workflows/test-wordpress.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index a9b3dc6af3e1c..7458a9f649a67 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -21,10 +21,11 @@ jobs: run: npm install - name: Build WordPress run: npm run build - - name: Start Docker environment - run: npm run env:start - - name: Install WordPress within the Docker environment - run: npm run env:install + - name: Setup Docker environment + run: | + npm run env:start + sleep 5 + npm run env:install - name: Run PHPUnit run: npm run test:php @@ -43,9 +44,10 @@ jobs: run: npm install - name: Build WordPress run: npm run build - - name: Start Docker environment - run: npm run env:start - - name: Install WordPress within the Docker environment - run: npm run env:install + - name: Setup Docker environment + run: | + npm run env:start + sleep 5 + npm run env:install - name: Run PHPUnit run: npm run test:php From fe9667f2daf2eddc585caa67cada385c5ee05b9f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:47:27 -0400 Subject: [PATCH 011/178] Re-arrange steps a bit. --- .github/workflows/test-wordpress.yml | 36 +++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 7458a9f649a67..6200877d5250f 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -18,16 +18,26 @@ jobs: shell: bash -l {0} run: nvm install - name: Install Dependencies - run: npm install + run: npm ci + - name: Start Docker environment + run: | + npm run env:start - name: Build WordPress run: npm run build - name: Setup Docker environment run: | - npm run env:start - sleep 5 + docker-compose run --rm mysql mysql --version + docker-compose run --rm php php --version + docker-compose run --rm php php -m npm run env:install - name: Run PHPUnit - run: npm run test:php + run: | + npm run test:php -- --verbose -c phpunit.xml.dist && + npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && + npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && + npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && test-php-7-4: name: Test PHP 7.4 @@ -41,13 +51,23 @@ jobs: shell: bash -l {0} run: nvm install - name: Install Dependencies - run: npm install + run: npm ci + - name: Start Docker environment + run: | + npm run env:start - name: Build WordPress run: npm run build - name: Setup Docker environment run: | - npm run env:start - sleep 5 + docker-compose run --rm mysql mysql --version + docker-compose run --rm php php --version + docker-compose run --rm php php -m npm run env:install - name: Run PHPUnit - run: npm run test:php + run: | + npm run test:php -- --verbose -c phpunit.xml.dist && + npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && + npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && + npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && From 8d0a8a32e2b7077cdfc0278ea089a7ad30c1316c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:54:00 -0400 Subject: [PATCH 012/178] Add a job for outputting test info --- .github/workflows/test-wordpress.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 6200877d5250f..025c5b3197fc7 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -18,7 +18,7 @@ jobs: shell: bash -l {0} run: nvm install - name: Install Dependencies - run: npm ci + run: npm ci --no-save - name: Start Docker environment run: | npm run env:start @@ -51,7 +51,7 @@ jobs: shell: bash -l {0} run: nvm install - name: Install Dependencies - run: npm ci + run: npm ci --no-save - name: Start Docker environment run: | npm run env:start @@ -71,3 +71,10 @@ jobs: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && + + test-logging: + name: Some test information + runs-on: ubuntu-latest + steps: + - run: | + docker-compose -v From 18841bbe4ee2b1fce612e1bf67f06b66d87d5aa4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:55:03 -0400 Subject: [PATCH 013/178] Update tests. --- .github/workflows/test-wordpress.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 025c5b3197fc7..a612a198d194d 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -76,5 +76,4 @@ jobs: name: Some test information runs-on: ubuntu-latest steps: - - run: | - docker-compose -v + - run: docker-compose -v From b36cfb19d9932c66035d367b3916d2777ce332f1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 29 Sep 2020 15:58:47 -0400 Subject: [PATCH 014/178] Try to fix permission issue within Docker container. --- .github/workflows/test-wordpress.yml | 36 ++++------------------------ 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index a612a198d194d..fe74c9177c8f3 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -6,38 +6,6 @@ env: LOCAL_DIR: build jobs: - test-php-8: - name: Test PHP 8 - runs-on: ubuntu-latest - env: - LOCAL_PHP: 8.0-fpm - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Use the desired version of Node using nvm - shell: bash -l {0} - run: nvm install - - name: Install Dependencies - run: npm ci --no-save - - name: Start Docker environment - run: | - npm run env:start - - name: Build WordPress - run: npm run build - - name: Setup Docker environment - run: | - docker-compose run --rm mysql mysql --version - docker-compose run --rm php php --version - docker-compose run --rm php php -m - npm run env:install - - name: Run PHPUnit - run: | - npm run test:php -- --verbose -c phpunit.xml.dist && - npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && - npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && - npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && test-php-7-4: name: Test PHP 7.4 @@ -54,6 +22,10 @@ jobs: run: npm ci --no-save - name: Start Docker environment run: | + sudo rm /usr/local/bin/docker-compose + curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose + chmod +x docker-compose + sudo mv docker-compose /usr/local/bin npm run env:start - name: Build WordPress run: npm run build From b7717366014d482a550a49f3bd17a1c5a0d5a6f6 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 09:23:23 -0400 Subject: [PATCH 015/178] More tests. --- .github/workflows/test-wordpress.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index fe74c9177c8f3..57b7e3e7c8b8f 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -18,8 +18,13 @@ jobs: - name: Use the desired version of Node using nvm shell: bash -l {0} run: nvm install + - name: Log debug information + run: | + npm --version + node --version + svn --version - name: Install Dependencies - run: npm ci --no-save + run: npm ci - name: Start Docker environment run: | sudo rm /usr/local/bin/docker-compose From 8f59348ee10bf5a5b917b41cacb8c56025cb2a4b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 09:38:27 -0400 Subject: [PATCH 016/178] Checkout the WordPress Importer. --- .github/workflows/test-wordpress.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 57b7e3e7c8b8f..c30fbd113d033 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -15,6 +15,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Checkout the WordPress Importer plugin + run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - name: Use the desired version of Node using nvm shell: bash -l {0} run: nvm install From 4111e829dcdae4c9ac9b406a2d3cd0978050563b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:00:33 -0400 Subject: [PATCH 017/178] Move some settings to `defaults`. --- .github/workflows/test-wordpress.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index c30fbd113d033..651e0f8e51ea8 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,11 +5,14 @@ on: [push] env: LOCAL_DIR: build -jobs: +defaults: + run: + shell: bash -l {0} + runs-on: ubuntu-latest +jobs: test-php-7-4: name: Test PHP 7.4 - runs-on: ubuntu-latest env: LOCAL_PHP: 7.4-fpm steps: @@ -18,7 +21,6 @@ jobs: - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - name: Use the desired version of Node using nvm - shell: bash -l {0} run: nvm install - name: Log debug information run: | @@ -53,6 +55,5 @@ jobs: test-logging: name: Some test information - runs-on: ubuntu-latest steps: - run: docker-compose -v From b1546fba99da85dc1621b00932f7f6dca59b9dba Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:02:12 -0400 Subject: [PATCH 018/178] Fix nesting. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 651e0f8e51ea8..8e8f05bd91a62 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -8,7 +8,7 @@ env: defaults: run: shell: bash -l {0} - runs-on: ubuntu-latest + runs-on: ubuntu-latest jobs: test-php-7-4: From a893decf69dce06c60889bc53c0e4c43e5552cb3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:03:12 -0400 Subject: [PATCH 019/178] Can't use `runs-on` within `defaults` --- .github/workflows/test-wordpress.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 8e8f05bd91a62..8f21059785d24 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -8,11 +8,11 @@ env: defaults: run: shell: bash -l {0} - runs-on: ubuntu-latest jobs: test-php-7-4: name: Test PHP 7.4 + runs-on: ubuntu-latest env: LOCAL_PHP: 7.4-fpm steps: @@ -55,5 +55,6 @@ jobs: test-logging: name: Some test information + runs-on: ubuntu-latest steps: - run: docker-compose -v From 9e04d5b1983adcaa2230b75de13e254b73787a06 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:11:14 -0400 Subject: [PATCH 020/178] Try using newer version of Docker Compose --- .github/workflows/test-wordpress.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 8f21059785d24..2da9d1116694e 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -18,32 +18,40 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer + - name: Use the desired version of Node using nvm run: nvm install + - name: Log debug information run: | npm --version node --version svn --version + - name: Install Dependencies run: npm ci + - name: Start Docker environment run: | sudo rm /usr/local/bin/docker-compose - curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose + curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > docker-compose chmod +x docker-compose sudo mv docker-compose /usr/local/bin npm run env:start + - name: Build WordPress run: npm run build + - name: Setup Docker environment run: | docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version docker-compose run --rm php php -m npm run env:install + - name: Run PHPUnit run: | npm run test:php -- --verbose -c phpunit.xml.dist && From ec3b8e611b2a7b15517807129785bed17677e9f3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:18:59 -0400 Subject: [PATCH 021/178] Use setup-node action instead --- .github/workflows/test-wordpress.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 2da9d1116694e..0856645badd58 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,10 +5,6 @@ on: [push] env: LOCAL_DIR: build -defaults: - run: - shell: bash -l {0} - jobs: test-php-7-4: name: Test PHP 7.4 @@ -22,8 +18,13 @@ jobs: - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - - name: Use the desired version of Node using nvm - run: nvm install + - name: install node v12 + uses: actions/setup-node@v1 + with: + node-version: 12 + +# - name: Use the desired version of Node using nvm +# run: nvm install - name: Log debug information run: | From c15cd2e2a000c8ed63ad0078d792e1b2ec65559c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:28:23 -0400 Subject: [PATCH 022/178] Store built WordPress as an artifact. --- .github/workflows/test-wordpress.yml | 35 +++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 0856645badd58..6f5b6d316d1f6 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -6,11 +6,9 @@ env: LOCAL_DIR: build jobs: - test-php-7-4: - name: Test PHP 7.4 + build-wordpress: runs-on: ubuntu-latest - env: - LOCAL_PHP: 7.4-fpm + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -23,18 +21,43 @@ jobs: with: node-version: 12 -# - name: Use the desired version of Node using nvm -# run: nvm install + # - name: Use the desired version of Node using nvm + # run: nvm install - name: Log debug information run: | npm --version node --version + curl --version + git --version svn --version + php --version + php -i + locale -a - name: Install Dependencies run: npm ci + - name: Archive build result + uses: actions/upload-artifact@v2 + with: + name: trunk + path: | + * + + test-php-7-4: + name: Test PHP 7.4 + runs-on: ubuntu-latest + needs: build-wordpress + env: + LOCAL_PHP: 7.4-fpm + + steps: + - name: Download built WordPress + uses: actions/download-artifact@v2 + with: + name: trunk + - name: Start Docker environment run: | sudo rm /usr/local/bin/docker-compose From 4842815a9cbad98d47f2009ee409fa1607dfffbb Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:31:04 -0400 Subject: [PATCH 023/178] Fix yml syntax. --- .github/workflows/test-wordpress.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 6f5b6d316d1f6..1095f7c98eb06 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -39,11 +39,11 @@ jobs: run: npm ci - name: Archive build result - uses: actions/upload-artifact@v2 - with: - name: trunk - path: | - * + uses: actions/upload-artifact@v2 + with: + name: trunk + path: | + * test-php-7-4: name: Test PHP 7.4 From f4fdc39727e6c6ec9b0e00a4d74d90e2e75a6342 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:43:26 -0400 Subject: [PATCH 024/178] Look at contents after checking out repo. --- .github/workflows/test-wordpress.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 1095f7c98eb06..a2cabc14d04e4 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -26,6 +26,7 @@ jobs: - name: Log debug information run: | + ls -l npm --version node --version curl --version @@ -38,6 +39,9 @@ jobs: - name: Install Dependencies run: npm ci + - name: Build WordPress + run: npm run build + - name: Archive build result uses: actions/upload-artifact@v2 with: @@ -66,9 +70,6 @@ jobs: sudo mv docker-compose /usr/local/bin npm run env:start - - name: Build WordPress - run: npm run build - - name: Setup Docker environment run: | docker-compose run --rm mysql mysql --version From 1c1c8f9dfe8067ff7cb78bc62bd69bb187e71bad Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 10:54:34 -0400 Subject: [PATCH 025/178] Don't include node_modules in artifacts. --- .github/workflows/test-wordpress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index a2cabc14d04e4..db46099985ac7 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -48,6 +48,7 @@ jobs: name: trunk path: | * + !node_modules test-php-7-4: name: Test PHP 7.4 From b965cbe921a3180faa06d74dd359e4b82b1e17a2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 11:07:09 -0400 Subject: [PATCH 026/178] Add additional job to test artifact usage. --- .github/workflows/test-wordpress.yml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index db46099985ac7..681ba59f90d6f 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -62,6 +62,47 @@ jobs: uses: actions/download-artifact@v2 with: name: trunk + - name: Install Dependencies + run: npm ci + + - name: Start Docker environment + run: | + sudo rm /usr/local/bin/docker-compose + curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > docker-compose + chmod +x docker-compose + sudo mv docker-compose /usr/local/bin + npm run env:start + + - name: Setup Docker environment + run: | + docker-compose run --rm mysql mysql --version + docker-compose run --rm php php --version + docker-compose run --rm php php -m + npm run env:install + + - name: Run PHPUnit + run: | + npm run test:php -- --verbose -c phpunit.xml.dist && + npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && + npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && + npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && + + test-php-7-3: + name: Test PHP 7.3 + runs-on: ubuntu-latest + needs: build-wordpress + env: + LOCAL_PHP: 7.3-fpm + + steps: + - name: Download built WordPress + uses: actions/download-artifact@v2 + with: + name: trunk + - name: Install Dependencies + run: npm ci - name: Start Docker environment run: | From f4f8fa9bc301b36141e0890b1a4348b843d92fe1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 11:16:37 -0400 Subject: [PATCH 027/178] Attempt to use caching for NPM --- .github/workflows/test-wordpress.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 681ba59f90d6f..d61149422e65f 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -6,6 +6,8 @@ env: LOCAL_DIR: build jobs: + + build-wordpress: runs-on: ubuntu-latest @@ -16,6 +18,19 @@ jobs: - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: install node v12 uses: actions/setup-node@v1 with: @@ -36,8 +51,15 @@ jobs: php -i locale -a - - name: Install Dependencies - run: npm ci + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Build WordPress run: npm run build From 70b04c9534bc8f9fca25b8adb1883e033101ad76 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 11:20:05 -0400 Subject: [PATCH 028/178] Fix syntax issues. --- .github/workflows/test-wordpress.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index d61149422e65f..6e75cc5a1a02e 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -23,7 +23,6 @@ jobs: env: cache-name: cache-node-modules with: - # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | @@ -51,16 +50,6 @@ jobs: php -i locale -a - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Build WordPress run: npm run build From a17e84b7e0f14921c2f299d395d0f56543a15c14 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 11:21:48 -0400 Subject: [PATCH 029/178] Missing install command. --- .github/workflows/test-wordpress.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 6e75cc5a1a02e..bd54ed35cb2a1 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -53,6 +53,9 @@ jobs: - name: Build WordPress run: npm run build + - name: Install dependencies + run: npm ci + - name: Archive build result uses: actions/upload-artifact@v2 with: From 9958b6c241976d64296de3989cefd0aa60989b28 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 11:23:09 -0400 Subject: [PATCH 030/178] Install first, duh. --- .github/workflows/test-wordpress.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index bd54ed35cb2a1..a514f8e451540 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -50,12 +50,11 @@ jobs: php -i locale -a - - name: Build WordPress - run: npm run build - - name: Install dependencies run: npm ci + - name: Build WordPress + run: npm run build - name: Archive build result uses: actions/upload-artifact@v2 with: From e6bda0f234f433db2a09a327d822e78a7b707fe1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 11:45:08 -0400 Subject: [PATCH 031/178] Attempt to use NPM cache and log `pwd`. --- .github/workflows/test-wordpress.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index a514f8e451540..0ef5c44ab074a 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -41,6 +41,7 @@ jobs: - name: Log debug information run: | ls -l + pwd npm --version node --version curl --version @@ -75,6 +76,16 @@ jobs: uses: actions/download-artifact@v2 with: name: trunk + + - name: Use NPM cache + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + - name: Install Dependencies run: npm ci From 251a54e4b1abd040c89c62d3cca11fcddd1d40ef Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 11:48:00 -0400 Subject: [PATCH 032/178] Try using a different directory for GitHub actions. --- tools/local-env/scripts/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 29e982797c009..021c422f8d4f6 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -6,7 +6,7 @@ const { renameSync, readFileSync, writeFileSync } = require( 'fs' ); dotenv.config(); // Create wp-config.php. -wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' ); +wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/home/runner/work/wordpress-develop/wordpress-develop --force' ); // Add the debug settings to wp-config.php. // Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step. From aaa17037c155f36c614f2c084ffca6418ba276cd Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 12:03:14 -0400 Subject: [PATCH 033/178] Strip some stuff out. --- .github/workflows/test-wordpress.yml | 105 ++------------------------- tools/local-env/scripts/install.js | 2 +- 2 files changed, 9 insertions(+), 98 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 0ef5c44ab074a..0e5a68126defe 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -6,11 +6,11 @@ env: LOCAL_DIR: build jobs: - - - build-wordpress: + test-php-7-4: + name: Test PHP 7.4 runs-on: ubuntu-latest - + env: + LOCAL_PHP: 7.4-fpm steps: - name: Checkout repository uses: actions/checkout@v2 @@ -18,30 +18,16 @@ jobs: - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - name: install node v12 uses: actions/setup-node@v1 with: node-version: 12 - # - name: Use the desired version of Node using nvm - # run: nvm install +# - name: Use the desired version of Node using nvm +# run: nvm install - name: Log debug information run: | - ls -l - pwd npm --version node --version curl --version @@ -51,90 +37,15 @@ jobs: php -i locale -a - - name: Install dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - name: Archive build result - uses: actions/upload-artifact@v2 - with: - name: trunk - path: | - * - !node_modules - - test-php-7-4: - name: Test PHP 7.4 - runs-on: ubuntu-latest - needs: build-wordpress - env: - LOCAL_PHP: 7.4-fpm - - steps: - - name: Download built WordPress - uses: actions/download-artifact@v2 - with: - name: trunk - - - name: Use NPM cache - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - - name: Install Dependencies run: npm ci - name: Start Docker environment run: | - sudo rm /usr/local/bin/docker-compose - curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > docker-compose - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin npm run env:start - - name: Setup Docker environment - run: | - docker-compose run --rm mysql mysql --version - docker-compose run --rm php php --version - docker-compose run --rm php php -m - npm run env:install - - - name: Run PHPUnit - run: | - npm run test:php -- --verbose -c phpunit.xml.dist && - npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && - npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && - npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && - - test-php-7-3: - name: Test PHP 7.3 - runs-on: ubuntu-latest - needs: build-wordpress - env: - LOCAL_PHP: 7.3-fpm - - steps: - - name: Download built WordPress - uses: actions/download-artifact@v2 - with: - name: trunk - - name: Install Dependencies - run: npm ci - - - name: Start Docker environment - run: | - sudo rm /usr/local/bin/docker-compose - curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > docker-compose - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin - npm run env:start + - name: Build WordPress + run: npm run build - name: Setup Docker environment run: | diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 021c422f8d4f6..29e982797c009 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -6,7 +6,7 @@ const { renameSync, readFileSync, writeFileSync } = require( 'fs' ); dotenv.config(); // Create wp-config.php. -wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/home/runner/work/wordpress-develop/wordpress-develop --force' ); +wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' ); // Add the debug settings to wp-config.php. // Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step. From 86b37fbba2e61d1ac6e008227875956eb6924f59 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 12:11:00 -0400 Subject: [PATCH 034/178] Add a `which npm`. --- .github/workflows/test-wordpress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 0e5a68126defe..ce684b6c9dfc6 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -29,6 +29,7 @@ jobs: - name: Log debug information run: | npm --version + which npm node --version curl --version git --version From 9abc79c694a749c33e9243703aac70326ffe110d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 12:34:23 -0400 Subject: [PATCH 035/178] Add more debug output. --- .github/workflows/test-wordpress.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index ce684b6c9dfc6..33a0d436ebbfa 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -50,9 +50,18 @@ jobs: - name: Setup Docker environment run: | + docker-compose -v + ls -l + ls src -l + ls build -l + + cd ../ + ls -l + docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version docker-compose run --rm php php -m + npm run env:install - name: Run PHPUnit From d9ae6dcbf85415ae31b1f3792c5fb35661c4a4d3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 12:36:24 -0400 Subject: [PATCH 036/178] Add more debug info --- .github/workflows/test-wordpress.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 33a0d436ebbfa..b628df003b1d5 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -55,6 +55,8 @@ jobs: ls src -l ls build -l + wp-env run cli wp eval "echo cwd();" + cd ../ ls -l From ff8258755bee920faddddbb9521a8abd8ccd848f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 12:38:57 -0400 Subject: [PATCH 037/178] Update PHP syntax. --- .github/workflows/test-wordpress.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index b628df003b1d5..e0c43fa8bc59d 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -55,10 +55,7 @@ jobs: ls src -l ls build -l - wp-env run cli wp eval "echo cwd();" - - cd ../ - ls -l + wp-env run cli wp eval "echo getcwd();" docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version From ed0927cb0bf1d28208d9c148fc315e1d98105bde Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 12:41:16 -0400 Subject: [PATCH 038/178] More debug info. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index e0c43fa8bc59d..a3b69dd7646f2 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -55,7 +55,7 @@ jobs: ls src -l ls build -l - wp-env run cli wp eval "echo getcwd();" + docker-compose run --rm php php eval "echo getcwd();" docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version From a9fa48fdb5cae2148192b75ab6481fe3b5b5ca85 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 30 Sep 2020 13:48:41 -0400 Subject: [PATCH 039/178] More debug info. --- .github/workflows/test-wordpress.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index a3b69dd7646f2..1ce2925e357c9 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -54,8 +54,7 @@ jobs: ls -l ls src -l ls build -l - - docker-compose run --rm php php eval "echo getcwd();" + docker-compose exec -T app ls -la docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version From 15b33c8151fd4bb052486a9e4751379699a67e90 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 09:59:13 -0400 Subject: [PATCH 040/178] Update with `trunk` and remove failing command. --- .github/workflows/test-wordpress.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 1ce2925e357c9..95b40aee65d31 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -54,7 +54,6 @@ jobs: ls -l ls src -l ls build -l - docker-compose exec -T app ls -la docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version @@ -70,9 +69,3 @@ jobs: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && - - test-logging: - name: Some test information - runs-on: ubuntu-latest - steps: - - run: docker-compose -v From 0f180e95405db87a4c3ff6868db71812be1f1976 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 10:12:52 -0400 Subject: [PATCH 041/178] Try removing specific PHP version environment variable. --- .github/workflows/test-wordpress.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 95b40aee65d31..98f91765b6b63 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -9,8 +9,6 @@ jobs: test-php-7-4: name: Test PHP 7.4 runs-on: ubuntu-latest - env: - LOCAL_PHP: 7.4-fpm steps: - name: Checkout repository uses: actions/checkout@v2 From cc72536ae3d27303b79dab56b90ec5aed41b96ae Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 10:19:25 -0400 Subject: [PATCH 042/178] See if the actions/checkout action causes permission issues. --- .github/workflows/test-wordpress.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 98f91765b6b63..ae821ce5a9e3f 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -11,7 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + run: | + - git checkout git@github.com:desrosj/wordpress-develop.git . - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer From a9c7eb1beb4ab17d1951bd260611b12172e289a3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 10:20:26 -0400 Subject: [PATCH 043/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index ae821ce5a9e3f..32574145a8941 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout repository run: | - - git checkout git@github.com:desrosj/wordpress-develop.git . + git checkout git@github.com:desrosj/wordpress-develop.git . - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer From 63d6deb144c5088c72433ddb93ceb5b33e51ec38 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 10:22:34 -0400 Subject: [PATCH 044/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 32574145a8941..3b1186c75ed5f 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout repository run: | - git checkout git@github.com:desrosj/wordpress-develop.git . + git clone https://github.com/desrosj/wordpress-develop.git . - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer From 9e418d1b3e7b5e067c9f2ae2f92a3ed889f93b5a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 13:14:11 -0400 Subject: [PATCH 045/178] Check the running Docker containers throughout. --- .github/workflows/test-wordpress.yml | 36 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 3b1186c75ed5f..9a2ba3a4220fd 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -4,6 +4,7 @@ on: [push] env: LOCAL_DIR: build + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true jobs: test-php-7-4: @@ -11,8 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - run: | - git clone https://github.com/desrosj/wordpress-develop.git . + uses: actions/checkout@v2 - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer @@ -22,11 +22,9 @@ jobs: with: node-version: 12 -# - name: Use the desired version of Node using nvm -# run: nvm install - - name: Log debug information run: | + docker ps -a npm --version which npm node --version @@ -42,7 +40,12 @@ jobs: - name: Start Docker environment run: | + docker ps -a npm run env:start + docker ps -a + + - name: Check running containers + run: docker ps -a - name: Build WordPress run: npm run build @@ -58,13 +61,18 @@ jobs: docker-compose run --rm php php --version docker-compose run --rm php php -m - npm run env:install + - name: Check running containers + run: docker ps -a - - name: Run PHPUnit - run: | - npm run test:php -- --verbose -c phpunit.xml.dist && - npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && - npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && - npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && + - name: Install WordPress + run: npm run env:install + + +# - name: Run PHPUnit +# run: | +# npm run test:php -- --verbose -c phpunit.xml.dist && +# npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && +# npm run test:php -- --verbose -c tests/phpunit/multisite.xml && +# npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && +# npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && +# npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && From e204fdf537d060c79bad1a67aa785a2d8de8b110 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 14:21:47 -0400 Subject: [PATCH 046/178] Check directory moving up a directory has different permissions. --- tools/local-env/scripts/install.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 29e982797c009..ad39647655a01 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -6,7 +6,7 @@ const { renameSync, readFileSync, writeFileSync } = require( 'fs' ); dotenv.config(); // Create wp-config.php. -wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' ); +wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www --force' ); // Add the debug settings to wp-config.php. // Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step. @@ -16,7 +16,7 @@ wp_cli( `config set WP_DEBUG_DISPLAY ${process.env.LOCAL_WP_DEBUG_DISPLAY} --raw wp_cli( `config set SCRIPT_DEBUG ${process.env.LOCAL_SCRIPT_DEBUG} --raw` ); // Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories. -renameSync( 'src/wp-config.php', 'wp-config.php' ); +// renameSync( 'src/wp-config.php', 'wp-config.php' ); // Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php. const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' ) From 6c2ed361528aab61c9c3a8ffeb09c44a4d169ac1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 14:27:48 -0400 Subject: [PATCH 047/178] Test matrixes, and revert last change. --- .github/workflows/test-wordpress.yml | 13 +++++++++++++ tools/local-env/scripts/install.js | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 9a2ba3a4220fd..ebb6948e0868b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -7,6 +7,19 @@ env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true jobs: + test-php: + name: Test PHP ${{ matrix.php_versions }} + strategy: + matrix: + php_versions: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6.20 ] + env: + LOCAL_PHP: ${{ matrix.php_versions }}-fpm + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Checkout the WordPress Importer plugin + run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer + test-php-7-4: name: Test PHP 7.4 runs-on: ubuntu-latest diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index ad39647655a01..29e982797c009 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -6,7 +6,7 @@ const { renameSync, readFileSync, writeFileSync } = require( 'fs' ); dotenv.config(); // Create wp-config.php. -wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www --force' ); +wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' ); // Add the debug settings to wp-config.php. // Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step. @@ -16,7 +16,7 @@ wp_cli( `config set WP_DEBUG_DISPLAY ${process.env.LOCAL_WP_DEBUG_DISPLAY} --raw wp_cli( `config set SCRIPT_DEBUG ${process.env.LOCAL_SCRIPT_DEBUG} --raw` ); // Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories. -// renameSync( 'src/wp-config.php', 'wp-config.php' ); +renameSync( 'src/wp-config.php', 'wp-config.php' ); // Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php. const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' ) From 546d618b875f37b3050c400de5c74bcee48d1510 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 14:31:41 -0400 Subject: [PATCH 048/178] Add missing runs on. --- .github/workflows/test-wordpress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index ebb6948e0868b..80c68264c9b24 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -9,6 +9,7 @@ env: jobs: test-php: name: Test PHP ${{ matrix.php_versions }} + runs-on: ubuntu-latest strategy: matrix: php_versions: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6.20 ] From 090bdb06ab1b30e1b5390e2b24e7d7cd3f024f76 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 14:42:49 -0400 Subject: [PATCH 049/178] Check permissions --- .github/workflows/test-wordpress.yml | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 80c68264c9b24..59d56df33b3f0 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -7,19 +7,19 @@ env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true jobs: - test-php: - name: Test PHP ${{ matrix.php_versions }} - runs-on: ubuntu-latest - strategy: - matrix: - php_versions: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6.20 ] - env: - LOCAL_PHP: ${{ matrix.php_versions }}-fpm - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Checkout the WordPress Importer plugin - run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer +# test-php: +# name: Test PHP ${{ matrix.php_versions }} +# runs-on: ubuntu-latest +# strategy: +# matrix: +# php_versions: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6.20 ] +# env: +# LOCAL_PHP: ${{ matrix.php_versions }}-fpm +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 +# - name: Checkout the WordPress Importer plugin +# run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer test-php-7-4: name: Test PHP 7.4 @@ -35,6 +35,9 @@ jobs: uses: actions/setup-node@v1 with: node-version: 12 + - name: Try changing permissions + run: | + chmod +x src -R - name: Log debug information run: | From 6523fb5c412e4160903205929e0c7c002272b416 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 14:47:38 -0400 Subject: [PATCH 050/178] Check permissions --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 59d56df33b3f0..59c672aa58fef 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -37,7 +37,7 @@ jobs: node-version: 12 - name: Try changing permissions run: | - chmod +x src -R + chmod +x . -R - name: Log debug information run: | From c3c751e29c41d597a7cf8f94d17274aba20a4adf Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 15:46:52 -0400 Subject: [PATCH 051/178] Try using `--allow-root`. --- .github/workflows/test-wordpress.yml | 6 ------ tools/local-env/scripts/install.js | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 59c672aa58fef..d7ff77777502b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -35,13 +35,9 @@ jobs: uses: actions/setup-node@v1 with: node-version: 12 - - name: Try changing permissions - run: | - chmod +x . -R - name: Log debug information run: | - docker ps -a npm --version which npm node --version @@ -57,9 +53,7 @@ jobs: - name: Start Docker environment run: | - docker ps -a npm run env:start - docker ps -a - name: Check running containers run: docker ps -a diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 29e982797c009..7841ff5959941 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -6,7 +6,7 @@ const { renameSync, readFileSync, writeFileSync } = require( 'fs' ); dotenv.config(); // Create wp-config.php. -wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' ); +wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force --allow-root' ); // Add the debug settings to wp-config.php. // Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step. From 55c8354bfe85103e0674fecc70d2945b6b27d35d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 15:54:22 -0400 Subject: [PATCH 052/178] Define some PHP env vars. --- .github/workflows/test-wordpress.yml | 4 ++++ tools/local-env/scripts/install.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index d7ff77777502b..16798aead525c 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,6 +5,9 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + PHP_FPM_UID: "`id -u`" + PHP_FPM_GID: "`id -g`" + jobs: # test-php: @@ -63,6 +66,7 @@ jobs: - name: Setup Docker environment run: | + chown docker-compose -v ls -l ls src -l diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 7841ff5959941..29e982797c009 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -6,7 +6,7 @@ const { renameSync, readFileSync, writeFileSync } = require( 'fs' ); dotenv.config(); // Create wp-config.php. -wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force --allow-root' ); +wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' ); // Add the debug settings to wp-config.php. // Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step. From 8f0e1127b14c6feeaf705e1346f82f88faa36289 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 16:00:20 -0400 Subject: [PATCH 053/178] Remove test command. --- .github/workflows/test-wordpress.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 16798aead525c..6228a9b8179e9 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -41,6 +41,8 @@ jobs: - name: Log debug information run: | + echo $PHP_FPM_UID + echo $PHP_FPM_GID npm --version which npm node --version @@ -66,7 +68,6 @@ jobs: - name: Setup Docker environment run: | - chown docker-compose -v ls -l ls src -l From a11a71b6af7b7ed84382826fa069090562324bec Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 16:01:53 -0400 Subject: [PATCH 054/178] Get the code to run. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 6228a9b8179e9..61f7a8d4ba34e 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,8 +5,8 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHP_FPM_UID: "`id -u`" - PHP_FPM_GID: "`id -g`" + PHP_FPM_UID: `id -u` + PHP_FPM_GID: `id -g` jobs: From 60ad74036e4c7322168235786a0116248d2855db Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 18:46:37 -0400 Subject: [PATCH 055/178] Need to set PHP_FPM_UID --- .github/workflows/test-wordpress.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 61f7a8d4ba34e..9254df507c67c 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,9 +5,7 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHP_FPM_UID: `id -u` - PHP_FPM_GID: `id -g` - + PHP_FPM_UID: runner jobs: # test-php: @@ -23,10 +21,19 @@ jobs: # uses: actions/checkout@v2 # - name: Checkout the WordPress Importer plugin # run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer + setup-environment: + name: Set environment variables + runs-on: ubuntu-latest + steps: + - name: Set environment variables + run: | + echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV + echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV test-php-7-4: name: Test PHP 7.4 runs-on: ubuntu-latest + needs: setup-environment steps: - name: Checkout repository uses: actions/checkout@v2 @@ -41,8 +48,6 @@ jobs: - name: Log debug information run: | - echo $PHP_FPM_UID - echo $PHP_FPM_GID npm --version which npm node --version From 18238185ba7fcc003ef956353557af39ef3fc4d8 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 18:48:11 -0400 Subject: [PATCH 056/178] Remove env var from global. --- .github/workflows/test-wordpress.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 9254df507c67c..67f07b853f94d 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,7 +5,6 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHP_FPM_UID: runner jobs: # test-php: From f9dafc5ec02d5140b123bbfa527d4de9be5c0e66 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 18:54:16 -0400 Subject: [PATCH 057/178] Try again --- .github/workflows/test-wordpress.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 67f07b853f94d..dd8ad59082285 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,6 +5,8 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + PHP_FPM_UID: runner + PHP_FPM_GID: docker jobs: # test-php: @@ -20,20 +22,12 @@ jobs: # uses: actions/checkout@v2 # - name: Checkout the WordPress Importer plugin # run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - setup-environment: - name: Set environment variables - runs-on: ubuntu-latest - steps: - - name: Set environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV - echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV test-php-7-4: name: Test PHP 7.4 runs-on: ubuntu-latest - needs: setup-environment steps: + - name: Checkout repository uses: actions/checkout@v2 From 0d1d0c83c54c4ecb3c86c24a13b6d15588ef6055 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 18:58:24 -0400 Subject: [PATCH 058/178] Flip --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index dd8ad59082285..ec325131e1005 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,8 +5,8 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHP_FPM_UID: runner - PHP_FPM_GID: docker + PHP_FPM_UID: docker + PHP_FPM_GID: runner jobs: # test-php: From c043e851f9c928e14b16436df9bae64616cf2292 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:13:39 -0400 Subject: [PATCH 059/178] This time? --- .github/workflows/test-wordpress.yml | 65 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index ec325131e1005..8076ee2ac8ea2 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,8 +5,6 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHP_FPM_UID: docker - PHP_FPM_GID: runner jobs: # test-php: @@ -50,36 +48,39 @@ jobs: php --version php -i locale -a - - - name: Install Dependencies - run: npm ci - - - name: Start Docker environment - run: | - npm run env:start - - - name: Check running containers - run: docker ps -a - - - name: Build WordPress - run: npm run build - - - name: Setup Docker environment - run: | - docker-compose -v - ls -l - ls src -l - ls build -l - - docker-compose run --rm mysql mysql --version - docker-compose run --rm php php --version - docker-compose run --rm php php -m - - - name: Check running containers - run: docker ps -a - - - name: Install WordPress - run: npm run env:install + id + id -g + id -u + +# - name: Install Dependencies +# run: npm ci +# +# - name: Start Docker environment +# run: | +# npm run env:start +# +# - name: Check running containers +# run: docker ps -a +# +# - name: Build WordPress +# run: npm run build +# +# - name: Setup Docker environment +# run: | +# docker-compose -v +# ls -l +# ls src -l +# ls build -l +# +# docker-compose run --rm mysql mysql --version +# docker-compose run --rm php php --version +# docker-compose run --rm php php -m +# +# - name: Check running containers +# run: docker ps -a +# +# - name: Install WordPress +# run: npm run env:install # - name: Run PHPUnit From 787840fb3d94a8758b9b3996f2c24dff7973819b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:15:03 -0400 Subject: [PATCH 060/178] Now? --- .github/workflows/test-wordpress.yml | 60 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 8076ee2ac8ea2..b7af7026aa82b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,6 +5,8 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + PHPFPM_UID: 1001 + PHP_FPM_GID: 116 jobs: # test-php: @@ -52,35 +54,35 @@ jobs: id -g id -u -# - name: Install Dependencies -# run: npm ci -# -# - name: Start Docker environment -# run: | -# npm run env:start -# -# - name: Check running containers -# run: docker ps -a -# -# - name: Build WordPress -# run: npm run build -# -# - name: Setup Docker environment -# run: | -# docker-compose -v -# ls -l -# ls src -l -# ls build -l -# -# docker-compose run --rm mysql mysql --version -# docker-compose run --rm php php --version -# docker-compose run --rm php php -m -# -# - name: Check running containers -# run: docker ps -a -# -# - name: Install WordPress -# run: npm run env:install + - name: Install Dependencies + run: npm ci + + - name: Start Docker environment + run: | + npm run env:start + + - name: Check running containers + run: docker ps -a + + - name: Build WordPress + run: npm run build + + - name: Setup Docker environment + run: | + docker-compose -v + ls -l + ls src -l + ls build -l + + docker-compose run --rm mysql mysql --version + docker-compose run --rm php php --version + docker-compose run --rm php php -m + + - name: Check running containers + run: docker ps -a + + - name: Install WordPress + run: npm run env:install # - name: Run PHPUnit From 2cd36d084855497c1da058f6feddb180aaeb80d0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:19:23 -0400 Subject: [PATCH 061/178] Reverse? --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index b7af7026aa82b..2461528ea0d22 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,8 +5,8 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHPFPM_UID: 1001 - PHP_FPM_GID: 116 + PHPFPM_UID: 116 + PHP_FPM_GID: 1001 jobs: # test-php: From 395326168f2af0c2d5a4013af63efbb39eeb796f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:23:20 -0400 Subject: [PATCH 062/178] Use the right var name. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 2461528ea0d22..0875538da33b0 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,8 +5,8 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHPFPM_UID: 116 - PHP_FPM_GID: 1001 + PHP_FPM_UID: 1001 + PHP_FPM_GID: 116 jobs: # test-php: From e6260b46d4b148df73f54e482ca0e4ad85671432 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:32:34 -0400 Subject: [PATCH 063/178] =?UTF-8?q?=F0=9F=99=8C=F0=9F=8F=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-wordpress.yml | 124 +++++++++++++++++++-------- 1 file changed, 86 insertions(+), 38 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 0875538da33b0..1ee8cd25d6861 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -5,40 +5,25 @@ on: [push] env: LOCAL_DIR: build PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - PHP_FPM_UID: 1001 - PHP_FPM_GID: 116 + PHP_FPM_UID: 1001 # This needs to be dynamic + PHP_FPM_GID: 116 # This needs to be dynamic jobs: -# test-php: -# name: Test PHP ${{ matrix.php_versions }} -# runs-on: ubuntu-latest -# strategy: -# matrix: -# php_versions: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6.20 ] -# env: -# LOCAL_PHP: ${{ matrix.php_versions }}-fpm -# steps: -# - name: Checkout repository -# uses: actions/checkout@v2 -# - name: Checkout the WordPress Importer plugin -# run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - - test-php-7-4: - name: Test PHP 7.4 + test-php: + name: Test PHP ${{ matrix.php_versions }} runs-on: ubuntu-latest + strategy: + matrix: + php_versions: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6.20 ] + env: + LOCAL_PHP: ${{ matrix.php_versions }}-fpm steps: - - name: Checkout repository uses: actions/checkout@v2 - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - - name: install node v12 - uses: actions/setup-node@v1 - with: - node-version: 12 - - name: Log debug information run: | npm --version @@ -50,9 +35,6 @@ jobs: php --version php -i locale -a - id - id -g - id -u - name: Install Dependencies run: npm ci @@ -61,29 +43,95 @@ jobs: run: | npm run env:start - - name: Check running containers + - name: Check running Docker containers run: docker ps -a - - name: Build WordPress - run: npm run build - - - name: Setup Docker environment + - name: Docker debug information run: | + docker -v docker-compose -v - ls -l - ls src -l - ls build -l - docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version docker-compose run --rm php php -m - - name: Check running containers - run: docker ps -a + - name: Build WordPress + run: npm run build - name: Install WordPress run: npm run env:install + - name: Run PHPUnit tests + run: | + npm run test:php -- --verbose -c phpunit.xml.dist && + npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml && + npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && + npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && + npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && + # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. + LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ +# +# test-php-7-4: +# name: Test PHP 7.4 +# runs-on: ubuntu-latest +# steps: +# +# - name: Checkout repository +# uses: actions/checkout@v2 +# +# - name: Checkout the WordPress Importer plugin +# run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer +# +# - name: install node v12 +# uses: actions/setup-node@v1 +# with: +# node-version: 12 +# +# - name: Log debug information +# run: | +# npm --version +# which npm +# node --version +# curl --version +# git --version +# svn --version +# php --version +# php -i +# locale -a +# id +# id -g +# id -u +# +# - name: Install Dependencies +# run: npm ci +# +# - name: Start Docker environment +# run: | +# npm run env:start +# +# - name: Check running containers +# run: docker ps -a +# +# - name: Build WordPress +# run: npm run build +# +# - name: Setup Docker environment +# run: | +# docker-compose -v +# ls -l +# ls src -l +# ls build -l +# +# docker-compose run --rm mysql mysql --version +# docker-compose run --rm php php --version +# docker-compose run --rm php php -m +# +# - name: Check running containers +# run: docker ps -a +# +# - name: Install WordPress +# run: npm run env:install + # - name: Run PHPUnit # run: | From 170a020b27845c3720d144e741d903ca4d09def2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:35:08 -0400 Subject: [PATCH 064/178] Prevent `.0` from being trimmed. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 1ee8cd25d6861..09c181c76449b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php_versions: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6.20 ] + php_versions: [ '8.0', 7.4, 7.3, 7.2, 7.1, '7.0', 5.6.20 ] env: LOCAL_PHP: ${{ matrix.php_versions }}-fpm steps: From 339accb9041e56ef8d105368a3aac88b9cfae800 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:50:30 -0400 Subject: [PATCH 065/178] PHP 8 needs to use the `test:php-composer` command. --- .github/workflows/test-wordpress.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 09c181c76449b..f356f01cf9337 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -60,7 +60,27 @@ jobs: - name: Install WordPress run: npm run env:install + # PHP 8.0 test runner. - name: Run PHPUnit tests + if: ${{ env.LOCAL_PHP = '8.0' }} + + # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, + # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. + run: | + npm run test:php-composer -- --verbose -c phpunit.xml.dist + npm run test:php-composer -- --verbose -c phpunit.xml.dist --group ajax + npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml + npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files + npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http + npm run test:php-composer -- --verbose -c phpunit.xml.dist --group restapi-jsclient + # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. + # Xdebug supports PHP 8 only from version 3.0, which is not released yet. + # Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again. + # - LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__ + + # PHP test runner for all other versions. + - name: Run PHPUnit tests + if: ${{ env.LOCAL_PHP != '8.0' }} run: | npm run test:php -- --verbose -c phpunit.xml.dist && npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && @@ -70,7 +90,7 @@ jobs: npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ -# + # test-php-7-4: # name: Test PHP 7.4 # runs-on: ubuntu-latest From 0010dbef89991a0bced00e5b9c2f0766672be5ba Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 19:51:09 -0400 Subject: [PATCH 066/178] Add missing `=`. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index f356f01cf9337..799174ec68f7d 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -62,7 +62,7 @@ jobs: # PHP 8.0 test runner. - name: Run PHPUnit tests - if: ${{ env.LOCAL_PHP = '8.0' }} + if: ${{ env.LOCAL_PHP == '8.0' }} # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. From 69a6142c7efa67cbf1c280f455f01af552768b45 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 20:01:49 -0400 Subject: [PATCH 067/178] Use the right LOCAL_PHP value. --- .github/workflows/test-wordpress.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 799174ec68f7d..435161b9afdef 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -61,8 +61,8 @@ jobs: run: npm run env:install # PHP 8.0 test runner. - - name: Run PHPUnit tests - if: ${{ env.LOCAL_PHP == '8.0' }} + - name: Run PHPUnit tests (8.0) + if: ${{ env.LOCAL_PHP == '8.0-fpm' }} # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. @@ -80,7 +80,7 @@ jobs: # PHP test runner for all other versions. - name: Run PHPUnit tests - if: ${{ env.LOCAL_PHP != '8.0' }} + if: ${{ env.LOCAL_PHP != '8.0-fpm' }} run: | npm run test:php -- --verbose -c phpunit.xml.dist && npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && From 33f2ea6370d9a193a540bc445fe5e7e7fd623174 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 20:10:07 -0400 Subject: [PATCH 068/178] Add composer install step. --- .github/workflows/test-wordpress.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 435161b9afdef..ec99c028c7a11 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -7,6 +7,7 @@ env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true PHP_FPM_UID: 1001 # This needs to be dynamic PHP_FPM_GID: 116 # This needs to be dynamic + COMPOSER_INSTALL: false jobs: test-php: @@ -36,6 +37,12 @@ jobs: php -i locale -a + - name: Install Composer dependencies + if: ${{ env.COMPOSER_INSTALL }} + run: | + docker-compose run --rm php composer --version + docker-compose run --rm php composer install + - name: Install Dependencies run: npm ci @@ -61,12 +68,14 @@ jobs: run: npm run env:install # PHP 8.0 test runner. - - name: Run PHPUnit tests (8.0) + - name: Run PHPUnit tests (PHP 8 only) if: ${{ env.LOCAL_PHP == '8.0-fpm' }} # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. run: | + docker-compose run --rm php composer --version + docker-compose run --rm php composer install --ignore-platform-reqs npm run test:php-composer -- --verbose -c phpunit.xml.dist npm run test:php-composer -- --verbose -c phpunit.xml.dist --group ajax npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml From 5d84647165c4a34f8aa9d96ff99081b97b81fadd Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 20:14:03 -0400 Subject: [PATCH 069/178] Check for true. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index ec99c028c7a11..5651d56b96b41 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -38,7 +38,7 @@ jobs: locale -a - name: Install Composer dependencies - if: ${{ env.COMPOSER_INSTALL }} + if: ${{ env.COMPOSER_INSTALL == true }} run: | docker-compose run --rm php composer --version docker-compose run --rm php composer install @@ -85,7 +85,7 @@ jobs: # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. # Xdebug supports PHP 8 only from version 3.0, which is not released yet. # Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again. - # - LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__ + # LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__ # PHP test runner for all other versions. - name: Run PHPUnit tests From b4fac11a611ff4dd4c420c937efe677514ede51a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 09:57:17 -0400 Subject: [PATCH 070/178] Add Windows testing --- .github/workflows/test-wordpress.yml | 89 +++++----------------------- 1 file changed, 16 insertions(+), 73 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 5651d56b96b41..521e11c34738b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -11,11 +11,12 @@ env: jobs: test-php: - name: Test PHP ${{ matrix.php_versions }} - runs-on: ubuntu-latest + name: Test PHP ${{ matrix.php_versions }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} strategy: matrix: php_versions: [ '8.0', 7.4, 7.3, 7.2, 7.1, '7.0', 5.6.20 ] + os: [ ubuntu-latest, windows-latest ] env: LOCAL_PHP: ${{ matrix.php_versions }}-fpm steps: @@ -25,6 +26,19 @@ jobs: - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Log debug information run: | npm --version @@ -99,74 +113,3 @@ jobs: npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ - -# test-php-7-4: -# name: Test PHP 7.4 -# runs-on: ubuntu-latest -# steps: -# -# - name: Checkout repository -# uses: actions/checkout@v2 -# -# - name: Checkout the WordPress Importer plugin -# run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer -# -# - name: install node v12 -# uses: actions/setup-node@v1 -# with: -# node-version: 12 -# -# - name: Log debug information -# run: | -# npm --version -# which npm -# node --version -# curl --version -# git --version -# svn --version -# php --version -# php -i -# locale -a -# id -# id -g -# id -u -# -# - name: Install Dependencies -# run: npm ci -# -# - name: Start Docker environment -# run: | -# npm run env:start -# -# - name: Check running containers -# run: docker ps -a -# -# - name: Build WordPress -# run: npm run build -# -# - name: Setup Docker environment -# run: | -# docker-compose -v -# ls -l -# ls src -l -# ls build -l -# -# docker-compose run --rm mysql mysql --version -# docker-compose run --rm php php --version -# docker-compose run --rm php php -m -# -# - name: Check running containers -# run: docker ps -a -# -# - name: Install WordPress -# run: npm run env:install - - -# - name: Run PHPUnit -# run: | -# npm run test:php -- --verbose -c phpunit.xml.dist && -# npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && -# npm run test:php -- --verbose -c tests/phpunit/multisite.xml && -# npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && -# npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && -# npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && From 1ce74e8415c5978c87c8b2696677bade457c961b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:20:36 -0400 Subject: [PATCH 071/178] Add caching of node_modules and artifact uploading. --- .github/workflows/test-wordpress.yml | 83 ++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 521e11c34738b..eec7eb5fc4f99 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -10,15 +10,12 @@ env: COMPOSER_INSTALL: false jobs: - test-php: - name: Test PHP ${{ matrix.php_versions }} (${{ matrix.os }}) + setup-wordpress: + name: Setup WordPress runs-on: ${{ matrix.os }} strategy: matrix: - php_versions: [ '8.0', 7.4, 7.3, 7.2, 7.1, '7.0', 5.6.20 ] os: [ ubuntu-latest, windows-latest ] - env: - LOCAL_PHP: ${{ matrix.php_versions }}-fpm steps: - name: Checkout repository uses: actions/checkout@v2 @@ -26,18 +23,67 @@ jobs: - name: Checkout the WordPress Importer plugin run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer - - name: Cache node modules + - name: Log debug information + run: | + npm --version + which npm + node --version + curl --version + git --version + svn --version + php --version + php -i + locale -a + + - name: Detect desired NPM version + run: nvmrc=$(cat .nvmrc) + + - name: Cache Node modules uses: actions/cache@v2 env: cache-name: cache-node-modules with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-$nvmrc-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + ${{ runner.os }}-$nvmrc- + ${{ runner.os }} + + - name: Install NPM + uses: setup-node@v1 + with: + node-version: $nvmrc + + - name: Install Dependencies + run: npm ci + + - name: Build WordPress + run: npm run build + + - name: Upload build artifact + uses: actions/upload-artifact@v2 + with: + name: built-wp-${{ github.sha }}-${{ matrix.os }} + path: | + . + !node_modules + + test-php: + name: Test PHP ${{ matrix.php_versions }} (${{ matrix.os }}) + needs: setup-wordpress + runs-on: ${{ matrix.os }} + strategy: + matrix: + php_versions: [ '8.0', 7.4, 7.3, 7.2, 7.1, '7.0', 5.6.20 ] + os: [ ubuntu-latest ] + env: + LOCAL_PHP: ${{ matrix.php_versions }}-fpm + + steps: + - uses: actions/download-artifact@v2 + with: + name: built-wp-${{ github.sha }}-${{ matrix.os }} - name: Log debug information run: | @@ -51,6 +97,23 @@ jobs: php -i locale -a + - name: Cache Node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-$nvmrc-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-$nvmrc- + ${{ runner.os }} + + - name: Install NPM + uses: setup-node@v1 + with: + node-version: $nvmrc + - name: Install Composer dependencies if: ${{ env.COMPOSER_INSTALL == true }} run: | From c27837288cd2d454639cac217baa5863d75038ba Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:21:53 -0400 Subject: [PATCH 072/178] Fix action syntax. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index eec7eb5fc4f99..66a2255b1c4a8 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -51,7 +51,7 @@ jobs: ${{ runner.os }} - name: Install NPM - uses: setup-node@v1 + uses: actions/setup-node@v1 with: node-version: $nvmrc @@ -110,7 +110,7 @@ jobs: ${{ runner.os }} - name: Install NPM - uses: setup-node@v1 + uses: actions/setup-node@v1 with: node-version: $nvmrc From 9af29387a3e614e6d9b5c3c7ab2474376f80a348 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:25:55 -0400 Subject: [PATCH 073/178] Fix nvmrc detection. --- .github/workflows/test-wordpress.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 66a2255b1c4a8..96c3c0eef67b0 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -36,7 +36,7 @@ jobs: locale -a - name: Detect desired NPM version - run: nvmrc=$(cat .nvmrc) + run: NVMRC=$(cat .nvmrc) - name: Cache Node modules uses: actions/cache@v2 @@ -45,15 +45,15 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-$nvmrc-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-${NVMRC}-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-$nvmrc- + ${{ runner.os }}-${NVMRC}- ${{ runner.os }} - name: Install NPM uses: actions/setup-node@v1 with: - node-version: $nvmrc + node-version: ${NVMRC} - name: Install Dependencies run: npm ci @@ -97,6 +97,9 @@ jobs: php -i locale -a + - name: Detect desired NPM version + run: NVMRC=$(cat .nvmrc) + - name: Cache Node modules uses: actions/cache@v2 env: @@ -104,15 +107,15 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-$nvmrc-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-${NVMRC}-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-$nvmrc- + ${{ runner.os }}-${NVMRC}- ${{ runner.os }} - name: Install NPM uses: actions/setup-node@v1 with: - node-version: $nvmrc + node-version: ${NVMRC} - name: Install Composer dependencies if: ${{ env.COMPOSER_INSTALL == true }} From feae723a395841c25d5f429d78cccac4d04dd6bd Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:30:43 -0400 Subject: [PATCH 074/178] Don't worry about nvmrc right now. --- .github/workflows/test-wordpress.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 96c3c0eef67b0..064d8b5db0b2e 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -35,9 +35,6 @@ jobs: php -i locale -a - - name: Detect desired NPM version - run: NVMRC=$(cat .nvmrc) - - name: Cache Node modules uses: actions/cache@v2 env: @@ -45,15 +42,14 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-${NVMRC}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-${NVMRC}- ${{ runner.os }} - name: Install NPM - uses: actions/setup-node@v1 + uses: setup-node@v1 with: - node-version: ${NVMRC} + node-version: 12 - name: Install Dependencies run: npm ci @@ -76,7 +72,7 @@ jobs: strategy: matrix: php_versions: [ '8.0', 7.4, 7.3, 7.2, 7.1, '7.0', 5.6.20 ] - os: [ ubuntu-latest ] + os: [ ubuntu-latest] env: LOCAL_PHP: ${{ matrix.php_versions }}-fpm @@ -97,9 +93,6 @@ jobs: php -i locale -a - - name: Detect desired NPM version - run: NVMRC=$(cat .nvmrc) - - name: Cache Node modules uses: actions/cache@v2 env: @@ -107,15 +100,14 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-${NVMRC}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-${NVMRC}- ${{ runner.os }} - name: Install NPM - uses: actions/setup-node@v1 + uses: setup-node@v1 with: - node-version: ${NVMRC} + node-version: 12 - name: Install Composer dependencies if: ${{ env.COMPOSER_INSTALL == true }} From 8da05d2beb1e775ad3c87f4d7c53284c77e14667 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:31:43 -0400 Subject: [PATCH 075/178] Use correct action name. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 064d8b5db0b2e..b2b3fdd6380dc 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -47,7 +47,7 @@ jobs: ${{ runner.os }} - name: Install NPM - uses: setup-node@v1 + uses: actions/setup-node@v1 with: node-version: 12 @@ -105,7 +105,7 @@ jobs: ${{ runner.os }} - name: Install NPM - uses: setup-node@v1 + uses: actions/setup-node@v1 with: node-version: 12 From e17168da364ac61e11a81d43ac64c27219c052bc Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:43:23 -0400 Subject: [PATCH 076/178] Try zipping the artifact for speed. --- .github/workflows/test-wordpress.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index b2b3fdd6380dc..084f02c23894f 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -57,13 +57,16 @@ jobs: - name: Build WordPress run: npm run build + - name: Create ZIP + users: montudor/action-zip@v0.1.0 + with: + args: zip -r built-wp-${{ github.sha }}-${{ matrix.os }}.zip . dir -x node_modules/**\* + - name: Upload build artifact uses: actions/upload-artifact@v2 with: name: built-wp-${{ github.sha }}-${{ matrix.os }} - path: | - . - !node_modules + path: built-wp-${{ github.sha }}-${{ matrix.os }}.zip test-php: name: Test PHP ${{ matrix.php_versions }} (${{ matrix.os }}) @@ -72,7 +75,7 @@ jobs: strategy: matrix: php_versions: [ '8.0', 7.4, 7.3, 7.2, 7.1, '7.0', 5.6.20 ] - os: [ ubuntu-latest] + os: [ ubuntu-latest ] env: LOCAL_PHP: ${{ matrix.php_versions }}-fpm @@ -81,6 +84,11 @@ jobs: with: name: built-wp-${{ github.sha }}-${{ matrix.os }} + - name: Unzip Artifact + users: montudor/action-zip@v0.1.0 + with: + args: unzip built-wp-${{ github.sha }}-${{ matrix.os }}.zip . + - name: Log debug information run: | npm --version From b04d40be1910d16e53703c717911707f6c53f1b1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:44:34 -0400 Subject: [PATCH 077/178] Fix typo. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 084f02c23894f..4110c8b7ce645 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -58,7 +58,7 @@ jobs: run: npm run build - name: Create ZIP - users: montudor/action-zip@v0.1.0 + uses: montudor/action-zip@v0.1.0 with: args: zip -r built-wp-${{ github.sha }}-${{ matrix.os }}.zip . dir -x node_modules/**\* @@ -85,7 +85,7 @@ jobs: name: built-wp-${{ github.sha }}-${{ matrix.os }} - name: Unzip Artifact - users: montudor/action-zip@v0.1.0 + uses: montudor/action-zip@v0.1.0 with: args: unzip built-wp-${{ github.sha }}-${{ matrix.os }}.zip . From d449e5381a508838a44edee817164498522ed1fe Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:46:06 -0400 Subject: [PATCH 078/178] Don't need to build WP in the test action. --- .github/workflows/test-wordpress.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 4110c8b7ce645..9f47052927005 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -141,9 +141,6 @@ jobs: docker-compose run --rm php php --version docker-compose run --rm php php -m - - name: Build WordPress - run: npm run build - - name: Install WordPress run: npm run env:install From 8434eeece87c7fcc5692239ae3d2c391ff38b08b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 10:52:12 -0400 Subject: [PATCH 079/178] ZIP is not available for Windows currently. --- .github/workflows/test-wordpress.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 9f47052927005..5e6736fe941d3 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -59,6 +59,7 @@ jobs: - name: Create ZIP uses: montudor/action-zip@v0.1.0 + if: ${{ matrix.os }} != 'windows-latest' with: args: zip -r built-wp-${{ github.sha }}-${{ matrix.os }}.zip . dir -x node_modules/**\* @@ -86,6 +87,7 @@ jobs: - name: Unzip Artifact uses: montudor/action-zip@v0.1.0 + if: ${{ matrix.os }} != 'windows-latest' with: args: unzip built-wp-${{ github.sha }}-${{ matrix.os }}.zip . From 48abada798c32802415dfd5a5fa672546ccfbddb Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 11:12:29 -0400 Subject: [PATCH 080/178] Refine zipping.unzipping. --- .github/workflows/test-wordpress.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 5e6736fe941d3..9f9782aa6f496 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -12,10 +12,7 @@ env: jobs: setup-wordpress: name: Setup WordPress - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, windows-latest ] + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 @@ -57,17 +54,17 @@ jobs: - name: Build WordPress run: npm run build - - name: Create ZIP - uses: montudor/action-zip@v0.1.0 - if: ${{ matrix.os }} != 'windows-latest' + - name: Create ZIP artifact + uses: thedoctor0/zip-release@0.4.1 with: - args: zip -r built-wp-${{ github.sha }}-${{ matrix.os }}.zip . dir -x node_modules/**\* + filename: built-wp-${{ github.sha }}.zip + exclusions: '/*node_modules/*' - name: Upload build artifact uses: actions/upload-artifact@v2 with: - name: built-wp-${{ github.sha }}-${{ matrix.os }} - path: built-wp-${{ github.sha }}-${{ matrix.os }}.zip + name: built-wp-${{ github.sha }} + path: built-wp-${{ github.sha }}.zip test-php: name: Test PHP ${{ matrix.php_versions }} (${{ matrix.os }}) @@ -83,13 +80,12 @@ jobs: steps: - uses: actions/download-artifact@v2 with: - name: built-wp-${{ github.sha }}-${{ matrix.os }} + name: built-wp-${{ github.sha }} - - name: Unzip Artifact - uses: montudor/action-zip@v0.1.0 - if: ${{ matrix.os }} != 'windows-latest' + - name: Unzip artifact + uses: TonyBogdanov/zip@1.0 with: - args: unzip built-wp-${{ github.sha }}-${{ matrix.os }}.zip . + args: unzip built-wp-${{ github.sha }}.zip - name: Log debug information run: | From e5c80f4ebe20f548f01c2c6834af63d83a89ab02 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 11:21:00 -0400 Subject: [PATCH 081/178] Log UID and GID --- .github/workflows/test-wordpress.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 9f9782aa6f496..6ce622eb16b4d 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -82,7 +82,7 @@ jobs: with: name: built-wp-${{ github.sha }} - - name: Unzip artifact + - name: Unzip built artifact uses: TonyBogdanov/zip@1.0 with: args: unzip built-wp-${{ github.sha }}.zip @@ -98,6 +98,8 @@ jobs: php --version php -i locale -a + id -u + id -g - name: Cache Node modules uses: actions/cache@v2 From d3bbd8a83c9ec005c675c3b08130b131a50c96a5 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 11:31:47 -0400 Subject: [PATCH 082/178] Some debug info. --- .github/workflows/test-wordpress.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 6ce622eb16b4d..855ad9cc5b213 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -22,6 +22,12 @@ jobs: - name: Log debug information run: | + id -u + id -g + ls -l + ls build -l + ls src -l + npm --version which npm node --version @@ -101,7 +107,7 @@ jobs: id -u id -g - - name: Cache Node modules + - name: Use cached Node modules uses: actions/cache@v2 env: cache-name: cache-node-modules @@ -130,7 +136,7 @@ jobs: run: | npm run env:start - - name: Check running Docker containers + - name: Log running Docker containers run: docker ps -a - name: Docker debug information @@ -140,6 +146,11 @@ jobs: docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version docker-compose run --rm php php -m + id -u + id -g + ls -l + ls build -l + ls src -l - name: Install WordPress run: npm run env:install From 24d587e8562221f725cfeae1e1420e669e428254 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 11:33:26 -0400 Subject: [PATCH 083/178] Build doesn't exist yet. --- .github/workflows/test-wordpress.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 855ad9cc5b213..b52be4c7fab71 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -25,7 +25,6 @@ jobs: id -u id -g ls -l - ls build -l ls src -l npm --version From d9df2bdbdb34064450ea73543aa4fed0c052341f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 11:42:43 -0400 Subject: [PATCH 084/178] Correct file ownership after unzipping the artifact. --- .github/workflows/test-wordpress.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index b52be4c7fab71..cd5fec5d58a88 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -92,6 +92,9 @@ jobs: with: args: unzip built-wp-${{ github.sha }}.zip + - name: Correct file permissions + run: chown -R ${{ env.PHP_FPM_IUD }}:${{ env.PHP_FPM_GUD }} . + - name: Log debug information run: | npm --version From ef4815fdab3d439fd37b2ca4c30d798f578aae14 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 11:49:48 -0400 Subject: [PATCH 085/178] Correct variable name. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index cd5fec5d58a88..eebf38b7c2c7e 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -93,7 +93,7 @@ jobs: args: unzip built-wp-${{ github.sha }}.zip - name: Correct file permissions - run: chown -R ${{ env.PHP_FPM_IUD }}:${{ env.PHP_FPM_GUD }} . + run: chown -R ${{ env.PHP_FPM_UID }}:${{ env.PHP_FPM_GID }} . - name: Log debug information run: | From 64c112b35b8246352171b1b32a4e92ee103e942e Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 11:58:47 -0400 Subject: [PATCH 086/178] Try a different unzipping. --- .github/workflows/test-wordpress.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index eebf38b7c2c7e..eb4f84ec520aa 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -88,13 +88,10 @@ jobs: name: built-wp-${{ github.sha }} - name: Unzip built artifact - uses: TonyBogdanov/zip@1.0 + uses: montudor/action-zip@v0.1.0 with: args: unzip built-wp-${{ github.sha }}.zip - - name: Correct file permissions - run: chown -R ${{ env.PHP_FPM_UID }}:${{ env.PHP_FPM_GID }} . - - name: Log debug information run: | npm --version From 97867f6b82099c87166205d0f22dd5f1d0436dc2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 12:07:01 -0400 Subject: [PATCH 087/178] Don't use an action to unzip. --- .github/workflows/test-wordpress.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index eb4f84ec520aa..5cb92074f0e58 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -88,9 +88,7 @@ jobs: name: built-wp-${{ github.sha }} - name: Unzip built artifact - uses: montudor/action-zip@v0.1.0 - with: - args: unzip built-wp-${{ github.sha }}.zip + run: unzip built-wp-${{ github.sha }}.zip - name: Log debug information run: | From 103b6eb3ff8d55c06025606fa810ec63c957ced1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 14:18:17 -0400 Subject: [PATCH 088/178] Add inline documentation for each job. Also, refine PHP unit test actions, and add a JavaScript test job. --- .github/workflows/test-wordpress.yml | 174 +++++++++++++++++---------- 1 file changed, 110 insertions(+), 64 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 5cb92074f0e58..723fa5295bfd3 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -8,8 +8,21 @@ env: PHP_FPM_UID: 1001 # This needs to be dynamic PHP_FPM_GID: 116 # This needs to be dynamic COMPOSER_INSTALL: false + PHPUNIT_LIBRARY: php jobs: + # Sets up WordPress for testing or development use. + # + # Performs the following steps: + # - Checks out the repository. + # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests). + # - Logs debug information about the runner container. + # - Sets up caching for the NPM packages for the package-lock.json file. + # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # _ Installs NPM dependencies. + # - Builds WordPress to run from the `build` directory. + # - Creates a ZIP file of compiled WordPress + # - Uploads it as an artifact. setup-wordpress: name: Setup WordPress runs-on: ubuntu-latest @@ -22,11 +35,6 @@ jobs: - name: Log debug information run: | - id -u - id -g - ls -l - ls src -l - npm --version which npm node --version @@ -56,9 +64,6 @@ jobs: - name: Install Dependencies run: npm ci - - name: Build WordPress - run: npm run build - - name: Create ZIP artifact uses: thedoctor0/zip-release@0.4.1 with: @@ -66,11 +71,27 @@ jobs: exclusions: '/*node_modules/*' - name: Upload build artifact - uses: actions/upload-artifact@v2 - with: - name: built-wp-${{ github.sha }} - path: built-wp-${{ github.sha }}.zip - + uses: actions/upload-artifact@v2 + with: + name: built-wp-${{ github.sha }} + path: built-wp-${{ github.sha }}.zip + if-no-files-found: error + + # Runs the PHPUnit tests for WordPress. + # + # Performs the following steps: + # - Downloads the built WordPress artifact from the previous job. + # - Unzips the artifact. + # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used + # if it was stored successfully). + # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # _ Installs Composer dependencies (if desired) + # _ Installs NPM dependencies. + # - Starts the WordPress Docker container. + # - Logs the running Docker containers. + # - Logs Docker debug information (both about Docker installed within the runner and WordPress container) + # - Install WordPress inside the WordPress Docker container. + # - Run the WordPress PHPUnit tests. test-php: name: Test PHP ${{ matrix.php_versions }} (${{ matrix.os }}) needs: setup-wordpress @@ -90,20 +111,6 @@ jobs: - name: Unzip built artifact run: unzip built-wp-${{ github.sha }}.zip - - name: Log debug information - run: | - npm --version - which npm - node --version - curl --version - git --version - svn --version - php --version - php -i - locale -a - id -u - id -g - - name: Use cached Node modules uses: actions/cache@v2 env: @@ -121,10 +128,17 @@ jobs: node-version: 12 - name: Install Composer dependencies - if: ${{ env.COMPOSER_INSTALL == true }} + if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} run: | docker-compose run --rm php composer --version - docker-compose run --rm php composer install + + # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, + # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. + if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then + docker-compose run --rm php composer install --ignore-platform-reqs + echo "PHPUNIT_LIBRARY=php-composer" >> $GITHUB_ENV + elif + docker-compose run --rm php composer install - name: Install Dependencies run: npm ci @@ -143,44 +157,76 @@ jobs: docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version docker-compose run --rm php php -m - id -u - id -g - ls -l - ls build -l - ls src -l - name: Install WordPress run: npm run env:install - # PHP 8.0 test runner. - - name: Run PHPUnit tests (PHP 8 only) - if: ${{ env.LOCAL_PHP == '8.0-fpm' }} - - # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, - # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. - run: | - docker-compose run --rm php composer --version - docker-compose run --rm php composer install --ignore-platform-reqs - npm run test:php-composer -- --verbose -c phpunit.xml.dist - npm run test:php-composer -- --verbose -c phpunit.xml.dist --group ajax - npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml - npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files - npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http - npm run test:php-composer -- --verbose -c phpunit.xml.dist --group restapi-jsclient - # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - # Xdebug supports PHP 8 only from version 3.0, which is not released yet. - # Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again. - # LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__ - - # PHP test runner for all other versions. - name: Run PHPUnit tests + run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist + + - name: Run AJAX tests + run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist --group ajax + + - name: Run tests as a multisite install + run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c tests/phpunit/multisite.xml + + - name: Run mutlisite file tests + run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files + + - name: Run external HTTP tests + run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist --group external-http + + - name: Run REST API tests + run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient + + # Xdebug supports PHP 8 only from version 3.0, which is not released yet. + # Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again. + # LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__ + - name: Run (xDebug) tests if: ${{ env.LOCAL_PHP != '8.0-fpm' }} - run: | - npm run test:php -- --verbose -c phpunit.xml.dist && - npm run test:php -- --verbose -c phpunit.xml.dist --group ajax && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml && - npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files && - npm run test:php -- --verbose -c phpunit.xml.dist --group external-http && - npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient && - # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ + run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ + + # Runs the PHPUnit tests for WordPress. + # + # Performs the following steps: + # - Downloads the built WordPress artifact from the previous job. + # - Unzips the artifact. + # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used + # if it was stored successfully). + # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # _ Installs NPM dependencies. + # - Run the WordPress QUnit tests. + test-js: + name: JavaScript Tests + needs: setup-wordpress + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v2 + with: + name: built-wp-${{ github.sha }} + + - name: Unzip built artifact + run: unzip built-wp-${{ github.sha }}.zip + + - name: Use cached Node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }} + + - name: Install NPM + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Dependencies + run: npm ci + + - name: Run QUnit tests + run: npm run grunt travis:js From 7ba0d124ab6537a95543ee6d18f4a8de72ccaaee Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 14:19:21 -0400 Subject: [PATCH 089/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 723fa5295bfd3..58d62c00bd5c1 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -71,11 +71,11 @@ jobs: exclusions: '/*node_modules/*' - name: Upload build artifact - uses: actions/upload-artifact@v2 - with: - name: built-wp-${{ github.sha }} - path: built-wp-${{ github.sha }}.zip - if-no-files-found: error + uses: actions/upload-artifact@v2 + with: + name: built-wp-${{ github.sha }} + path: built-wp-${{ github.sha }}.zip + if-no-files-found: error # Runs the PHPUnit tests for WordPress. # From c2e3ecadaa8f35bd55a4e37d7725b08a46e3e71b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 14:20:04 -0400 Subject: [PATCH 090/178] no message --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 58d62c00bd5c1..49aaa41759d62 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -132,8 +132,8 @@ jobs: run: | docker-compose run --rm php composer --version - # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, - # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. + # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, + # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then docker-compose run --rm php composer install --ignore-platform-reqs echo "PHPUNIT_LIBRARY=php-composer" >> $GITHUB_ENV From 52de448d71593a21ca0455144e2f0f09411d76ee Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 14:24:28 -0400 Subject: [PATCH 091/178] Close else if correctly --- .github/workflows/test-wordpress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 49aaa41759d62..71380037c0032 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -139,6 +139,7 @@ jobs: echo "PHPUNIT_LIBRARY=php-composer" >> $GITHUB_ENV elif docker-compose run --rm php composer install + fi - name: Install Dependencies run: npm ci From 9eebef26a25abf26ce3ecb3193ccf74335d7543f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 14:29:10 -0400 Subject: [PATCH 092/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 71380037c0032..e0f4ad19b5fdf 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -137,7 +137,7 @@ jobs: if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then docker-compose run --rm php composer install --ignore-platform-reqs echo "PHPUNIT_LIBRARY=php-composer" >> $GITHUB_ENV - elif + else docker-compose run --rm php composer install fi From 7a65b515840c7edf0a99671498d32b53561be894 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 14:36:20 -0400 Subject: [PATCH 093/178] Chromium is required for JS tests. --- .github/workflows/test-wordpress.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index e0f4ad19b5fdf..a6089cab2c283 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -64,6 +64,9 @@ jobs: - name: Install Dependencies run: npm ci + - name: Build WordPress + run: npm run build + - name: Create ZIP artifact uses: thedoctor0/zip-release@0.4.1 with: @@ -201,6 +204,8 @@ jobs: name: JavaScript Tests needs: setup-wordpress runs-on: ubuntu-latest + env: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: false steps: - uses: actions/download-artifact@v2 From 1018e13a220eea83d0ba44b3cc4b66d4b7cc0baa Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 14:50:22 -0400 Subject: [PATCH 094/178] Unset Puppeteer correctly. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index a6089cab2c283..bfb0954d12d0d 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -205,7 +205,7 @@ jobs: needs: setup-wordpress runs-on: ubuntu-latest env: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: false + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: steps: - uses: actions/download-artifact@v2 From 807149280974d826cb311530cf79fe25de6c20bc Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 15:13:45 -0400 Subject: [PATCH 095/178] Add a memcached test job. --- .github/workflows/test-wordpress.yml | 117 +++++++++++++++------------ 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index bfb0954d12d0d..f3ea82ee7ba11 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -7,8 +7,9 @@ env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true PHP_FPM_UID: 1001 # This needs to be dynamic PHP_FPM_GID: 116 # This needs to be dynamic - COMPOSER_INSTALL: false + COMPOSER_INSTALL: ${{ false }} PHPUNIT_LIBRARY: php + LOCAL_PHP_MEMCACHED: ${{ false }} jobs: # Sets up WordPress for testing or development use. @@ -22,7 +23,7 @@ jobs: # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. # - Creates a ZIP file of compiled WordPress - # - Uploads it as an artifact. + # - Uploads ZIP file as an artifact. setup-wordpress: name: Setup WordPress runs-on: ubuntu-latest @@ -80,6 +81,54 @@ jobs: path: built-wp-${{ github.sha }}.zip if-no-files-found: error + # Runs the QUnit tests for WordPress. + # + # Performs the following steps: + # - Downloads the built WordPress artifact from the previous job. + # - Unzips the artifact. + # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used + # if it was stored successfully). + # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # _ Installs NPM dependencies (only Chromium should need installing here). + # - Run the WordPress QUnit tests. + test-js: + name: JavaScript Tests + needs: setup-wordpress + runs-on: ubuntu-latest + env: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: + + steps: + - name: Download the WordPress build artifact + uses: actions/download-artifact@v2 + with: + name: built-wp-${{ github.sha }} + + - name: Unzip built artifact + run: unzip built-wp-${{ github.sha }}.zip + + - name: Use cached Node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }} + + - name: Install NPM + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Dependencies + run: npm ci + + - name: Run QUnit tests + run: npm run grunt travis:js + # Runs the PHPUnit tests for WordPress. # # Performs the following steps: @@ -101,19 +150,26 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - php_versions: [ '8.0', 7.4, 7.3, 7.2, 7.1, '7.0', 5.6.20 ] + php_versions: [ '8.0', 7.4, '7.4 with memcached', 7.3, 7.2, 7.1, '7.0', 5.6.20 ] os: [ ubuntu-latest ] env: LOCAL_PHP: ${{ matrix.php_versions }}-fpm steps: - - uses: actions/download-artifact@v2 + - name: Download the WordPress build artifact + uses: actions/download-artifact@v2 with: name: built-wp-${{ github.sha }} - name: Unzip built artifact run: unzip built-wp-${{ github.sha }}.zip + - name: Configure memcached + if: ${{ env.LOCAL_PHP }} == '7.4 with memcached' + run: | + echo "LOCAL_PHP=7.4" >> $GITHUB_ENV + echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV + - name: Use cached Node modules uses: actions/cache@v2 env: @@ -162,6 +218,13 @@ jobs: docker-compose run --rm php php --version docker-compose run --rm php php -m + # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. + - name: Start the Memcached server. + if: ${{ env.LOCAL_PHP_MEMCACHED }} + run: | + cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php + docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached + - name: Install WordPress run: npm run env:install @@ -190,49 +253,3 @@ jobs: if: ${{ env.LOCAL_PHP != '8.0-fpm' }} run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ - # Runs the PHPUnit tests for WordPress. - # - # Performs the following steps: - # - Downloads the built WordPress artifact from the previous job. - # - Unzips the artifact. - # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used - # if it was stored successfully). - # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) - # _ Installs NPM dependencies. - # - Run the WordPress QUnit tests. - test-js: - name: JavaScript Tests - needs: setup-wordpress - runs-on: ubuntu-latest - env: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: - - steps: - - uses: actions/download-artifact@v2 - with: - name: built-wp-${{ github.sha }} - - - name: Unzip built artifact - run: unzip built-wp-${{ github.sha }}.zip - - - name: Use cached Node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }} - - - name: Install NPM - uses: actions/setup-node@v1 - with: - node-version: 12 - - - name: Install Dependencies - run: npm ci - - - name: Run QUnit tests - run: npm run grunt travis:js From f6c377ccc2e7f9e72645e8c2f0c1db65946a149c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 15:21:25 -0400 Subject: [PATCH 096/178] Add PHP compatibility testing job. --- .github/workflows/test-wordpress.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index f3ea82ee7ba11..fcffe5e629e66 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -129,6 +129,34 @@ jobs: - name: Run QUnit tests run: npm run grunt travis:js + php-comatibility: + name: Test PHP compatibility + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log debug information + run: | + npm --version + which npm + node --version + curl --version + git --version + svn --version + php --version + php -i + locale -a + + - name: Install Composer dependencies + run: | + docker-compose run --rm php composer --version + docker-compose run --rm php composer install + + - name: Run PHP compatibility tests + run: docker-compose run --rm php composer compat + # Runs the PHPUnit tests for WordPress. # # Performs the following steps: From b74e2372f24894e67143be4352c13d0344fb77f9 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 15:23:43 -0400 Subject: [PATCH 097/178] Fix conditional expression checking for the memcached job. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index fcffe5e629e66..d4276e3415402 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -193,9 +193,9 @@ jobs: run: unzip built-wp-${{ github.sha }}.zip - name: Configure memcached - if: ${{ env.LOCAL_PHP }} == '7.4 with memcached' + if: ${{ env.LOCAL_PHP == '7.4 with memcached' }} run: | - echo "LOCAL_PHP=7.4" >> $GITHUB_ENV + echo "LOCAL_PHP=7.4-fpm" >> $GITHUB_ENV echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV - name: Use cached Node modules From 8a150539d09b58e5eaafb8cbc831c11d4f81802c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 15:28:53 -0400 Subject: [PATCH 098/178] Move PHP compatibility testing to it's own workflow. --- .../workflows/php-compatibility-testing.yml | 40 +++++++++++++++++++ .github/workflows/test-wordpress.yml | 28 ------------- 2 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/php-compatibility-testing.yml diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml new file mode 100644 index 0000000000000..ff841d79118dd --- /dev/null +++ b/.github/workflows/php-compatibility-testing.yml @@ -0,0 +1,40 @@ +name: PHP Compatibility Testing + +on: [push] + +jobs: + + # Runs PHP compatibility testing. + # + # Performs the following steps: + # - Checks out the repository. + # - Logs debug information about the runner container. + # - Installs Composer dependencies. + # - Runs the PHP compatibility tests. + php-comatibility: + name: Test PHP compatibility + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log debug information + run: | + npm --version + which npm + node --version + curl --version + git --version + svn --version + php --version + php -i + locale -a + + - name: Install Composer dependencies + run: | + docker-compose run --rm php composer --version + docker-compose run --rm php composer install + + - name: Run PHP compatibility tests + run: docker-compose run --rm php composer compat diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index d4276e3415402..4c42ca2a7db83 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -129,34 +129,6 @@ jobs: - name: Run QUnit tests run: npm run grunt travis:js - php-comatibility: - name: Test PHP compatibility - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Log debug information - run: | - npm --version - which npm - node --version - curl --version - git --version - svn --version - php --version - php -i - locale -a - - - name: Install Composer dependencies - run: | - docker-compose run --rm php composer --version - docker-compose run --rm php composer install - - - name: Run PHP compatibility tests - run: docker-compose run --rm php composer compat - # Runs the PHPUnit tests for WordPress. # # Performs the following steps: From be3dfd443e31bd05afa37113e86de71cafbc6c24 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 15:31:20 -0400 Subject: [PATCH 099/178] Fix conditional checking for memcached. --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 4c42ca2a7db83..c86df35a4bc8c 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -165,9 +165,9 @@ jobs: run: unzip built-wp-${{ github.sha }}.zip - name: Configure memcached - if: ${{ env.LOCAL_PHP == '7.4 with memcached' }} + if: ${{ contains( matrix.php_versions, 'memcached' ) }} run: | - echo "LOCAL_PHP=7.4-fpm" >> $GITHUB_ENV + echo "LOCAL_PHP=latest" >> $GITHUB_ENV echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV - name: Use cached Node modules From 483ea16b8ce9c5ce2e7f4c2c5a2716b42251bc5e Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 15:58:42 -0400 Subject: [PATCH 100/178] Only start the memcached server if it's wanted. --- .github/workflows/test-wordpress.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index c86df35a4bc8c..db10966269081 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -134,12 +134,14 @@ jobs: # Performs the following steps: # - Downloads the built WordPress artifact from the previous job. # - Unzips the artifact. + # - Sets up the environment variables needed for testing with memcached (if desired). # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used # if it was stored successfully). # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) # _ Installs Composer dependencies (if desired) # _ Installs NPM dependencies. # - Starts the WordPress Docker container. + # - Starts the memcached server after the Docker network has been created (if desired). # - Logs the running Docker containers. # - Logs Docker debug information (both about Docker installed within the runner and WordPress container) # - Install WordPress inside the WordPress Docker container. @@ -156,7 +158,7 @@ jobs: LOCAL_PHP: ${{ matrix.php_versions }}-fpm steps: - - name: Download the WordPress build artifact + - name: Download the built WordPress artifact uses: actions/download-artifact@v2 with: name: built-wp-${{ github.sha }} @@ -166,6 +168,7 @@ jobs: - name: Configure memcached if: ${{ contains( matrix.php_versions, 'memcached' ) }} + # TODO: Make LOCAL_PHP be the value of mattrix.php_versions with memcached replaced with '-fpm' run: | echo "LOCAL_PHP=latest" >> $GITHUB_ENV echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV @@ -207,6 +210,13 @@ jobs: run: | npm run env:start + # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. + - name: Start the Memcached server. + if: ${{ env.LOCAL_PHP_MEMCACHED == true }} + run: | + cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php + docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached + - name: Log running Docker containers run: docker ps -a @@ -218,13 +228,6 @@ jobs: docker-compose run --rm php php --version docker-compose run --rm php php -m - # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. - - name: Start the Memcached server. - if: ${{ env.LOCAL_PHP_MEMCACHED }} - run: | - cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php - docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached - - name: Install WordPress run: npm run env:install From 2d4214d04a4b370da9f1fcaee59658c6e1a3c5c6 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 16:07:00 -0400 Subject: [PATCH 101/178] Add an action for the test reporter. --- .github/workflows/test-wordpress.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index db10966269081..5c8bec7d88d13 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -256,3 +256,11 @@ jobs: if: ${{ env.LOCAL_PHP != '8.0-fpm' }} run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ + - name: WordPress Test Reporter + if: ${{ matrix.php_versions == '7.0' }} + uses: actions/checkout@v2 + with: + repository: 'https://github.com/WordPress/phpunit-test-runner.git test-runner' + path: 'test-runner' + # TODO: Configure hidden keys to successfully report test results. + # run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php From c8e07c525fd57fbd5b6192de01159fe6c6b9573a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 16:07:42 -0400 Subject: [PATCH 102/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 5c8bec7d88d13..ec5f2c08323fa 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -259,8 +259,8 @@ jobs: - name: WordPress Test Reporter if: ${{ matrix.php_versions == '7.0' }} uses: actions/checkout@v2 - with: - repository: 'https://github.com/WordPress/phpunit-test-runner.git test-runner' - path: 'test-runner' - # TODO: Configure hidden keys to successfully report test results. - # run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php + with: + repository: 'https://github.com/WordPress/phpunit-test-runner.git test-runner' + path: 'test-runner' + # TODO: Configure hidden keys to successfully report test results. + # run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php From f73ab26c1effe4cbfc5716c2007e38868b701602 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 16:21:20 -0400 Subject: [PATCH 103/178] Fix test runner repo checkout. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index ec5f2c08323fa..e74fcd088a81b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -260,7 +260,7 @@ jobs: if: ${{ matrix.php_versions == '7.0' }} uses: actions/checkout@v2 with: - repository: 'https://github.com/WordPress/phpunit-test-runner.git test-runner' + repository: 'WordPress/phpunit-test-runner' path: 'test-runner' # TODO: Configure hidden keys to successfully report test results. # run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php From 189958fc29ccce5639885ba2783f7f806c43ca17 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 16:21:35 -0400 Subject: [PATCH 104/178] Add caching to Composer. --- .../workflows/php-compatibility-testing.yml | 19 +++++++++++- .github/workflows/test-wordpress.yml | 31 ++++++++++++++----- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index ff841d79118dd..02b2477c79d71 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -9,7 +9,8 @@ jobs: # Performs the following steps: # - Checks out the repository. # - Logs debug information about the runner container. - # - Installs Composer dependencies. + # - Configures caching for Composer. + # - Installs Composer dependencies (from cache if possible). # - Runs the PHP compatibility tests. php-comatibility: name: Test PHP compatibility @@ -31,6 +32,22 @@ jobs: php -i locale -a + - name: Get composer cach directory + id: composer-cache + if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} + uses: actions/cache@v2 + env: + cache-name: cache-composer-dependencies + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Install Composer dependencies run: | docker-compose run --rm php composer --version diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index e74fcd088a81b..48370098b1cf6 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -53,9 +53,9 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }} + ${{ runner.os }}-npm- - name: Install NPM uses: actions/setup-node@v1 @@ -114,9 +114,9 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }} + ${{ runner.os }}-npm- - name: Install NPM uses: actions/setup-node@v1 @@ -138,8 +138,9 @@ jobs: # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used # if it was stored successfully). # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) - # _ Installs Composer dependencies (if desired) # _ Installs NPM dependencies. + # - Configures caching for Composer. + # _ Installs Composer dependencies (if desired) # - Starts the WordPress Docker container. # - Starts the memcached server after the Docker network has been created (if desired). # - Logs the running Docker containers. @@ -180,15 +181,31 @@ jobs: with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }} + ${{ runner.os }}-npm- - name: Install NPM uses: actions/setup-node@v1 with: node-version: 12 + - name: Get composer cache directory + id: composer-cache + if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} + uses: actions/cache@v2 + env: + cache-name: cache-composer-dependencies + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Install Composer dependencies if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} run: | From 99a63f963af64a4c16654a640e159e3d689eb4f2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 16:23:08 -0400 Subject: [PATCH 105/178] Always cache composer for PHP compatibility testing. --- .github/workflows/php-compatibility-testing.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 02b2477c79d71..9d32f0266e99d 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -34,11 +34,9 @@ jobs: - name: Get composer cach directory id: composer-cache - if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer dependencies - if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} uses: actions/cache@v2 env: cache-name: cache-composer-dependencies From e7ce903b3b60a1c6521e46eee02eaddc7e8f5f3e Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 20:29:35 -0400 Subject: [PATCH 106/178] Try using the PHPCS action --- .../workflows/php-compatibility-testing.yml | 40 +++---------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 9d32f0266e99d..a79691722c769 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -17,39 +17,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Checkout uses: actions/checkout@v2 - - - name: Log debug information - run: | - npm --version - which npm - node --version - curl --version - git --version - svn --version - php --version - php -i - locale -a - - - name: Get composer cach directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache Composer dependencies - uses: actions/cache@v2 - env: - cache-name: cache-composer-dependencies + - name: composer install + run: composer install + - name: PHPCS check + uses: chekalsky/phpcs-action@v1 with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Install Composer dependencies - run: | - docker-compose run --rm php composer --version - docker-compose run --rm php composer install - - - name: Run PHP compatibility tests - run: docker-compose run --rm php composer compat + phpcs_bin_path: './vendor/bin/phpcs' From f00d6158874a50439b1029f257c2c810822712f6 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 8 Oct 2020 20:43:37 -0400 Subject: [PATCH 107/178] Use old method. --- .../workflows/php-compatibility-testing.yml | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index a79691722c769..30527878c93b1 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -17,11 +17,31 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v2 - - name: composer install - run: composer install - - name: PHPCS check - uses: chekalsky/phpcs-action@v1 + + - name: Log debug information + run: | + php --version + + - name: Get composer cach directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + uses: actions/cache@v2 + env: + cache-name: cache-composer-dependencies with: - phpcs_bin_path: './vendor/bin/phpcs' + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: | + docker-compose run --rm php composer --version + docker-compose run --rm php composer install + + - name: Run PHP compatibility tests + run: docker-compose run --rm php composer compat From aaa6df5f51c177c8bc45fd92105d3ba9f2591161 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:13:26 -0400 Subject: [PATCH 108/178] Add a workflow for coding standards checks. --- .github/workflows/coding-standards.yml | 66 +++++++++++++++++++ .../workflows/php-compatibility-testing.yml | 4 +- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/coding-standards.yml diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000000000..f88f7c412e859 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,66 @@ +name: WordPress Core cvoding ctandards checks + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + phpcs: + name: WordPress Core PHP coding standards + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "latest" + coverage: none + + - name: Log debug information + run: | + php --version + + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Set up Composer caching + uses: actions/cache@v2 + env: + cache-name: cache-composer-dependencies + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install + + - name: Run PHPCS on WordPress Core files + uses: wearerequired/lint-action@v1 + with: + github_token: ${{ secrets.github_token } + php_codesniffer: true + # Ignore warnings + php_codesniffer_args: "-n" + + - name: Run PHPCS on WordPress Core + uses: wearerequired/lint-action@v1 + with: + github_token: ${{ secrets.github_token }} + php_codesniffer: true + + - name: Run PHPCS on WordPress Core tests + uses: wearerequired/lint-action@v1 + with: + github_token: ${{ secrets.github_token }} + php_codesniffer: true + php_codesniffer_dir: "tests" + diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 30527878c93b1..d6891adcde6b7 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -24,11 +24,11 @@ jobs: run: | php --version - - name: Get composer cach directory + - name: Get Composer cache directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache Composer dependencies + - name: Set up Composer caching uses: actions/cache@v2 env: cache-name: cache-composer-dependencies From 48ddf704f2e5448659bd64259070c2665c30858b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:16:34 -0400 Subject: [PATCH 109/178] Run coding standards checks on push for now. --- .github/workflows/coding-standards.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index f88f7c412e859..db2230b650409 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -1,12 +1,6 @@ -name: WordPress Core cvoding ctandards checks +name: WordPress Core coding standards checks -on: - push: - branches: - - master - pull_request: - branches: - - master +on: [push] jobs: phpcs: From e6a3c28b79e8be3a6e45842b24f6f3753c946c8a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:19:15 -0400 Subject: [PATCH 110/178] When a new commit is made, cancel previous jobs that are not completed. --- .github/workflows/test-wordpress.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 48370098b1cf6..15ab6d76bcea1 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -28,6 +28,11 @@ jobs: name: Setup WordPress runs-on: ubuntu-latest steps: + - name: Cancel previous runs of this workflow + uses: styfle/cancel-workflow-action@0.5.0 + with: + + access_token: ${{ github.token }} - name: Checkout repository uses: actions/checkout@v2 From 7a65511d44d09bee9ab5acbf6eb58930d75c7acc Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:19:59 -0400 Subject: [PATCH 111/178] Fix workflow error. --- .github/workflows/test-wordpress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 15ab6d76bcea1..e88bbb1910fb2 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -31,6 +31,7 @@ jobs: - name: Cancel previous runs of this workflow uses: styfle/cancel-workflow-action@0.5.0 with: + access_token: ${{ github.token }} access_token: ${{ github.token }} - name: Checkout repository From 7c9565f5743c4d9f171d92b5a51edf7dd67e4895 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:20:34 -0400 Subject: [PATCH 112/178] Another syntax error. --- .github/workflows/test-wordpress.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index e88bbb1910fb2..decc45f68cd93 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -33,7 +33,6 @@ jobs: with: access_token: ${{ github.token }} - access_token: ${{ github.token }} - name: Checkout repository uses: actions/checkout@v2 From a694d1a68ed4baf6cf2dfb17591cbdcc3720c7c8 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:23:26 -0400 Subject: [PATCH 113/178] Fix coding standards syntax error. --- .github/workflows/coding-standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index db2230b650409..c8706b58e8338 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -40,7 +40,7 @@ jobs: - name: Run PHPCS on WordPress Core files uses: wearerequired/lint-action@v1 with: - github_token: ${{ secrets.github_token } + github_token: ${{ secrets.github_token }} php_codesniffer: true # Ignore warnings php_codesniffer_args: "-n" From 6c2b878f2545d18c374abadced8a844068f1225c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:26:25 -0400 Subject: [PATCH 114/178] Allow all linters to complete if one returns an error. --- .github/workflows/coding-standards.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index c8706b58e8338..2457710b5a93d 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -38,6 +38,7 @@ jobs: run: composer install - name: Run PHPCS on WordPress Core files + continue-on-error: true # Allow all linting tasks to finish. uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} @@ -45,13 +46,8 @@ jobs: # Ignore warnings php_codesniffer_args: "-n" - - name: Run PHPCS on WordPress Core - uses: wearerequired/lint-action@v1 - with: - github_token: ${{ secrets.github_token }} - php_codesniffer: true - - name: Run PHPCS on WordPress Core tests + continue-on-error: true uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} From b9e9a5168442f56179d5c906eb09271b221d382f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:30:49 -0400 Subject: [PATCH 115/178] Try passing path to phpcs --- .github/workflows/coding-standards.yml | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 2457710b5a93d..bbf8778d3e692 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -1,25 +1,15 @@ -name: WordPress Core coding standards checks +name: WordPress coding standards checks on: [push] jobs: phpcs: - name: WordPress Core PHP coding standards + name: PHP coding standards runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "latest" - coverage: none - - - name: Log debug information - run: | - php --version - - name: Get Composer cache directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" @@ -34,6 +24,16 @@ jobs: restore-keys: | ${{ runner.os }}-composer- + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "latest" + coverage: none + + - name: Log debug information + run: | + php --version + - name: Install Composer dependencies run: composer install @@ -44,10 +44,10 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true # Ignore warnings - php_codesniffer_args: "-n" + php_codesniffer_args: "./vendor/squizlabs/php_codesniffer/bin/phpcs -n" - name: Run PHPCS on WordPress Core tests - continue-on-error: true + continue-on-error: true # Allow all linting tasks to finish. uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} From 7c80b4850990b414169c84bd5b25b2ec6d0c8636 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:33:25 -0400 Subject: [PATCH 116/178] Don't setup PHP --- .github/workflows/coding-standards.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index bbf8778d3e692..5bef8ab97b418 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -24,12 +24,12 @@ jobs: restore-keys: | ${{ runner.os }}-composer- - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "latest" - coverage: none - +# - name: Set up PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: "latest" +# coverage: none +# - name: Log debug information run: | php --version From be43648e0f478925dee609d1eebcd09d3f0c613d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:45:26 -0400 Subject: [PATCH 117/178] Add PHPCS --- .github/workflows/coding-standards.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 5bef8ab97b418..653ba21a364d5 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -24,12 +24,13 @@ jobs: restore-keys: | ${{ runner.os }}-composer- -# - name: Set up PHP -# uses: shivammathur/setup-php@v2 -# with: -# php-version: "latest" -# coverage: none -# + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "latest" + coverage: none + tools: phpcs + - name: Log debug information run: | php --version From c1af97ee3cc7a455996d6633b3665f67606f5e8c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:53:27 -0400 Subject: [PATCH 118/178] Debug composer. --- .github/workflows/coding-standards.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 653ba21a364d5..33243851a5bd5 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -29,11 +29,11 @@ jobs: with: php-version: "latest" coverage: none - tools: phpcs - name: Log debug information run: | php --version + composer diagnose - name: Install Composer dependencies run: composer install @@ -45,7 +45,7 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true # Ignore warnings - php_codesniffer_args: "./vendor/squizlabs/php_codesniffer/bin/phpcs -n" + php_codesniffer_args: "-n" - name: Run PHPCS on WordPress Core tests continue-on-error: true # Allow all linting tasks to finish. From 623ff4351d80dca18a277633a6623cbde630fc82 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:57:23 -0400 Subject: [PATCH 119/178] Devbug composer issue. --- .github/workflows/coding-standards.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 33243851a5bd5..bf01bbdb1e71d 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -23,13 +23,13 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-composer- - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "latest" - coverage: none - +# +# - name: Set up PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: "latest" +# coverage: none +# - name: Log debug information run: | php --version @@ -39,7 +39,6 @@ jobs: run: composer install - name: Run PHPCS on WordPress Core files - continue-on-error: true # Allow all linting tasks to finish. uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} @@ -48,7 +47,6 @@ jobs: php_codesniffer_args: "-n" - name: Run PHPCS on WordPress Core tests - continue-on-error: true # Allow all linting tasks to finish. uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} From db7197b5e7c56c6e22a7fd94c88fe0e2c5307325 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 10:59:55 -0400 Subject: [PATCH 120/178] Try disabling cache. --- .github/workflows/coding-standards.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index bf01bbdb1e71d..41eb4da6fce3c 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -14,15 +14,15 @@ jobs: id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Set up Composer caching - uses: actions/cache@v2 - env: - cache-name: cache-composer-dependencies - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- +# - name: Set up Composer caching +# uses: actions/cache@v2 +# env: +# cache-name: cache-composer-dependencies +# with: +# path: ${{ steps.composer-cache.outputs.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} +# restore-keys: | +# ${{ runner.os }}-composer- # # - name: Set up PHP # uses: shivammathur/setup-php@v2 From d65ce9b010621b3426ef5500eb10c877fccbf582 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:00:59 -0400 Subject: [PATCH 121/178] Remove composer diagnose. --- .github/workflows/coding-standards.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 41eb4da6fce3c..bc2f757171712 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -33,7 +33,6 @@ jobs: - name: Log debug information run: | php --version - composer diagnose - name: Install Composer dependencies run: composer install From d50d41e80e9ebc49dd74553bb43c9f53903dea28 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:02:21 -0400 Subject: [PATCH 122/178] Look for phpcs --- .github/workflows/coding-standards.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index bc2f757171712..3049eb3bf7775 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -35,7 +35,9 @@ jobs: php --version - name: Install Composer dependencies - run: composer install + run: | + composer install + phpcs -v - name: Run PHPCS on WordPress Core files uses: wearerequired/lint-action@v1 From 18d62be851840228bfa2636108cda9e2f880d9c5 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:21:13 -0400 Subject: [PATCH 123/178] Try global install --- .github/workflows/coding-standards.yml | 37 ++++++++++++-------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 3049eb3bf7775..60ff562faaa79 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -14,30 +14,28 @@ jobs: id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" -# - name: Set up Composer caching -# uses: actions/cache@v2 -# env: -# cache-name: cache-composer-dependencies -# with: -# path: ${{ steps.composer-cache.outputs.dir }} -# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} -# restore-keys: | -# ${{ runner.os }}-composer- -# -# - name: Set up PHP -# uses: shivammathur/setup-php@v2 -# with: -# php-version: "latest" -# coverage: none -# + - name: Set up Composer caching + uses: actions/cache@v2 + env: + cache-name: cache-composer-dependencies + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "latest" + coverage: none + - name: Log debug information run: | php --version - name: Install Composer dependencies - run: | - composer install - phpcs -v + run: composer global install - name: Run PHPCS on WordPress Core files uses: wearerequired/lint-action@v1 @@ -53,4 +51,3 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true php_codesniffer_dir: "tests" - From fb686edcc9ec62cd77069e9314cca60c4bc5acbf Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:28:23 -0400 Subject: [PATCH 124/178] Debug info --- .github/workflows/coding-standards.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 60ff562faaa79..89bf1293719e8 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -12,7 +12,9 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + $(composer config cache-files-dir) - name: Set up Composer caching uses: actions/cache@v2 From 099174a5a5a85578df43c1308006032d2fa6a65f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:35:55 -0400 Subject: [PATCH 125/178] no message --- .github/workflows/coding-standards.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 89bf1293719e8..1b38614036261 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -37,7 +37,14 @@ jobs: php --version - name: Install Composer dependencies - run: composer global install + run: composer install + + - name: Use project installed PHPCS globally + run: export PATH="$PATH:$HOME/vendor/bin" + + - name: Check versions (after) + run: | + phpcs --version - name: Run PHPCS on WordPress Core files uses: wearerequired/lint-action@v1 From f9a3f298315af3f53bd797becf35f35e49fe2fad Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:36:42 -0400 Subject: [PATCH 126/178] Remove debug --- .github/workflows/coding-standards.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 1b38614036261..aa29be1d5d5c5 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -12,9 +12,7 @@ jobs: - name: Get Composer cache directory id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - $(composer config cache-files-dir) + run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Set up Composer caching uses: actions/cache@v2 From 0c3b26a1b50421b5468f72218f73ce59200084bc Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:38:24 -0400 Subject: [PATCH 127/178] Specify shell --- .github/workflows/coding-standards.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index aa29be1d5d5c5..5103b5cae1f99 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -38,6 +38,7 @@ jobs: run: composer install - name: Use project installed PHPCS globally + shell: bash -l {0} run: export PATH="$PATH:$HOME/vendor/bin" - name: Check versions (after) From 96e8d060055033a83f359f83a9a7840ed6651e43 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:48:59 -0400 Subject: [PATCH 128/178] This should work! --- .github/workflows/coding-standards.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 5103b5cae1f99..db6afd0d332c6 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -33,17 +33,12 @@ jobs: - name: Log debug information run: | php --version + composer --version - name: Install Composer dependencies - run: composer install - - - name: Use project installed PHPCS globally - shell: bash -l {0} - run: export PATH="$PATH:$HOME/vendor/bin" - - - name: Check versions (after) run: | - phpcs --version + composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction + echo "::add-path::vendor/bin" - name: Run PHPCS on WordPress Core files uses: wearerequired/lint-action@v1 From d23cf340458b65ecc95095009bd79bb4ab5f3683 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:49:51 -0400 Subject: [PATCH 129/178] Use new syntax. --- .github/workflows/coding-standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index db6afd0d332c6..cb5d0d5b34c68 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -38,7 +38,7 @@ jobs: - name: Install Composer dependencies run: | composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction - echo "::add-path::vendor/bin" + echo "vendor/bin" >> $GITHUB_PATH - name: Run PHPCS on WordPress Core files uses: wearerequired/lint-action@v1 From 0576d6ee803e779477a36c5b3ac7a3536befe083 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 11:53:56 -0400 Subject: [PATCH 130/178] Add reporting to code standards checks. --- .github/workflows/coding-standards.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index cb5d0d5b34c68..1610a64572659 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -46,7 +46,7 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true # Ignore warnings - php_codesniffer_args: "-n" + php_codesniffer_args: "-n --report=summary,source" - name: Run PHPCS on WordPress Core tests uses: wearerequired/lint-action@v1 @@ -54,3 +54,4 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true php_codesniffer_dir: "tests" + php_codesniffer_args: "--report=summary,source" From 6c031ddfec786c44b85a0a79242ef415ee5f5eb9 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 12:01:33 -0400 Subject: [PATCH 131/178] Remove the `--report` flag. The action runs with `-q` to ensure valid JSON output. --- .github/workflows/coding-standards.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 1610a64572659..cb5d0d5b34c68 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -46,7 +46,7 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true # Ignore warnings - php_codesniffer_args: "-n --report=summary,source" + php_codesniffer_args: "-n" - name: Run PHPCS on WordPress Core tests uses: wearerequired/lint-action@v1 @@ -54,4 +54,3 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true php_codesniffer_dir: "tests" - php_codesniffer_args: "--report=summary,source" From d00cd737e1cc8e430449ab83a847a53cd04b1509 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 12:07:05 -0400 Subject: [PATCH 132/178] Update the compatibility testing workflow to have annotations and not require the docker container. --- .../workflows/php-compatibility-testing.yml | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index d6891adcde6b7..6ff1765468830 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -20,10 +20,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Log debug information - run: | - php --version - - name: Get Composer cache directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" @@ -38,10 +34,25 @@ jobs: restore-keys: | ${{ runner.os }}-composer- + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "latest" + coverage: none + + - name: Log debug information + run: | + php --version + composer --version + - name: Install Composer dependencies run: | - docker-compose run --rm php composer --version - docker-compose run --rm php composer install + composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction + echo "vendor/bin" >> $GITHUB_PATH - name: Run PHP compatibility tests - run: docker-compose run --rm php composer compat + uses: wearerequired/lint-action@v1 + with: + github_token: ${{ secrets.github_token }} + php_codesniffer: true + php_codesniffer_args: "--standard=phpcompat.xml.dist" From 746417fbd336787f79c6ae086e8deaa5bdf3bcf1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 12:09:12 -0400 Subject: [PATCH 133/178] Cause PHP compatibility and coding standards issues. --- src/wp-admin/includes/file.php | 1 - src/wp-includes/functions.php | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 0625bec9e257f..af1b177c31523 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -1262,7 +1262,6 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f ), array( 'php' => phpversion(), - // phpcs:ignore PHPCompatibility.Constants.NewConstants.sodium_library_versionFound 'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ), ) ); diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index fe68d7f760909..9ab78d3103383 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -34,12 +34,12 @@ function mysql2date( $format, $date, $translate = true ) { $datetime = date_create( $date, wp_timezone() ); - if ( false === $datetime ) { + if (false === $datetime) { return false; } // Returns a sum of timestamp with timezone offset. Ideally should never be used. - if ( 'G' === $format || 'U' === $format ) { + if ( 'G'===$format || 'U' === $format ) { return $datetime->getTimestamp() + $datetime->getOffset(); } @@ -166,9 +166,9 @@ function date_i18n( $format, $timestamp_with_offset = false, $gmt = false ) { $timestamp = $timestamp_with_offset; // If timestamp is omitted it should be current time (summed with offset, unless `$gmt` is true). - if ( ! is_numeric( $timestamp ) ) { + if ( ! is_numeric( $timestamp ) ) $timestamp = current_time( 'timestamp', $gmt ); - } + /* * This is a legacy implementation quirk that the returned timestamp is also with offset. From df7eb7c8afae26f8951610a9d2406f06f28a5505 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 12:15:04 -0400 Subject: [PATCH 134/178] Explicitly pass standard to the test command. --- .github/workflows/coding-standards.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index cb5d0d5b34c68..34e71405c1a55 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -40,7 +40,7 @@ jobs: composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction echo "vendor/bin" >> $GITHUB_PATH - - name: Run PHPCS on WordPress Core files + - name: Run PHPCS on Core files uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} @@ -48,9 +48,10 @@ jobs: # Ignore warnings php_codesniffer_args: "-n" - - name: Run PHPCS on WordPress Core tests + - name: Run PHPCS on Core tests uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} php_codesniffer: true php_codesniffer_dir: "tests" + php_codesniffer_args: "--standard=phpcs.xml.dist" From d9fe93b35d44ddb5c26bd6250a5c724ceb7b1956 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 12:25:52 -0400 Subject: [PATCH 135/178] Clean up and document. --- .github/workflows/coding-standards.yml | 21 +++++++++++-------- .../workflows/php-compatibility-testing.yml | 5 ++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 34e71405c1a55..7be071a1e7a92 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -1,8 +1,19 @@ -name: WordPress coding standards checks +name: Coding standards checks on: [push] jobs: + # Runs PHP coding standards checks. + # + # Violations are reported inline with annotations. + # + # Performs the following steps: + # - Checks out the repository. + # - Configures caching for Composer. + # - Sets up PHP. + # - Logs debug information. + # - Installs Composer dependencies (from cache if possible). + # - Runs PHPCS tests. phpcs: name: PHP coding standards runs-on: ubuntu-latest @@ -47,11 +58,3 @@ jobs: php_codesniffer: true # Ignore warnings php_codesniffer_args: "-n" - - - name: Run PHPCS on Core tests - uses: wearerequired/lint-action@v1 - with: - github_token: ${{ secrets.github_token }} - php_codesniffer: true - php_codesniffer_dir: "tests" - php_codesniffer_args: "--standard=phpcs.xml.dist" diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 6ff1765468830..22ff815280c80 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -6,10 +6,13 @@ jobs: # Runs PHP compatibility testing. # + # Violations are reported inline with annotations. + # # Performs the following steps: # - Checks out the repository. - # - Logs debug information about the runner container. # - Configures caching for Composer. + # - Sets up PHP. + # - Logs debug information about the runner container. # - Installs Composer dependencies (from cache if possible). # - Runs the PHP compatibility tests. php-comatibility: From c820818404526acdb4ab3b19098d1334063b50b2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 13:15:57 -0400 Subject: [PATCH 136/178] Add end to end test workflow. Clean up inline docs. --- .github/workflows/end-to-end-tests.yml | 94 ++++++++++++++++++++++++++ .github/workflows/test-wordpress.yml | 20 +++--- 2 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/end-to-end-tests.yml diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml new file mode 100644 index 0000000000000..c1ed4eefc5ddc --- /dev/null +++ b/.github/workflows/end-to-end-tests.yml @@ -0,0 +1,94 @@ +name: E2E Test Suite + +on: [push] + +env: + LOCAL_DIR: build + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} + PHP_FPM_UID: 1001 # This needs to be dynamic + PHP_FPM_GID: 116 # This needs to be dynamic + +jobs: + # Sets up WordPress for testing or development use. + # + # Performs the following steps: + # - Cancels all previous workflow runs that have not completed. + # - Checks out the repository. + # - Logs debug information about the runner container. + # - Sets up caching for NPM. + # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # _ Installs NPM dependencies. + # - Builds WordPress to run from the `build` directory. + # - Creates a ZIP file of compiled WordPress + # - Uploads ZIP file as an artifact. + # - Starts the WordPress Docker container. + # - Logs the running Docker containers. + # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container) + # - Install WordPress within the Docker container. + # - Run the E2E tests. + setup-wordpress: + name: Setup WordPress + runs-on: ubuntu-latest + steps: + - name: Cancel previous runs of this workflow + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log debug information + run: | + npm --version + which npm + node --version + curl --version + git --version + svn --version + php --version + php -i + locale -a + + - name: Cache Node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install NPM + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Dependencies + run: npm ci + + - name: Build WordPress + run: npm run build + + - name: Start Docker environment + run: | + npm run env:start + + - name: Log running Docker containers + run: docker ps -a + + - name: Docker debug information + run: | + docker -v + docker-compose -v + docker-compose run --rm mysql mysql --version + docker-compose run --rm php php --version + docker-compose run --rm php php -m + + - name: Install WordPress + run: npm run env:install + + - name: Run E2E tests + run: npm run test:e2e diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index decc45f68cd93..0a79688d0812b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -1,10 +1,10 @@ -name: WordPress Core Test Suite +name: Core Test Suite on: [push] env: LOCAL_DIR: build - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} PHP_FPM_UID: 1001 # This needs to be dynamic PHP_FPM_GID: 116 # This needs to be dynamic COMPOSER_INSTALL: ${{ false }} @@ -15,10 +15,11 @@ jobs: # Sets up WordPress for testing or development use. # # Performs the following steps: + # - Cancels all previous workflow runs that have not completed. # - Checks out the repository. # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests). # - Logs debug information about the runner container. - # - Sets up caching for the NPM packages for the package-lock.json file. + # - Sets up caching for NPM. # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. @@ -97,7 +98,7 @@ jobs: # _ Installs NPM dependencies (only Chromium should need installing here). # - Run the WordPress QUnit tests. test-js: - name: JavaScript Tests + name: JavaScript Tests (QUnit) needs: setup-wordpress runs-on: ubuntu-latest env: @@ -149,11 +150,11 @@ jobs: # - Starts the WordPress Docker container. # - Starts the memcached server after the Docker network has been created (if desired). # - Logs the running Docker containers. - # - Logs Docker debug information (both about Docker installed within the runner and WordPress container) - # - Install WordPress inside the WordPress Docker container. - # - Run the WordPress PHPUnit tests. + # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container) # - Install WordPress inside the WordPress Docker container. + # - Install WordPress within the Docker container. + # - Run the PHPUnit tests. test-php: - name: Test PHP ${{ matrix.php_versions }} (${{ matrix.os }}) + name: ${{ matrix.php_versions }} on ${{ matrix.os }} (PHPUnit) needs: setup-wordpress runs-on: ${{ matrix.os }} strategy: @@ -272,8 +273,7 @@ jobs: run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient # Xdebug supports PHP 8 only from version 3.0, which is not released yet. - # Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again. - # LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__ + # Once Xdebug 3.0 is released and included in the Docker image, the IF condition should be removed. - name: Run (xDebug) tests if: ${{ env.LOCAL_PHP != '8.0-fpm' }} run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ From 3278863765e0306af59589be9ae0f970bdae88c4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 13:53:54 -0400 Subject: [PATCH 137/178] Add PHPCompat error. --- .github/workflows/end-to-end-tests.yml | 2 +- .github/workflows/test-wordpress.yml | 2 +- src/wp-includes/functions.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index c1ed4eefc5ddc..e0fda27a59af8 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -26,7 +26,7 @@ jobs: # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container) # - Install WordPress within the Docker container. # - Run the E2E tests. - setup-wordpress: + e2e-tests: name: Setup WordPress runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 0a79688d0812b..109c891fc0c13 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -175,7 +175,7 @@ jobs: - name: Configure memcached if: ${{ contains( matrix.php_versions, 'memcached' ) }} - # TODO: Make LOCAL_PHP be the value of mattrix.php_versions with memcached replaced with '-fpm' + # TODO: Make LOCAL_PHP be the value of matrix.php_versions with memcached replaced with '-fpm' run: | echo "LOCAL_PHP=latest" >> $GITHUB_ENV echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 9ab78d3103383..4e88dd668517a 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -6673,7 +6673,7 @@ function mbstring_binary_safe_encoding( $reset = false ) { static $overloaded = null; if ( is_null( $overloaded ) ) { - $overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ); // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated + $overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ); } if ( false === $overloaded ) { From b972a309435a01a9f825680ba18ba231f392778b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 13:55:21 -0400 Subject: [PATCH 138/178] Test caching PHPCS runs. --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/php-compatibility-testing.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 7be071a1e7a92..0ef6d72ee3ec8 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -57,4 +57,4 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true # Ignore warnings - php_codesniffer_args: "-n" + php_codesniffer_args: "-n --cache" diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 22ff815280c80..69f861950bac9 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -58,4 +58,4 @@ jobs: with: github_token: ${{ secrets.github_token }} php_codesniffer: true - php_codesniffer_args: "--standard=phpcompat.xml.dist" + php_codesniffer_args: "--standard=phpcompat.xml.dist --cache" From 5df7374179ef5dd1e14b2f89ae89d82531676e45 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 13:59:25 -0400 Subject: [PATCH 139/178] Purge the cache. --- composer.lock | 74 +++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 50 deletions(-) diff --git a/composer.lock b/composer.lock index d189396da647a..793c9cd4247fb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "798cd84a945e4caa3d0161ff63ec3743", + "content-hash": "979b0a8c63a104744b5f2cce4920264b", "packages": [], "packages-dev": [ { @@ -175,12 +175,6 @@ "object", "object graph" ], - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], "time": "2020-06-29T13:22:24+00:00" }, { @@ -496,16 +490,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.0", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "3170448f5769fe19f456173d833734e0ff1b84df" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/3170448f5769fe19f456173d833734e0ff1b84df", - "reference": "3170448f5769fe19f456173d833734e0ff1b84df", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { @@ -544,20 +538,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-07-20T20:05:34+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { @@ -589,32 +583,32 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-27T10:12:23+00:00" + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "1.11.1", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8ce87516be71aae9b956f81906aaf0338e0d8a2d", + "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2", - "phpdocumentor/reflection-docblock": "^5.0", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^8.0 || ^9.0 <9.3" }, "type": "library", "extra": { @@ -652,7 +646,7 @@ "spy", "stub" ], - "time": "2020-07-08T12:44:21+00:00" + "time": "2020-09-29T09:10:42+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1558,16 +1552,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.5", + "version": "3.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", "shasum": "" }, "require": { @@ -1605,7 +1599,7 @@ "phpcs", "standards" ], - "time": "2020-04-17T01:09:41+00:00" + "time": "2020-08-10T04:50:15+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1667,20 +1661,6 @@ "polyfill", "portable" ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], "time": "2020-07-14T12:35:20+00:00" }, { @@ -1721,12 +1701,6 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], "time": "2020-07-12T23:59:07+00:00" }, { From a0f2f15dc34f80595b0537b82bc8acf12279eb4f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:00:04 -0400 Subject: [PATCH 140/178] Try adding a tests specific scan. --- .github/workflows/coding-standards.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 0ef6d72ee3ec8..0423c9a1d948a 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -49,7 +49,7 @@ jobs: - name: Install Composer dependencies run: | composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction - echo "vendor/bin" >> $GITHUB_PATH + echo "./vendor/bin" >> $GITHUB_PATH - name: Run PHPCS on Core files uses: wearerequired/lint-action@v1 @@ -58,3 +58,11 @@ jobs: php_codesniffer: true # Ignore warnings php_codesniffer_args: "-n --cache" + + - name: Run PHPCS on Core files + uses: wearerequired/lint-action@v1 + with: + github_token: ${{ secrets.github_token }} + php_codesniffer: true + php_codesniffer_dir: 'tests' + php_codesniffer_args: "--cache" From d87aacc1c5136f71dc7c7831d0e30f5b87cf5b29 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:03:41 -0400 Subject: [PATCH 141/178] Remove test. --- .github/workflows/coding-standards.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 0423c9a1d948a..0ef6d72ee3ec8 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -49,7 +49,7 @@ jobs: - name: Install Composer dependencies run: | composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction - echo "./vendor/bin" >> $GITHUB_PATH + echo "vendor/bin" >> $GITHUB_PATH - name: Run PHPCS on Core files uses: wearerequired/lint-action@v1 @@ -58,11 +58,3 @@ jobs: php_codesniffer: true # Ignore warnings php_codesniffer_args: "-n --cache" - - - name: Run PHPCS on Core files - uses: wearerequired/lint-action@v1 - with: - github_token: ${{ secrets.github_token }} - php_codesniffer: true - php_codesniffer_dir: 'tests' - php_codesniffer_args: "--cache" From e7d1cebddca36e2bd5affd27d0fc97c4cf790a64 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:09:12 -0400 Subject: [PATCH 142/178] Don't skip Puppeteer on E2E --- .github/workflows/end-to-end-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index e0fda27a59af8..92810707034a8 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -4,7 +4,6 @@ on: [push] env: LOCAL_DIR: build - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} PHP_FPM_UID: 1001 # This needs to be dynamic PHP_FPM_GID: 116 # This needs to be dynamic From c6ffc5d928987035df1f5250414c2532f61f1b7d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:17:00 -0400 Subject: [PATCH 143/178] Disable composer caching. --- .github/workflows/coding-standards.yml | 16 +--------------- .github/workflows/php-compatibility-testing.yml | 16 +--------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 0ef6d72ee3ec8..735fcbd39500e 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -21,20 +21,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Set up Composer caching - uses: actions/cache@v2 - env: - cache-name: cache-composer-dependencies - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - name: Set up PHP uses: shivammathur/setup-php@v2 with: @@ -57,4 +43,4 @@ jobs: github_token: ${{ secrets.github_token }} php_codesniffer: true # Ignore warnings - php_codesniffer_args: "-n --cache" + php_codesniffer_args: "-n" diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 69f861950bac9..9334f78edd875 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -23,20 +23,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Set up Composer caching - uses: actions/cache@v2 - env: - cache-name: cache-composer-dependencies - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - name: Set up PHP uses: shivammathur/setup-php@v2 with: @@ -58,4 +44,4 @@ jobs: with: github_token: ${{ secrets.github_token }} php_codesniffer: true - php_codesniffer_args: "--standard=phpcompat.xml.dist --cache" + php_codesniffer_args: "--standard=phpcompat.xml.dist" From 346edc9b2673073054b746ed2344bbee13f7f3b5 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:25:05 -0400 Subject: [PATCH 144/178] Why is php compat failing --- .github/workflows/coding-standards.yml | 14 +++ .../workflows/php-compatibility-testing.yml | 91 +++++++++++++++---- 2 files changed, 89 insertions(+), 16 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 735fcbd39500e..7be071a1e7a92 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -21,6 +21,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Set up Composer caching + uses: actions/cache@v2 + env: + cache-name: cache-composer-dependencies + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Set up PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 9334f78edd875..7a0b5e59dad65 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -23,25 +23,84 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Set up PHP - uses: shivammathur/setup-php@v2 + - name: Install Composer dependencies + if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} + run: | + docker-compose run --rm php composer --version + + # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, + # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. + if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then + docker-compose run --rm php composer install --ignore-platform-reqs + echo "PHPUNIT_LIBRARY=php-composer" >> $GITHUB_ENV + else + docker-compose run --rm php composer install + fi + + - name: Cache Node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules with: - php-version: "latest" - coverage: none + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install NPM + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Dependencies + run: npm ci + + - name: Build WordPress + run: npm run build - - name: Log debug information + - name: Start Docker environment run: | - php --version - composer --version + npm run env:start - - name: Install Composer dependencies + - name: Log running Docker containers + run: docker ps -a + + - name: Docker debug information run: | - composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction - echo "vendor/bin" >> $GITHUB_PATH + docker -v + docker-compose -v + docker-compose run --rm mysql mysql --version + docker-compose run --rm php php --version + docker-compose run --rm php php -m - - name: Run PHP compatibility tests - uses: wearerequired/lint-action@v1 - with: - github_token: ${{ secrets.github_token }} - php_codesniffer: true - php_codesniffer_args: "--standard=phpcompat.xml.dist" + - name: Install WordPress + run: npm run env:install + + - name: Compatibility testing + run: docker-compose run --rm php composer compat + + + +# - name: Set up PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: "latest" +# coverage: none +# +# - name: Log debug information +# run: | +# php --version +# composer --version +# +# - name: Install Composer dependencies +# run: | +# composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction +# echo "vendor/bin" >> $GITHUB_PATH +# +# - name: Run PHP compatibility tests +# uses: wearerequired/lint-action@v1 +# with: +# github_token: ${{ secrets.github_token }} +# php_codesniffer: true +# php_codesniffer_args: "--standard=phpcompat.xml.dist" From c172d5a0d1964923ab49bf1e6a5f8d98f0ca8101 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:31:58 -0400 Subject: [PATCH 145/178] Add environment variables. --- .github/workflows/php-compatibility-testing.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 7a0b5e59dad65..33fee8567ffe7 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -2,6 +2,12 @@ name: PHP Compatibility Testing on: [push] +env: + LOCAL_DIR: build + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} + PHP_FPM_UID: 1001 # This needs to be dynamic + PHP_FPM_GID: 116 # This needs to be dynamic + jobs: # Runs PHP compatibility testing. From 12aab9c88f8d1ae9a441071f7d8f8ed4095b0f54 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:42:23 -0400 Subject: [PATCH 146/178] Fix order of composer install --- .github/workflows/php-compatibility-testing.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 33fee8567ffe7..4b19f19fa953f 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -29,20 +29,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install Composer dependencies - if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} - run: | - docker-compose run --rm php composer --version - - # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, - # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. - if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then - docker-compose run --rm php composer install --ignore-platform-reqs - echo "PHPUNIT_LIBRARY=php-composer" >> $GITHUB_ENV - else - docker-compose run --rm php composer install - fi - - name: Cache Node modules uses: actions/cache@v2 env: @@ -69,6 +55,9 @@ jobs: run: | npm run env:start + - name: Install Composer dependencies + run: docker-compose run --rm php composer install + - name: Log running Docker containers run: docker ps -a From 703972a7cee3f06506977b11d9a4a66f685eb20c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:48:27 -0400 Subject: [PATCH 147/178] Back to using the action. --- .../workflows/php-compatibility-testing.yml | 88 +++++-------------- 1 file changed, 24 insertions(+), 64 deletions(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 4b19f19fa953f..22ff815280c80 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -2,12 +2,6 @@ name: PHP Compatibility Testing on: [push] -env: - LOCAL_DIR: build - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} - PHP_FPM_UID: 1001 # This needs to be dynamic - PHP_FPM_GID: 116 # This needs to be dynamic - jobs: # Runs PHP compatibility testing. @@ -29,73 +23,39 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Cache Node modules + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Set up Composer caching uses: actions/cache@v2 env: - cache-name: cache-node-modules + cache-name: cache-composer-dependencies with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-npm- + ${{ runner.os }}-composer- - - name: Install NPM - uses: actions/setup-node@v1 + - name: Set up PHP + uses: shivammathur/setup-php@v2 with: - node-version: 12 - - - name: Install Dependencies - run: npm ci + php-version: "latest" + coverage: none - - name: Build WordPress - run: npm run build - - - name: Start Docker environment + - name: Log debug information run: | - npm run env:start + php --version + composer --version - name: Install Composer dependencies - run: docker-compose run --rm php composer install - - - name: Log running Docker containers - run: docker ps -a - - - name: Docker debug information run: | - docker -v - docker-compose -v - docker-compose run --rm mysql mysql --version - docker-compose run --rm php php --version - docker-compose run --rm php php -m + composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction + echo "vendor/bin" >> $GITHUB_PATH - - name: Install WordPress - run: npm run env:install - - - name: Compatibility testing - run: docker-compose run --rm php composer compat - - - -# - name: Set up PHP -# uses: shivammathur/setup-php@v2 -# with: -# php-version: "latest" -# coverage: none -# -# - name: Log debug information -# run: | -# php --version -# composer --version -# -# - name: Install Composer dependencies -# run: | -# composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction -# echo "vendor/bin" >> $GITHUB_PATH -# -# - name: Run PHP compatibility tests -# uses: wearerequired/lint-action@v1 -# with: -# github_token: ${{ secrets.github_token }} -# php_codesniffer: true -# php_codesniffer_args: "--standard=phpcompat.xml.dist" + - name: Run PHP compatibility tests + uses: wearerequired/lint-action@v1 + with: + github_token: ${{ secrets.github_token }} + php_codesniffer: true + php_codesniffer_args: "--standard=phpcompat.xml.dist" From 9a0b75ef61a5175466cb559e1b2073f533a5df04 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 14:55:36 -0400 Subject: [PATCH 148/178] Try different path to PHPCS config. --- .github/workflows/php-compatibility-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 22ff815280c80..c92fa3b95d804 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -58,4 +58,4 @@ jobs: with: github_token: ${{ secrets.github_token }} php_codesniffer: true - php_codesniffer_args: "--standard=phpcompat.xml.dist" + php_codesniffer_args: "--standard=./phpcompat.xml.dist" From e7f6109d8d7f654b03582d10242120c1564141db Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 9 Oct 2020 15:05:43 -0400 Subject: [PATCH 149/178] no message --- .github/workflows/php-compatibility-testing.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index c92fa3b95d804..a0d3fbdcaaa65 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -53,9 +53,12 @@ jobs: composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction echo "vendor/bin" >> $GITHUB_PATH + - name: Log PHPCS debug info + run: phpcs -i + - name: Run PHP compatibility tests uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} php_codesniffer: true - php_codesniffer_args: "--standard=./phpcompat.xml.dist" + php_codesniffer_args: "--standard=phpcompat.xml.dist" From be59699c09c17d309f0eb3cee1f37f4d0ca881ea Mon Sep 17 00:00:00 2001 From: Jon Desrosiers Date: Fri, 9 Oct 2020 18:01:13 -0400 Subject: [PATCH 150/178] Update test-wordpress.yml Try explicit true --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 109c891fc0c13..64249a84a0473 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -178,7 +178,7 @@ jobs: # TODO: Make LOCAL_PHP be the value of matrix.php_versions with memcached replaced with '-fpm' run: | echo "LOCAL_PHP=latest" >> $GITHUB_ENV - echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV + echo "LOCAL_PHP_MEMCACHED=${{ true }}" >> $GITHUB_ENV - name: Use cached Node modules uses: actions/cache@v2 From 5c87d55f5c4af22937f742dd5488792ab1a641e7 Mon Sep 17 00:00:00 2001 From: Jon Desrosiers Date: Fri, 9 Oct 2020 18:39:37 -0400 Subject: [PATCH 151/178] Update test-wordpress.yml --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 64249a84a0473..38785a460795b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -235,7 +235,7 @@ jobs: # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. - name: Start the Memcached server. - if: ${{ env.LOCAL_PHP_MEMCACHED == true }} + if: ${{ env.LOCAL_PHP_MEMCACHED }} run: | cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached From 569ba44201328d6f5eb32f5e85e0d41c51571e92 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 08:46:29 -0400 Subject: [PATCH 152/178] Fix conditionals --- .github/workflows/test-wordpress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 38785a460795b..3d64b3821bc91 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -178,7 +178,7 @@ jobs: # TODO: Make LOCAL_PHP be the value of matrix.php_versions with memcached replaced with '-fpm' run: | echo "LOCAL_PHP=latest" >> $GITHUB_ENV - echo "LOCAL_PHP_MEMCACHED=${{ true }}" >> $GITHUB_ENV + echo "LOCAL_PHP_MEMCACHED=true" >> $GITHUB_ENV - name: Use cached Node modules uses: actions/cache@v2 @@ -235,7 +235,7 @@ jobs: # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. - name: Start the Memcached server. - if: ${{ env.LOCAL_PHP_MEMCACHED }} + if: ${{ env.LOCAL_PHP_MEMCACHED == "true" }} run: | cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached From 621d2c006dd0bfd8be9df4195833dc0696df9f7f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 08:48:29 -0400 Subject: [PATCH 153/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 3d64b3821bc91..109c891fc0c13 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -235,7 +235,7 @@ jobs: # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. - name: Start the Memcached server. - if: ${{ env.LOCAL_PHP_MEMCACHED == "true" }} + if: ${{ env.LOCAL_PHP_MEMCACHED == true }} run: | cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached From 5e4ed343efadeed35408fb11544dd547cae57ab0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 09:05:02 -0400 Subject: [PATCH 154/178] Use the matrix to detect memcached --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 109c891fc0c13..cff601d26cc67 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -235,7 +235,7 @@ jobs: # The memcached server needs to start after the Docker network has been set up with `npm run env:start`. - name: Start the Memcached server. - if: ${{ env.LOCAL_PHP_MEMCACHED == true }} + if: ${{ contains( matrix.php_versions, 'memcached' ) }} run: | cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached From d1bcb42a616d36e9e14d63a929a9818a9c00466a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 09:15:53 -0400 Subject: [PATCH 155/178] Exclude the tests directory in the ruleset since `phpcs` command is hard coded into the action. --- .github/workflows/coding-standards.yml | 3 +++ phpcompat.xml.dist | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 7be071a1e7a92..65adeb2238fc7 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -51,6 +51,9 @@ jobs: composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction echo "vendor/bin" >> $GITHUB_PATH + - name: Log PHPCS debug info + run: phpcs -i + - name: Run PHPCS on Core files uses: wearerequired/lint-action@v1 with: diff --git a/phpcompat.xml.dist b/phpcompat.xml.dist index 5af8e2a5039ae..51af6877c9513 100644 --- a/phpcompat.xml.dist +++ b/phpcompat.xml.dist @@ -30,6 +30,7 @@ ./src/ + /tests /node_modules/* From e023577084c7431c254b2ed637c3ee658759fff8 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 09:39:35 -0400 Subject: [PATCH 156/178] Clean up documentation. Add explicit exclusion for the `tests` directory when running PHP compatibility testing. --- .github/workflows/coding-standards.yml | 7 +++++-- .github/workflows/end-to-end-tests.yml | 6 ++---- .github/workflows/php-compatibility-testing.yml | 7 +++++-- .github/workflows/test-wordpress.yml | 2 +- phpcompat.xml.dist | 10 ++++++++++ 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 65adeb2238fc7..2c6dc482bac88 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -13,6 +13,7 @@ jobs: # - Sets up PHP. # - Logs debug information. # - Installs Composer dependencies (from cache if possible). + # - Logs PHP_CodeSniffer debug information. # - Runs PHPCS tests. phpcs: name: PHP coding standards @@ -51,8 +52,10 @@ jobs: composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction echo "vendor/bin" >> $GITHUB_PATH - - name: Log PHPCS debug info - run: phpcs -i + - name: Log PHPCS debug information + run: | + phpcs -v + phpcs -i - name: Run PHPCS on Core files uses: wearerequired/lint-action@v1 diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 92810707034a8..aa97c20d64a99 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -8,18 +8,16 @@ env: PHP_FPM_GID: 116 # This needs to be dynamic jobs: - # Sets up WordPress for testing or development use. + # Runs the end-to-end test suite. # # Performs the following steps: # - Cancels all previous workflow runs that have not completed. # - Checks out the repository. # - Logs debug information about the runner container. # - Sets up caching for NPM. - # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. - # - Creates a ZIP file of compiled WordPress - # - Uploads ZIP file as an artifact. # - Starts the WordPress Docker container. # - Logs the running Docker containers. # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container) diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index a0d3fbdcaaa65..3da9e1f0b22e7 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -14,6 +14,7 @@ jobs: # - Sets up PHP. # - Logs debug information about the runner container. # - Installs Composer dependencies (from cache if possible). + # - Logs PHP_CodeSniffer debug information. # - Runs the PHP compatibility tests. php-comatibility: name: Test PHP compatibility @@ -53,8 +54,10 @@ jobs: composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction echo "vendor/bin" >> $GITHUB_PATH - - name: Log PHPCS debug info - run: phpcs -i + - name: Log PHPCS debug information + run: | + phpcs -v + phpcs -i - name: Run PHP compatibility tests uses: wearerequired/lint-action@v1 diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index cff601d26cc67..f949177fb9b70 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -20,7 +20,7 @@ jobs: # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests). # - Logs debug information about the runner container. # - Sets up caching for NPM. - # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. # - Creates a ZIP file of compiled WordPress diff --git a/phpcompat.xml.dist b/phpcompat.xml.dist index 51af6877c9513..1254643e16274 100644 --- a/phpcompat.xml.dist +++ b/phpcompat.xml.dist @@ -30,6 +30,16 @@ ./src/ + + /tests From 75f12aec9573832fcf608b21b6d6cfafaf168fdd Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 09:39:49 -0400 Subject: [PATCH 157/178] Move JavaScript tests to their own workflow. --- .github/workflows/javascript-tests.yml | 60 ++++++++++++++++++++++++++ .github/workflows/test-wordpress.yml | 50 +-------------------- 2 files changed, 61 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/javascript-tests.yml diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml new file mode 100644 index 0000000000000..84b0931b39f96 --- /dev/null +++ b/.github/workflows/javascript-tests.yml @@ -0,0 +1,60 @@ +name: JavaScript Tests + +on: [push] + +jobs: + # Runs the QUnit tests for WordPress. + # + # Performs the following steps: + # - Cancels all previous workflow runs that have not completed. + # - Checks out the repository. + # - Logs debug information about the runner container. + # - Sets up caching for NPM. + # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) + # _ Installs NPM dependencies. + # - Run the WordPress QUnit tests. + test-js: + name: Setup WordPress + runs-on: ubuntu-latest + steps: + - name: Cancel previous runs of this workflow + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log debug information + run: | + npm --version + which npm + node --version + curl --version + git --version + svn --version + php --version + php -i + locale -a + + - name: Cache Node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install NPM + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Dependencies + run: npm ci + + - name: Run QUnit tests + run: npm run grunt travis:js diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index f949177fb9b70..d43aea212e5ab 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -1,4 +1,4 @@ -name: Core Test Suite +name: PHPUnit Tests on: [push] @@ -87,54 +87,6 @@ jobs: path: built-wp-${{ github.sha }}.zip if-no-files-found: error - # Runs the QUnit tests for WordPress. - # - # Performs the following steps: - # - Downloads the built WordPress artifact from the previous job. - # - Unzips the artifact. - # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used - # if it was stored successfully). - # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) - # _ Installs NPM dependencies (only Chromium should need installing here). - # - Run the WordPress QUnit tests. - test-js: - name: JavaScript Tests (QUnit) - needs: setup-wordpress - runs-on: ubuntu-latest - env: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: - - steps: - - name: Download the WordPress build artifact - uses: actions/download-artifact@v2 - with: - name: built-wp-${{ github.sha }} - - - name: Unzip built artifact - run: unzip built-wp-${{ github.sha }}.zip - - - name: Use cached Node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - - name: Install NPM - uses: actions/setup-node@v1 - with: - node-version: 12 - - - name: Install Dependencies - run: npm ci - - - name: Run QUnit tests - run: npm run grunt travis:js - # Runs the PHPUnit tests for WordPress. # # Performs the following steps: From 9c8faf4498ef8cdd5bc69d5d42112730740c946a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 09:41:20 -0400 Subject: [PATCH 158/178] Don't need to log PHP debug information in the JavaScript workflow. --- .github/workflows/javascript-tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 84b0931b39f96..95840ce167639 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -29,13 +29,8 @@ jobs: run: | npm --version which npm - node --version - curl --version git --version svn --version - php --version - php -i - locale -a - name: Cache Node modules uses: actions/cache@v2 From ca712e76b54894c11cf09e5847b609a3786afe62 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 09:43:27 -0400 Subject: [PATCH 159/178] Limit PHPCS debug info. --- .github/workflows/coding-standards.yml | 4 +--- .github/workflows/php-compatibility-testing.yml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 2c6dc482bac88..f07f0524b30b9 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -53,9 +53,7 @@ jobs: echo "vendor/bin" >> $GITHUB_PATH - name: Log PHPCS debug information - run: | - phpcs -v - phpcs -i + run: phpcs -i - name: Run PHPCS on Core files uses: wearerequired/lint-action@v1 diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 3da9e1f0b22e7..ea317ff30995e 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -55,9 +55,7 @@ jobs: echo "vendor/bin" >> $GITHUB_PATH - name: Log PHPCS debug information - run: | - phpcs -v - phpcs -i + run: phpcs -i - name: Run PHP compatibility tests uses: wearerequired/lint-action@v1 From 06a9a6ef7fb8bc7d6f6ef3a05510c43be041eadb Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 09:44:19 -0400 Subject: [PATCH 160/178] Fix name of the `test-js` job. --- .github/workflows/javascript-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 95840ce167639..0944a91ef3e2c 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -14,7 +14,7 @@ jobs: # _ Installs NPM dependencies. # - Run the WordPress QUnit tests. test-js: - name: Setup WordPress + name: QUnit Tests runs-on: ubuntu-latest steps: - name: Cancel previous runs of this workflow From fb762f749599b9612bb565813c414b4f24255154 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 10:04:13 -0400 Subject: [PATCH 161/178] Naming adjustments. --- .github/workflows/coding-standards.yml | 4 ++-- .github/workflows/end-to-end-tests.yml | 4 ++-- .github/workflows/php-compatibility-testing.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index f07f0524b30b9..3051052a43ca7 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -1,4 +1,4 @@ -name: Coding standards checks +name: PHP Coding standards on: [push] @@ -16,7 +16,7 @@ jobs: # - Logs PHP_CodeSniffer debug information. # - Runs PHPCS tests. phpcs: - name: PHP coding standards + name: Check PHP coding standards runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index aa97c20d64a99..74ac6f76d8da7 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -1,4 +1,4 @@ -name: E2E Test Suite +name: End-to-end Tests on: [push] @@ -24,7 +24,7 @@ jobs: # - Install WordPress within the Docker container. # - Run the E2E tests. e2e-tests: - name: Setup WordPress + name: E2E Tests runs-on: ubuntu-latest steps: - name: Cancel previous runs of this workflow diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index ea317ff30995e..74e4c34a9e9f0 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -1,4 +1,4 @@ -name: PHP Compatibility Testing +name: PHP Compatibility on: [push] @@ -17,7 +17,7 @@ jobs: # - Logs PHP_CodeSniffer debug information. # - Runs the PHP compatibility tests. php-comatibility: - name: Test PHP compatibility + name: Check PHP compatibility runs-on: ubuntu-latest steps: From 410e84123252847c0f5d563bffc2255963ac42b6 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 11:25:23 -0400 Subject: [PATCH 162/178] Updat docs. --- .github/workflows/coding-standards.yml | 2 + .github/workflows/end-to-end-tests.yml | 13 ++++- .github/workflows/javascript-tests.yml | 9 +++- .../workflows/php-compatibility-testing.yml | 1 + .github/workflows/test-wordpress.yml | 49 +++++++++++++------ 5 files changed, 57 insertions(+), 17 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 3051052a43ca7..01d2ba362857c 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -15,6 +15,8 @@ jobs: # - Installs Composer dependencies (from cache if possible). # - Logs PHP_CodeSniffer debug information. # - Runs PHPCS tests. + # - todo: Add a PHP_CodeSniffer scan for the `tests` directory that does not suppress warnings. + # - todo: Configure Slack notifications for failing scans. phpcs: name: Check PHP coding standards runs-on: ubuntu-latest diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 74ac6f76d8da7..f434daa39f3a3 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -19,10 +19,12 @@ jobs: # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. # - Starts the WordPress Docker container. + # - Logs general debug information. # - Logs the running Docker containers. # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container) # - Install WordPress within the Docker container. # - Run the E2E tests. + # - todo: Configure Slack notifications for failing tests. e2e-tests: name: E2E Tests runs-on: ubuntu-latest @@ -38,7 +40,6 @@ jobs: - name: Log debug information run: | npm --version - which npm node --version curl --version git --version @@ -73,6 +74,14 @@ jobs: run: | npm run env:start + - name: General debug information + run: | + npm --version + node --version + curl --version + git --version + svn --version + - name: Log running Docker containers run: docker ps -a @@ -83,6 +92,8 @@ jobs: docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version docker-compose run --rm php php -m + docker-compose run --rm php php -i + docker-compose run --rm php locale -a - name: Install WordPress run: npm run env:install diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 0944a91ef3e2c..6fa2c7a653105 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -11,8 +11,10 @@ jobs: # - Logs debug information about the runner container. # - Sets up caching for NPM. # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) + # - Logs updated debug information. # _ Installs NPM dependencies. # - Run the WordPress QUnit tests. + # - todo: Configure Slack notifications for failing tests. test-js: name: QUnit Tests runs-on: ubuntu-latest @@ -28,7 +30,7 @@ jobs: - name: Log debug information run: | npm --version - which npm + node --version git --version svn --version @@ -48,6 +50,11 @@ jobs: with: node-version: 12 + - name: Log debug information + run: | + npm --version + node --version + - name: Install Dependencies run: npm ci diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 74e4c34a9e9f0..dc52069f9e0ee 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -16,6 +16,7 @@ jobs: # - Installs Composer dependencies (from cache if possible). # - Logs PHP_CodeSniffer debug information. # - Runs the PHP compatibility tests. + # - todo: Configure Slack notifications for failing scans. php-comatibility: name: Check PHP compatibility runs-on: ubuntu-latest diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index d43aea212e5ab..6eccc581839ea 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -1,6 +1,10 @@ name: PHPUnit Tests -on: [push] +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 0' env: LOCAL_DIR: build @@ -8,7 +12,8 @@ env: PHP_FPM_UID: 1001 # This needs to be dynamic PHP_FPM_GID: 116 # This needs to be dynamic COMPOSER_INSTALL: ${{ false }} - PHPUNIT_LIBRARY: php + # Controls which NPM script to use for running PHPUnit tests. Options are `php` and `php-composer`. + PHPUNIT_SCRIPT: php LOCAL_PHP_MEMCACHED: ${{ false }} jobs: @@ -43,7 +48,6 @@ jobs: - name: Log debug information run: | npm --version - which npm node --version curl --version git --version @@ -101,10 +105,13 @@ jobs: # _ Installs Composer dependencies (if desired) # - Starts the WordPress Docker container. # - Starts the memcached server after the Docker network has been created (if desired). + # - Logs general debug information. # - Logs the running Docker containers. # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container) # - Install WordPress inside the WordPress Docker container. # - Install WordPress within the Docker container. # - Run the PHPUnit tests. + # - Reports test results to the Distributed Hosting Tests. + # - todo: Configure Slack notifications for failing tests. test-php: name: ${{ matrix.php_versions }} on ${{ matrix.os }} (PHPUnit) needs: setup-wordpress @@ -148,6 +155,9 @@ jobs: with: node-version: 12 + - name: Install Dependencies + run: npm ci + - name: Get composer cache directory id: composer-cache if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }} @@ -170,17 +180,15 @@ jobs: docker-compose run --rm php composer --version # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, - # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. + # as PHPUnit 7 is no longer supported. The Composer-installed PHPUnit should be + # used for PHP 8 testing instead. if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then docker-compose run --rm php composer install --ignore-platform-reqs - echo "PHPUNIT_LIBRARY=php-composer" >> $GITHUB_ENV + echo "PHPUNIT_SCRIPT=php-composer" >> $GITHUB_ENV else docker-compose run --rm php composer install fi - - name: Install Dependencies - run: npm ci - - name: Start Docker environment run: | npm run env:start @@ -192,6 +200,14 @@ jobs: cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached + - name: General debug information + run: | + npm --version + node --version + curl --version + git --version + svn --version + - name: Log running Docker containers run: docker ps -a @@ -202,36 +218,39 @@ jobs: docker-compose run --rm mysql mysql --version docker-compose run --rm php php --version docker-compose run --rm php php -m + docker-compose run --rm php php -i + docker-compose run --rm php locale -a - name: Install WordPress run: npm run env:install - name: Run PHPUnit tests - run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist - name: Run AJAX tests - run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist --group ajax + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group ajax - name: Run tests as a multisite install - run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c tests/phpunit/multisite.xml + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml - name: Run mutlisite file tests - run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files - name: Run external HTTP tests - run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist --group external-http + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http - name: Run REST API tests - run: npm run test:${{ env.PHPUNIT_LIBRARY }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient + run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient # Xdebug supports PHP 8 only from version 3.0, which is not released yet. # Once Xdebug 3.0 is released and included in the Docker image, the IF condition should be removed. + # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - name: Run (xDebug) tests if: ${{ env.LOCAL_PHP != '8.0-fpm' }} run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__ - name: WordPress Test Reporter - if: ${{ matrix.php_versions == '7.0' }} + if: ${{ matrix.php_versions == '7.4' }} uses: actions/checkout@v2 with: repository: 'WordPress/phpunit-test-runner' From 3f2267d12ed7d06830d9d7df68526464fbaa5791 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 12 Oct 2020 12:03:48 -0400 Subject: [PATCH 163/178] Indicate that the JS standards checks are run in this workflow. --- .github/workflows/javascript-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 6fa2c7a653105..4680a3eba45a3 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -1,4 +1,4 @@ -name: JavaScript Tests +name: JavaScript Standards & Tests on: [push] @@ -13,7 +13,7 @@ jobs: # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) # - Logs updated debug information. # _ Installs NPM dependencies. - # - Run the WordPress QUnit tests. + # - Run the WordPress JavaScript coding standards checks and QUnit tests. # - todo: Configure Slack notifications for failing tests. test-js: name: QUnit Tests From d39f0ab2b85ed9fbee2bb467895a48321e6b4a15 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 10:06:23 -0400 Subject: [PATCH 164/178] Add a workflow that welcomes new contributors. --- .../workflows/welcome-new-contributors.yml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/welcome-new-contributors.yml diff --git a/.github/workflows/welcome-new-contributors.yml b/.github/workflows/welcome-new-contributors.yml new file mode 100644 index 0000000000000..1586049cae6cf --- /dev/null +++ b/.github/workflows/welcome-new-contributors.yml @@ -0,0 +1,43 @@ +name: Welcome + +on: + pull_request: + types: [opened] + +jobs: + post-welcome-message: + runs-on: ubuntu-latest + + steps: + - uses: bubkoo/welcome-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FIRST_PR_COMMENT: > + Hi @{{ author }}! 👋 + + Thank you for your contribution to WordPress! 💖 + + It looks like this is your first pull request, so here are a few things to be aware of that may help you out. + + **No one monitors this repository for new pull requests.** Pull requests **must** be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, simply include the ticket's full URL in your pull request description. + + **Pull requests are never merged on GitHub.** The WordPress codebase continues to be managed through the SVN repository that this one mirrors. But please feel free to use pull requests to work on any contribution you are making. + + More information about how GitHub pull requests can be used to contribute to WordPress can be found in [this blog post](https://make.wordpress.org/core/2020/02/21/working-on-trac-tickets-using-github-pull-requests/). + + Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the [Automated Testing](https://make.wordpress.org/core/handbook/testing/automated-testing/) page in the handbook. + + If you have not had a chance, please review the [Contribute with Code page](https://make.wordpress.org/core/handbook/contribute/) in the [WordPress Core Handbook](https://make.wordpress.org/core/handbook/). + + The [Developer Hub](https://developer.wordpress.org/) also documents the various [coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) that are followed: + - [PHP Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) + - [CSS Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/) + - [HTML Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/html/) + - [JavaScript Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/) + - [Accessibility Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/accessibility/) + - [Inline Documentation Standards](https://developer.wordpress.org/coding-standards/inline-documentation-standards/) + + Please remember that the WordPress project is largely maintained by volunteers + + Thank you, + The WordPress Project From 429d29f8098a26bbde0a58a9917eb29dbb06a8e6 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 10:14:30 -0400 Subject: [PATCH 165/178] Add Windows to see how that goes. --- .github/workflows/test-wordpress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 6eccc581839ea..3669bf49a8675 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -119,7 +119,7 @@ jobs: strategy: matrix: php_versions: [ '8.0', 7.4, '7.4 with memcached', 7.3, 7.2, 7.1, '7.0', 5.6.20 ] - os: [ ubuntu-latest ] + os: [ ubuntu-latest, windows-latest ] env: LOCAL_PHP: ${{ matrix.php_versions }}-fpm From 1ce0fd5ca0fe81a03f86b2d818faa02d2ad7933e Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 10:30:03 -0400 Subject: [PATCH 166/178] Clarify NPM/NodeJS docs. --- .github/workflows/end-to-end-tests.yml | 4 ++-- .github/workflows/javascript-tests.yml | 4 ++-- .github/workflows/test-wordpress.yml | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index f434daa39f3a3..7e5eb676a60f2 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -15,7 +15,7 @@ jobs: # - Checks out the repository. # - Logs debug information about the runner container. # - Sets up caching for NPM. - # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) + # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. # - Starts the WordPress Docker container. @@ -59,7 +59,7 @@ jobs: restore-keys: | ${{ runner.os }}-npm- - - name: Install NPM + - name: Install NodeJS uses: actions/setup-node@v1 with: node-version: 12 diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 4680a3eba45a3..6bf032b4a81bc 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -10,7 +10,7 @@ jobs: # - Checks out the repository. # - Logs debug information about the runner container. # - Sets up caching for NPM. - # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) + # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) # - Logs updated debug information. # _ Installs NPM dependencies. # - Run the WordPress JavaScript coding standards checks and QUnit tests. @@ -45,7 +45,7 @@ jobs: restore-keys: | ${{ runner.os }}-npm- - - name: Install NPM + - name: Install NodeJS uses: actions/setup-node@v1 with: node-version: 12 diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 3669bf49a8675..7220b52d83b3e 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -25,7 +25,7 @@ jobs: # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests). # - Logs debug information about the runner container. # - Sets up caching for NPM. - # - Installs NPM 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) + # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. # - Creates a ZIP file of compiled WordPress @@ -67,7 +67,7 @@ jobs: restore-keys: | ${{ runner.os }}-npm- - - name: Install NPM + - name: Install NodeJS uses: actions/setup-node@v1 with: node-version: 12 @@ -99,7 +99,7 @@ jobs: # - Sets up the environment variables needed for testing with memcached (if desired). # - Sets up caching for the NPM packages for the package-lock.json file (the cache from the previous job will be used # if it was stored successfully). - # - Installs NPM 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) + # - Installs NodeJS 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches) # _ Installs NPM dependencies. # - Configures caching for Composer. # _ Installs Composer dependencies (if desired) @@ -150,7 +150,7 @@ jobs: restore-keys: | ${{ runner.os }}-npm- - - name: Install NPM + - name: Install NodeJS uses: actions/setup-node@v1 with: node-version: 12 From 09d10646400aad24b56957c0aff7cfa27bbe63c1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 10:30:41 -0400 Subject: [PATCH 167/178] Log some docker debug info before attempting to use commands. --- .github/workflows/test-wordpress.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 7220b52d83b3e..2250456e7008b 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -103,9 +103,10 @@ jobs: # _ Installs NPM dependencies. # - Configures caching for Composer. # _ Installs Composer dependencies (if desired) + # - Logs Docker debug information (about both the Docker installation within the runner) # - Starts the WordPress Docker container. # - Starts the memcached server after the Docker network has been created (if desired). - # - Logs general debug information. + # - Logs WordPress Docker container debug information. # - Logs the running Docker containers. # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container) # - Install WordPress inside the WordPress Docker container. # - Install WordPress within the Docker container. @@ -189,6 +190,11 @@ jobs: docker-compose run --rm php composer install fi + - name: Docker debug information + run: | + docker -v + docker-compose -v + - name: Start Docker environment run: | npm run env:start @@ -211,7 +217,7 @@ jobs: - name: Log running Docker containers run: docker ps -a - - name: Docker debug information + - name: WordPress Docker container debug information run: | docker -v docker-compose -v From 6731e17efa08eb714cefa3a932c6eee90a401f10 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 10:47:27 -0400 Subject: [PATCH 168/178] The `bridge` driver is not available on Windows. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3d0ff62cd5700..7f3d02d41d1a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -131,4 +131,4 @@ volumes: networks: # Creating our own network allows us to connect between containers using their service name. wpdevnet: - driver: bridge + From 1b20469490138b5586f4bc0e309ed59da54bbe24 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 11:11:09 -0400 Subject: [PATCH 169/178] Trying to fix comments on PRs from forks. --- .github/workflows/welcome-new-contributors.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/welcome-new-contributors.yml b/.github/workflows/welcome-new-contributors.yml index 1586049cae6cf..306b1c70e1cc7 100644 --- a/.github/workflows/welcome-new-contributors.yml +++ b/.github/workflows/welcome-new-contributors.yml @@ -1,8 +1,8 @@ name: Welcome on: - pull_request: - types: [opened] + pull_request_target: + types: [ opened ] jobs: post-welcome-message: From 96c10e76728e32e67c88c7ffed577e44c57ebb7e Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 11:14:29 -0400 Subject: [PATCH 170/178] Remove Windows testing for now. --- .github/workflows/test-wordpress.yml | 2 +- .github/workflows/welcome-new-contributors.yml | 2 +- docker-compose.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 2250456e7008b..648df0abe17eb 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -120,7 +120,7 @@ jobs: strategy: matrix: php_versions: [ '8.0', 7.4, '7.4 with memcached', 7.3, 7.2, 7.1, '7.0', 5.6.20 ] - os: [ ubuntu-latest, windows-latest ] + os: [ ubuntu-latest ] env: LOCAL_PHP: ${{ matrix.php_versions }}-fpm diff --git a/.github/workflows/welcome-new-contributors.yml b/.github/workflows/welcome-new-contributors.yml index 306b1c70e1cc7..c2fb1ac2677f7 100644 --- a/.github/workflows/welcome-new-contributors.yml +++ b/.github/workflows/welcome-new-contributors.yml @@ -1,7 +1,7 @@ name: Welcome on: - pull_request_target: + pull_request: types: [ opened ] jobs: diff --git a/docker-compose.yml b/docker-compose.yml index 7f3d02d41d1a8..3d0ff62cd5700 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -131,4 +131,4 @@ volumes: networks: # Creating our own network allows us to connect between containers using their service name. wpdevnet: - + driver: bridge From cbc31d85511d217b94e5241ba184b5bfde75fdc6 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 11:25:06 -0400 Subject: [PATCH 171/178] Add a workflow for testing `npm` commands on Windows. --- .github/workflows/end-to-end-tests.yml | 2 +- .github/workflows/javascript-tests.yml | 2 +- .github/workflows/test-wordpress.yml | 2 +- .github/workflows/verify-npm-windows.yml | 61 ++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/verify-npm-windows.yml diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 7e5eb676a60f2..27e6503a5e784 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -48,7 +48,7 @@ jobs: php -i locale -a - - name: Cache Node modules + - name: Cache NodeJS modules uses: actions/cache@v2 env: cache-name: cache-node-modules diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 6bf032b4a81bc..0e97ab20fd664 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -34,7 +34,7 @@ jobs: git --version svn --version - - name: Cache Node modules + - name: Cache NodeJS modules uses: actions/cache@v2 env: cache-name: cache-node-modules diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 648df0abe17eb..91c3230427b9a 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -56,7 +56,7 @@ jobs: php -i locale -a - - name: Cache Node modules + - name: Cache NodeJS modules uses: actions/cache@v2 env: cache-name: cache-node-modules diff --git a/.github/workflows/verify-npm-windows.yml b/.github/workflows/verify-npm-windows.yml new file mode 100644 index 0000000000000..bf10f6f99846c --- /dev/null +++ b/.github/workflows/verify-npm-windows.yml @@ -0,0 +1,61 @@ +name: Test NPM on Windows + +on: + push: + pull_request: + +jobs: + # Verifies that installing NPM dependencies and building WordPress works on Windows. + # + # Performs the following steps: + # - Cancels all previous workflow runs that have not completed. + # - Checks out the repository. + # - Logs debug information about the runner container. + # - Sets up caching for NPM. + # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) + # _ Installs NPM dependencies. + # - Builds WordPress to run from the `build` directory. + test-npm: + name: Tests NPM on Windows + runs-on: windows-latest + steps: + - name: Cancel previous runs of this workflow + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log debug information + run: | + npm --version + node --version + curl --version + git --version + svn --version + + - name: Get NPM cache directory + id: npm-cache + run: echo "::set-output name=dir::$(npm config get cache)" + + - name: Cache NodeJS modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install NodeJS + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Dependencies + run: npm ci + + - name: Build WordPress + run: npm run build From 5686c78c8c6c263039b691a4ffbbcbc8881559b4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 11:43:52 -0400 Subject: [PATCH 172/178] Update the name of the welcome action. --- .github/workflows/welcome-new-contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/welcome-new-contributors.yml b/.github/workflows/welcome-new-contributors.yml index c2fb1ac2677f7..d961c46ce6175 100644 --- a/.github/workflows/welcome-new-contributors.yml +++ b/.github/workflows/welcome-new-contributors.yml @@ -1,4 +1,4 @@ -name: Welcome +name: Welcome New Contributors on: pull_request: From d7062816972dfaab0cb5326dac7a3071f2421e9f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 12:34:14 -0400 Subject: [PATCH 173/178] Add `check_name` to prevent results from posting on different workflow runs. --- .github/workflows/coding-standards.yml | 1 + .github/workflows/php-compatibility-testing.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 01d2ba362857c..dcc86224edbb6 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -61,6 +61,7 @@ jobs: uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} + check_name: ${linter}-php-coding-standards php_codesniffer: true # Ignore warnings php_codesniffer_args: "-n" diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index dc52069f9e0ee..c2f902d2e3686 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -62,5 +62,6 @@ jobs: uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} + check_name: ${linter}-php-compatibility php_codesniffer: true php_codesniffer_args: "--standard=phpcompat.xml.dist" From c233838b5f4e74e9a9ec845d7f1410f2abb38484 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 12:52:35 -0400 Subject: [PATCH 174/178] Add cron runs for each version branch. Also, update `on` configuration. --- .github/workflows/coding-standards.yml | 6 ++++-- .github/workflows/end-to-end-tests.yml | 4 +++- .github/workflows/javascript-tests.yml | 4 +++- .github/workflows/php-compatibility-testing.yml | 6 ++++-- .github/workflows/test-wordpress.yml | 6 ++++++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index dcc86224edbb6..cd8f31d41a74a 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -1,6 +1,8 @@ name: PHP Coding standards -on: [push] +on: + push: + pull_request: jobs: # Runs PHP coding standards checks. @@ -61,7 +63,7 @@ jobs: uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} - check_name: ${linter}-php-coding-standards + check_name: PHP-Coding-Standards-${linter} php_codesniffer: true # Ignore warnings php_codesniffer_args: "-n" diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 27e6503a5e784..e5718481c3ec9 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -1,6 +1,8 @@ name: End-to-end Tests -on: [push] +on: + push: + pull_request: env: LOCAL_DIR: build diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 0e97ab20fd664..bbbbfe447e47a 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -1,6 +1,8 @@ name: JavaScript Standards & Tests -on: [push] +on: + push: + pull_request: jobs: # Runs the QUnit tests for WordPress. diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index c2f902d2e3686..07f47d4cdc43e 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -1,6 +1,8 @@ name: PHP Compatibility -on: [push] +on: + push: + pull_request: jobs: @@ -62,6 +64,6 @@ jobs: uses: wearerequired/lint-action@v1 with: github_token: ${{ secrets.github_token }} - check_name: ${linter}-php-compatibility + check_name: PHP-Compatibility-${linter} php_codesniffer: true php_codesniffer_args: "--standard=phpcompat.xml.dist" diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 91c3230427b9a..17f67b1384e34 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -4,6 +4,12 @@ on: push: pull_request: schedule: + branches: + - '5.*' + - '4.*' + - 3.9 + - 3.8 + - 3.7 - cron: '0 0 * * 0' env: From 7f5252c7e64d172ed7da64a9ddde67798e52bac9 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 12:53:31 -0400 Subject: [PATCH 175/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 17f67b1384e34..5a7ffab55ede6 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -7,9 +7,9 @@ on: branches: - '5.*' - '4.*' - - 3.9 - - 3.8 - - 3.7 + - '3.9' + - '3.8' + - '3.7' - cron: '0 0 * * 0' env: From 4fcd248c195e8df992adc4255767a067960c17d4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 13:08:48 -0400 Subject: [PATCH 176/178] Do not continue on error. --- .github/workflows/coding-standards.yml | 2 ++ .github/workflows/php-compatibility-testing.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index cd8f31d41a74a..d9a6ae8b093d4 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -22,6 +22,8 @@ jobs: phpcs: name: Check PHP coding standards runs-on: ubuntu-latest + continue-on-error: false + steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 07f47d4cdc43e..032ccd72b5869 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -22,6 +22,7 @@ jobs: php-comatibility: name: Check PHP compatibility runs-on: ubuntu-latest + continue-on-error: false steps: - name: Checkout repository From 95c4622f97f314769e2bf7137a89acbb5137c352 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 13:09:08 -0400 Subject: [PATCH 177/178] Fix syntax error. --- .github/workflows/test-wordpress.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-wordpress.yml b/.github/workflows/test-wordpress.yml index 5a7ffab55ede6..ffd0940867f42 100644 --- a/.github/workflows/test-wordpress.yml +++ b/.github/workflows/test-wordpress.yml @@ -1,15 +1,14 @@ name: PHPUnit Tests on: + # Anytime a branch or tag is created. + create: + # Anytime a commit is pushed. push: + # Anytime a pull request is opened. pull_request: + # Once weekly On Sundays at 00:00 UTC. schedule: - branches: - - '5.*' - - '4.*' - - '3.9' - - '3.8' - - '3.7' - cron: '0 0 * * 0' env: From 7e84c26ab87e33ea1d0f1adf8a8b227684e68514 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 13 Oct 2020 13:15:51 -0400 Subject: [PATCH 178/178] Revert "Do not continue on error." This reverts commit 4fcd248c195e8df992adc4255767a067960c17d4. --- .github/workflows/coding-standards.yml | 2 -- .github/workflows/php-compatibility-testing.yml | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index d9a6ae8b093d4..cd8f31d41a74a 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -22,8 +22,6 @@ jobs: phpcs: name: Check PHP coding standards runs-on: ubuntu-latest - continue-on-error: false - steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/.github/workflows/php-compatibility-testing.yml b/.github/workflows/php-compatibility-testing.yml index 032ccd72b5869..07f47d4cdc43e 100644 --- a/.github/workflows/php-compatibility-testing.yml +++ b/.github/workflows/php-compatibility-testing.yml @@ -22,7 +22,6 @@ jobs: php-comatibility: name: Check PHP compatibility runs-on: ubuntu-latest - continue-on-error: false steps: - name: Checkout repository