Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Tests #148

Merged
merged 270 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
270 commits
Select commit Hold shift + click to select a range
f8803ba
Use latest PW
Luc45 Mar 20, 2024
eca6872
Codegen is bootstrap only
Luc45 Mar 20, 2024
9e03245
Throw if no tests
Luc45 Mar 22, 2024
431a711
Increase timeout for auth
Luc45 Mar 22, 2024
fca588b
Re-order options
Luc45 Mar 22, 2024
ae40a1c
Add debug output to environment downloader, sync on env:up
Luc45 Mar 22, 2024
78aa38f
Run all PW tests in one run for centralized reporting
Luc45 Mar 22, 2024
21b0bd8
Run all PW tests in one run for centralized reporting, fix circular dep
Luc45 Mar 22, 2024
1284711
build
Luc45 Mar 22, 2024
9db91ed
Add some helpful client-side validation when uploading test from dir
Luc45 Mar 22, 2024
63007f0
Tests
Luc45 Mar 22, 2024
fbf1395
Reduce verbosity on codegen command
Luc45 Mar 22, 2024
e9481a2
Codegen output
Luc45 Mar 22, 2024
e918d2e
Use our own Docker images with FixUID
Luc45 Mar 23, 2024
73a5e0c
FixUID
Luc45 Mar 23, 2024
80d0542
Warning
Luc45 Mar 23, 2024
65f156a
Allow compatibility to also be comma-separated slugs (eg: to skip Core)
Luc45 Mar 23, 2024
09243f4
Tweaks
Luc45 Mar 23, 2024
d374523
Improvements to reporting, etc
Luc45 Mar 23, 2024
c3cbe53
Tests, etc
Luc45 Mar 23, 2024
2d4f933
typo
Luc45 Mar 23, 2024
8281412
woocommerce_version RC
Luc45 Mar 23, 2024
043a968
Delete dangling without asking
Luc45 Mar 23, 2024
756907a
PHPCS, etc
Luc45 Mar 23, 2024
905cc59
Improve pasting on auth (was hard on Windows)
Luc45 Mar 23, 2024
f69adf8
tests
Luc45 Mar 23, 2024
5d2e575
Move class
Luc45 Mar 24, 2024
adb2951
Pull zip image
Luc45 Mar 24, 2024
11787a1
Pull docker images and inform user
Luc45 Mar 24, 2024
c424a20
Tweak test
Luc45 Mar 24, 2024
37feedb
Test tweaks
Luc45 Mar 24, 2024
5f6e659
Tweaks
Luc45 Mar 24, 2024
e78f628
Scaffold E2E
Luc45 Mar 25, 2024
654c75a
Update expected directory structure... Allow nested directories
Luc45 Mar 25, 2024
657d24f
Allow nested dirs
Luc45 Mar 25, 2024
a1e0a5c
Remove requirement for "tests" directory
Luc45 Mar 25, 2024
2faadbc
build
Luc45 Mar 25, 2024
20b3aa3
Run phpcbf as part of phpcs
Luc45 Mar 25, 2024
bc4bf6a
Scaffold tweaks
Luc45 Mar 25, 2024
6cd07ab
Add some basic next steps after scaffolding
Luc45 Mar 25, 2024
1e2b0f3
Streamline codegen, open it for them
Luc45 Mar 25, 2024
64b2092
Scaffold a working test, comment out custom code
Luc45 Mar 25, 2024
b6f76ff
Comment tweaks
Luc45 Mar 25, 2024
bcc0379
Print the path
Luc45 Mar 25, 2024
a58bb54
Print the directory
Luc45 Mar 25, 2024
e73a052
Add "playwright-codegen" and "docker" to allowed directories
Luc45 Mar 25, 2024
3a61fe0
Fix prefixer on scaffolding
Luc45 Mar 25, 2024
11f4f30
PHPCS, etc
Luc45 Mar 25, 2024
97a2cbd
Use named volume for /var/www/html
Luc45 Mar 25, 2024
19c2e11
Map mu-plugins
Luc45 Mar 25, 2024
4e0c724
Also cleanup dangling volumes now that we create them
Luc45 Mar 25, 2024
74203b2
Try to write to mounted volume
Luc45 Mar 26, 2024
5782606
Revert
Luc45 Mar 26, 2024
6853e97
Can we download the extensions inside docker to leverage mounted volume?
Luc45 Mar 26, 2024
3940d10
Revert "Can we download the extensions inside docker to leverage moun…
Luc45 Mar 26, 2024
759071e
Woo optional, delete yml
Luc45 Mar 26, 2024
d3bdffc
Allow to delete tests dir
Luc45 Mar 26, 2024
795a784
Can we download the extensions inside docker to leverage mounted volume?
Luc45 Mar 26, 2024
4c59dcf
Use a mounted volume (exploration)
Luc45 Mar 26, 2024
90e7bfe
Phar
Luc45 Mar 26, 2024
d7fa041
Core as volume mount, plugins and themes as volume binds
Luc45 Mar 26, 2024
68fc1b3
WordPress.org tweak
Luc45 Mar 26, 2024
6b2e7eb
Use playwright from the image
Luc45 Mar 27, 2024
873551b
Allow to pass zip parameter
Luc45 Mar 27, 2024
db3d643
Allow to use local zip
Luc45 Mar 27, 2024
c602238
Handle gracefully if npm install playwright fails for codegen
Luc45 Mar 27, 2024
837a662
build
Luc45 Mar 27, 2024
67c8bbc
Improvements to SUT
Luc45 Mar 27, 2024
92ec007
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 Mar 28, 2024
17a11fb
Allow to tag a test when uploading
Luc45 Mar 28, 2024
376c040
WIP test tags
Luc45 Mar 29, 2024
b378e10
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 Mar 29, 2024
36c2d74
Use cached volume bind
Luc45 Apr 2, 2024
60c03fd
"--woo", not "--woocommerce_version"
Luc45 Apr 2, 2024
13ec707
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 Apr 3, 2024
108d1e1
Plugins and Themes Parser WIP
Luc45 Apr 4, 2024
d357002
Plugins and themes parser WIP
Luc45 Apr 5, 2024
08014ab
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 Apr 5, 2024
c157cef
Parser
Luc45 Apr 5, 2024
c7a2cfe
Basic test tag validation
Luc45 Apr 5, 2024
b339c41
Validate input, override if needed
Luc45 Apr 5, 2024
3b0c450
Improvements to SUT action, test_tags and source
Luc45 Apr 6, 2024
dd261f6
Download multiple tags
Luc45 Apr 6, 2024
9650abc
Use multiple test tags
Luc45 Apr 6, 2024
b169720
PHPCBF/PHPCS
Luc45 Apr 6, 2024
2848100
PHPStan/PHPCS
Luc45 Apr 6, 2024
4f22206
Tests
Luc45 Apr 7, 2024
1f67134
Tweak
Luc45 Apr 7, 2024
84eb0cc
Export/import db dumps, run entrypoint and controlled projects
Luc45 Apr 8, 2024
76e67ff
DB Import + Codegen + Entrypoint WIP
Luc45 Apr 8, 2024
4b55669
DB Import
Luc45 Apr 8, 2024
452932d
Entrypoint
Luc45 Apr 8, 2024
cd53b26
Tests
Luc45 Apr 8, 2024
96ea625
Tweak flows for using the "install, bootstrap, test" actions
Luc45 Apr 8, 2024
646b217
Cleanup dangling environment if no docker containers assigned to it
Luc45 Apr 9, 2024
cb3974c
Add qitHelpers.js
Luc45 Apr 9, 2024
04bc52a
SUT short syntax
Luc45 Apr 9, 2024
647694f
Rename "install" to "activate"
Luc45 Apr 9, 2024
14758a0
Minor refactor
Luc45 Apr 9, 2024
a522fe1
Tests
Luc45 Apr 9, 2024
4a4f483
Add "test-tags" command
Luc45 Apr 9, 2024
6a32163
Tests
Luc45 Apr 9, 2024
b7c0b64
Fix "test" parameter
Luc45 Apr 10, 2024
efa5b9c
Fix deprecation notice
Luc45 Apr 10, 2024
dca7af6
Fix too_many_redirects
Luc45 Apr 10, 2024
b5c48fb
Set "test" action for SUT by default
Luc45 Apr 10, 2024
5b15373
Minor tweak, and give precedence to runtime parameters
Luc45 Apr 10, 2024
180daf5
Build
Luc45 Apr 10, 2024
b5b01bf
Don't abbreviate php_extension
Luc45 Apr 10, 2024
dd9d5df
Ignore some keys
Luc45 Apr 10, 2024
c57e6b3
Remove validation of slug inferr
Luc45 Apr 10, 2024
6665432
Add "php_version" and "wordpress_version" to "run:e2e"
Luc45 Apr 10, 2024
2de5040
Inform user if tag is overridden, throw if empty
Luc45 Apr 10, 2024
67eda4d
Build
Luc45 Apr 10, 2024
f730eae
Prevent message if env:down on an environment that was not created yet
Luc45 Apr 10, 2024
387c8ad
WIP
Luc45 Apr 10, 2024
0c0579d
Allow to match extension from WPORG
Luc45 Apr 11, 2024
80ae055
Allow to set dependencies, reduce duplication, update paths
Luc45 Apr 11, 2024
62b748d
Commit Woo E2E tests PoC in QIT
Luc45 Apr 11, 2024
2f025d6
Move file, use qit.getEnv
Luc45 Apr 11, 2024
df2c812
Use qit.getEnv and qit.setEnv
Luc45 Apr 11, 2024
9c3e2d8
Fix short syntax with slug
Luc45 Apr 11, 2024
e363f20
Place global-setup.js (unused for now)
Luc45 Apr 11, 2024
75a2d9a
Allow them to shard
Luc45 Apr 11, 2024
bb5fd8e
Validate shard parameter
Luc45 Apr 11, 2024
80c8578
PHPCS
Luc45 Apr 11, 2024
2ea4346
Try sharding
Luc45 Apr 11, 2024
bd841c9
Sharding attempt
Luc45 Apr 11, 2024
ee5a17f
Use another workflow
Luc45 Apr 11, 2024
6f80b68
Debug CI
Luc45 Apr 11, 2024
fc53d88
Increase sharding
Luc45 Apr 12, 2024
cd4e933
Typo
Luc45 Apr 12, 2024
f91942e
Space out sharded tests to avoid Docker 429'ing us
Luc45 Apr 12, 2024
7023d87
Better output for non-TTY terminals
Luc45 Apr 12, 2024
4bd15e5
Exit with failure if it fails
Luc45 Apr 12, 2024
a55fef1
Improve output rendering
Luc45 Apr 12, 2024
b6c3937
Hide URL on CI even with verbose
Luc45 Apr 12, 2024
b3929a9
Set path even if it fails
Luc45 Apr 12, 2024
67ad671
Prevent ipv6 port from conflicting with ipv4
Luc45 Apr 12, 2024
58dd4dd
Allow to pass additional pw_options for things like snapshots, etc
Luc45 Apr 12, 2024
db5b1ad
Add command to delete test tags, and other minor tweaks
Luc45 Apr 13, 2024
8302f3c
Groundwork for Custom Tests self-tests
Luc45 Apr 13, 2024
8c9730f
Add groundwork for Custom Tests self-tests
Luc45 Apr 13, 2024
c5015ab
Remove space
Luc45 Apr 13, 2024
11dc58c
Some servers fail on port 0
Luc45 Apr 13, 2024
29ec101
Tweak report port logic
Luc45 Apr 13, 2024
5048da6
Use 8.8.1
Luc45 Apr 15, 2024
9ce5644
Typo
Luc45 Apr 15, 2024
b5a9834
Tweak logic to find port for report
Luc45 Apr 17, 2024
32f98a3
tests
Luc45 Apr 17, 2024
d998d6f
build
Luc45 Apr 17, 2024
f095b0b
Refactor groundwork for custom tests self-tests
Luc45 Apr 24, 2024
29f0ae4
Tests groundwork
Luc45 Apr 26, 2024
8050389
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 Apr 26, 2024
0324ab6
Auth on start/end with normalized snapshots
Luc45 Apr 26, 2024
fa8d8dc
Persistent cache and more tests
Luc45 Apr 26, 2024
22f77c5
Remove pcntl
Luc45 Apr 26, 2024
42b2f68
Test with qit-env.json
Luc45 Apr 26, 2024
91d1abf
Improvements to test parallelization
Luc45 Apr 26, 2024
5588978
Minor tweaks and tests
Luc45 Apr 26, 2024
d81eb36
Add README.md
Luc45 Apr 26, 2024
d8ca34a
Test run:e2e can run the scaffolded test
Luc45 Apr 26, 2024
3cfbcd2
Tags tests
Luc45 Apr 26, 2024
09644d2
Tag and run tag
Luc45 Apr 26, 2024
123a9b6
Fail if fail to activate, more tests
Luc45 Apr 26, 2024
8fcafd7
Test with object cache
Luc45 Apr 26, 2024
4ecc54e
Add a --config parameter to avoid parallel processes reading the config
Luc45 Apr 26, 2024
9b6e7ba
Add a README with how the self-tests of the custom tests works
Luc45 Apr 29, 2024
366b7f5
Spacing
Luc45 Apr 29, 2024
24b12e4
Syntax
Luc45 Apr 29, 2024
28abfc1
Move logic to a trait to reuse it
Luc45 Apr 29, 2024
78d2947
Add Compatibility Tests
Luc45 Apr 29, 2024
8965a3b
Add test with multiple tags
Luc45 Apr 29, 2024
7433fec
Add a compat test, use unique tags, normalize tag upload syntax
Luc45 Apr 29, 2024
c7b33df
Tests
Luc45 Apr 29, 2024
9aaa2f1
Add test for additional volume
Luc45 Apr 29, 2024
89d85d2
Fixes and normalizations for Woo and WP versions
Luc45 Apr 29, 2024
bebf9a6
Add more tests, standardize and fix using WP and Woo parameters
Luc45 Apr 29, 2024
8efab8a
PHPStan and snapshots
Luc45 Apr 29, 2024
cc76ae5
Cleanup
Luc45 Apr 30, 2024
527a8eb
PHPCS
Luc45 Apr 30, 2024
375b780
Add test and fix bug
Luc45 Apr 30, 2024
9b2f745
Update snapshots and port it back to source
Luc45 Apr 30, 2024
c3c9551
PHPCS
Luc45 Apr 30, 2024
c148f13
Tests WIP
Luc45 Apr 30, 2024
0f56c0c
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 May 1, 2024
454f3e9
Allow PW config override, use it in tests
Luc45 May 2, 2024
528048f
Normalize
Luc45 May 2, 2024
59cae6b
Add workflow
Luc45 May 2, 2024
efa1c78
Use existing workflow for testing
Luc45 May 2, 2024
3e9a244
Typo
Luc45 May 2, 2024
8e5c2bc
Update snapshot
Luc45 May 2, 2024
e1d0a5a
Working directory
Luc45 May 2, 2024
beb3ade
Update syntax
Luc45 May 2, 2024
43401de
Build
Luc45 May 2, 2024
73170e6
Debug auth
Luc45 May 2, 2024
7fadb5b
Skip partner add on Staging
Luc45 May 2, 2024
3f43389
Create cache directory if needed
Luc45 May 2, 2024
df0490c
Only persist cache if it exists
Luc45 May 2, 2024
651cbb5
Create tmp dir
Luc45 May 2, 2024
b2adb18
Typo
Luc45 May 2, 2024
2b35eb1
Add debug
Luc45 May 2, 2024
e76ab68
Early bail other processes if the first one fails to connect
Luc45 May 2, 2024
3b03f0c
Check the ID per environment
Luc45 May 2, 2024
2dfa94a
Normalize
Luc45 May 2, 2024
804bf5d
Update
Luc45 May 2, 2024
9c0f2f0
Update
Luc45 May 2, 2024
301af4c
Debug CI
Luc45 May 2, 2024
171ab09
Disable parallelization in CI
Luc45 May 2, 2024
14152d2
Debug CI
Luc45 May 2, 2024
aaaa0f4
Set a TMP directory while in CI
Luc45 May 2, 2024
4a4dc55
Add some defensive checks
Luc45 May 2, 2024
27db446
Print paths being used as well
Luc45 May 2, 2024
0fd9be2
Set tmp dir at ini
Luc45 May 2, 2024
6ff90e8
Typo
Luc45 May 2, 2024
2bba183
Skip cleanup in CI
Luc45 May 2, 2024
cc24408
Debug CI
Luc45 May 2, 2024
48bef16
Try unparallelized
Luc45 May 2, 2024
fc83ad1
Set a fixed column width for predictable snapshot testing
Luc45 May 2, 2024
5037b8d
Debug CI
Luc45 May 2, 2024
41755a4
Update snapshots
Luc45 May 2, 2024
2f84781
Debug CI
Luc45 May 2, 2024
db3e2cc
Also normalize "/tmp/"
Luc45 May 2, 2024
22bb7b6
Update snapshots
Luc45 May 2, 2024
390ace2
Update snapshot
Luc45 May 2, 2024
09ec4bc
Snapshot update
Luc45 May 2, 2024
0202e9d
"bistro" zip is broken on staging, use "deli"
Luc45 May 2, 2024
00010e9
Normalize snapshots
Luc45 May 2, 2024
8a1c83f
Try with paratest again
Luc45 May 2, 2024
14769ae
Revert "Try with paratest again"
Luc45 May 2, 2024
b7e8bb8
Test self-tests on Staging
Luc45 May 3, 2024
c2846a3
Update syntax for features
Luc45 May 4, 2024
f12326d
Disable DOCKER_CLI_HINTS
Luc45 May 6, 2024
015ce48
Update how we normalize the path after scaffolding in self-tests
Luc45 May 6, 2024
158ca72
build
Luc45 May 6, 2024
71923d9
Update snapshots
Luc45 May 6, 2024
838bd55
Trigger CI again
Luc45 May 6, 2024
a9cd10b
Retry deleting after waiting just in case
Luc45 May 7, 2024
850eb0c
CR Fixes
Luc45 May 8, 2024
4e3645f
Improved listing environments
Luc45 May 8, 2024
1884108
CR: Update doc links
Luc45 May 8, 2024
e58c98f
Improve message
Luc45 May 8, 2024
e46d238
Static tests
Luc45 May 8, 2024
71cf2be
Update snapshots
Luc45 May 8, 2024
e21c9eb
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 May 9, 2024
9d76f30
Tweak error message
Luc45 May 9, 2024
a30c3bf
Tests
Luc45 May 9, 2024
6ab1df3
Merge branch 'trunk' into 24-03/custom-tests-3
Luc45 May 10, 2024
9c6df5a
PHPCompatibility snapshot
Luc45 May 10, 2024
9b023a7
Re-add all workflows
Luc45 May 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
89 changes: 89 additions & 0 deletions .github/workflows/qit-custom-test-woocommerce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: QIT Custom Test - WooCommerce

on:
# Manually
workflow_dispatch:

jobs:
playwright-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup PHP (Cross-platform)
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Enable dev mode
run: ./qit dev

# Delay start of tests based on shardIndex to space out requests and avoid 429.
# Example: This step causes shard 1 to start immediately, shard 2 to start after a 10-second delay, shard 3 after a 20-second delay, etc.
- name: Wait before running tests
run: sleep $(( (${{ matrix.shardIndex }} - 1) * 10 ))

- name: Connect to Staging QIT
run: ./qit backend:add --environment="staging" --qit_secret="${{ secrets.QIT_STAGING_SECRET }}" --manager_url="https://stagingcompatibilitydashboard.wpcomstaging.com"

- name: Composer install
working-directory: src
run: composer install

- name: Start environment
working-directory: src
run: php qit-cli.php run:e2e https://github.com/woocommerce/woocommerce/releases/download/8.8.1/woocommerce.zip:test:./../_tests/example-tests/woocommerce -v --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- name: Set the path in an env var
if: ${{ !cancelled() }}
working-directory: src
run: |
echo "BLOB_REPORT_PATH=$(php qit-cli.php e2e-report --dir_only)/blob" >> $GITHUB_ENV

- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.shardIndex }}
path: ${{ env.BLOB_REPORT_PATH }}
retention-days: 1

merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: ${{ !cancelled() }}
needs: [playwright-tests]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18

- name: Install Playwright
run: npm install playwright

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports

- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14
84 changes: 51 additions & 33 deletions .github/workflows/qit-environment-dangling-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

jobs:
environment_dangling_tests:
test_stop_random_container:
runs-on: ubuntu-latest
env:
NO_COLOR: 1
Expand All @@ -22,44 +22,62 @@ jobs:
with:
php-version: '8.3'

- name: Composer install (Unix)
- name: Run setup script
run: bash .github/workflows/tests/environments/setup.sh ${{ secrets.QIT_STAGING_SECRET }} https://stagingcompatibilitydashboard.wpcomstaging.com

- name: Environment Setup and Checks
id: env_setup
run: bash .github/workflows/tests/environments/start-and-assert.sh

- name: Store the environment path in a ENV var
working-directory: src
run: composer install
run: echo "TEMPORARY_ENV=$(php qit-cli.php env:list --field=temporary_env)" >> $GITHUB_ENV

- name: Enable dev mode
- name: Stop a random container from that environment.
working-directory: src
run: php qit-cli.php dev
run: |
CONTAINERS=$(php qit-cli.php env:list --field=docker_images)
RANDOM_CONTAINER=$(echo $CONTAINERS | awk '{print $1}')
echo "Stopping container: $RANDOM_CONTAINER"
docker stop $RANDOM_CONTAINER

- name: Connect to Staging QIT
- name: Run a env:list to trigger the Dangling Environment Cleanup
working-directory: src
run: php qit-cli.php backend:add --environment="staging" --qit_secret="${{ secrets.QIT_STAGING_SECRET }}" --manager_url="https://stagingcompatibilitydashboard.wpcomstaging.com"
run: php qit-cli.php env:list

- name: Add "qit.test" to hosts file (Linux)
run: sudo echo "127.0.0.1 qit.test" | sudo tee -a /etc/hosts
- name: Environment Cleanup Checks
id: env_cleanup
run: bash .github/workflows/tests/environments/dangling-cleanup-assert.sh

test_delete_environment_entry:
runs-on: ubuntu-latest
env:
NO_COLOR: 1
QIT_DISABLE_ONBOARDING: yes
steps:
- name: Checkout code (Cross-platform)
uses: actions/checkout@v4

- name: Start environment
- name: Setup PHP (Cross-platform)
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Run setup script
run: bash .github/workflows/tests/environments/setup.sh ${{ secrets.QIT_STAGING_SECRET }} https://stagingcompatibilitydashboard.wpcomstaging.com

- name: Environment Setup and Checks
id: env_setup
run: bash .github/workflows/tests/environments/start-and-assert.sh

- name: Find and delete all hidden JSON files in the directory
working-directory: src
run: php qit-cli.php env:up
run: php qit-cli.php cache delete environment_monitor

- name: Test Site Up
run: |
# Fetch the site URL
SITE_URL=$(php qit-cli.php env:list --field=site_url)
echo "Site URL: $SITE_URL"

# Assert home page is 200
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" $SITE_URL)
if [ "$HTTP_STATUS" -ne 200 ]; then
echo "Home page is not up. HTTP status: $HTTP_STATUS"
exit 1
fi
echo "Home page is up. HTTP status: $HTTP_STATUS"

# Assert the name property in the JSON response
JSON_RESPONSE=$(curl -s $SITE_URL/wp-json)
NAME_PROPERTY=$(echo $JSON_RESPONSE | jq -r '.name')
if [ "$NAME_PROPERTY" != "WooCommerce Core E2E Test Suite" ]; then
echo "Name property does not match. Found: $NAME_PROPERTY"
exit 1
fi
echo "Name property matches: $NAME_PROPERTY"
- name: Run a env:list to trigger the Dangling Environment Cleanup
working-directory: src
run: php qit-cli.php env:list

- name: Environment Cleanup Checks
id: env_cleanup
run: bash .github/workflows/tests/environments/dangling-cleanup-assert.sh
52 changes: 15 additions & 37 deletions .github/workflows/qit-environment-test-linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: QIT Environment Test - Linux and Mac
name: QIT Environment Test - Linux

on:
# Every day at 11pm UTC (6pm ET)
Expand All @@ -8,19 +8,17 @@ on:
workflow_dispatch:

jobs:
environment_tests:
linux_environment_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, macos-13 ]
os: [ ubuntu-20.04 ]
php: [ '7.4' ]
wordpress: [ 'rc' ]
woocommerce: [ 'rc' ]
include:
- os: ubuntu-20.04
php: '8.3'
wordpress: 'rc'
woocommerce: 'rc'
fail-fast: false
env:
NO_COLOR: 1
Expand All @@ -34,26 +32,13 @@ jobs:
with:
php-version: '8.3'

- name: Enable dev mode (Cross-platform)
- name: Enable dev mode
run: ./qit dev

- name: Connect to Staging QIT (Cross-platform)
- name: Connect to Staging QIT
run: ./qit backend:add --environment="staging" --qit_secret="${{ secrets.QIT_STAGING_SECRET }}" --manager_url="https://stagingcompatibilitydashboard.wpcomstaging.com"

- name: Add "qit.test" to hosts file (Linux)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13'
run: sudo echo "127.0.0.1 qit.test" | sudo tee -a /etc/hosts

- name: Setup Docker on macOS (Mac)
if: matrix.os == 'macos-13'
uses: douglascamata/setup-docker-macos-action@v1-alpha

- name: Check Colima Status (Mac)
if: matrix.os == 'macos-13'
run: colima status

- name: Debug Docker and Docker Compose (Unix)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13'
- name: Debug Docker and Docker Compose
run: |
echo "Checking Docker version..."
docker --version || echo "Docker is not installed"
Expand All @@ -64,24 +49,19 @@ jobs:
echo "Checking Docker Compose (standalone) version..."
docker-compose --version || echo "Docker Compose (standalone) is not installed"

- name: Benchmark Docker (Unix)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13'
- name: Benchmark Docker
working-directory: scripts
run: docker run -v $GITHUB_WORKSPACE/scripts:/scripts -w /scripts alpine sh -c "apk add --no-cache bash wget tar; chmod +x benchmark.sh; ./benchmark.sh"

- name: Composer install (Unix)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13'
- name: Composer install
working-directory: src
run: composer install

- name: Start environment (Unix)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13'
- name: Start environment
working-directory: src
env:
QIT_DOCKER_RUN_TIMEOUT: ${{ (matrix.os == 'ubuntu-20.04') && '300' || '1800' }}
run: php qit-cli.php env:up --wordpress_version ${{ matrix.wordpress }} --woocommerce_version ${{ matrix.woocommerce }} --php_version ${{ matrix.php }}
run: php qit-cli.php env:up --wordpress_version ${{ matrix.wordpress }} --php_version ${{ matrix.php }}

- name: Get URL (Cross-platform)
- name: Get URL
working-directory: src
run: |
siteUrl=$(php -r "echo exec(PHP_BINARY . ' qit-cli.php env:list --field=site_url');");
Expand All @@ -91,7 +71,7 @@ jobs:
run: |
php -r "echo 'Site URL: ' . getenv('SITE_URL');"

- name: Test Site Up (Cross-platform)
- name: Test Site Up
run: |
php -r "
\$url = '${{ env.SITE_URL }}';
Expand All @@ -105,17 +85,15 @@ jobs:
exit(1);
}"

- name: Query WP JSON (Cross-platform)
- name: Query WP JSON
run: php -r "echo file_get_contents('${{ env.SITE_URL }}/wp-json');"

- name: Verify PHP Version (Unix)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13'
- name: Verify PHP Version
working-directory: src
run: |
actual_major_minor=$(docker exec $(php qit-cli.php env:list --field=docker_images | grep php) php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
[[ "$actual_major_minor" == "${{ matrix.php }}" ]] || { echo "PHP Major.Minor version mismatch. Expected: ${{ matrix.php }}, Actual: $actual_major_minor"; exit 1; }

- name: Print WordPress Version (Unix)
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13'
- name: Print WordPress Version
working-directory: src
run: php qit-cli.php env:exec "wp core version"
Loading