forked from WordPress/wordpress-develop
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Build/Test Tools: Add matrix test for databases
The suitability of databases needs to be tested with CI. Add testing for MySQL and MariaDB on the earliest supported version, and the latest version. MariaDB Testing is also done on their non-released version by using a container image produced from their CI. This image contains reviewed and tested work of the MariaDB developers. This is a good opporunity to catch pre-release regressiosn on their part. This is based off the end to end tests, but now we are applying them across database versions. Docker debug information uses \s to show the client and server information. The MariaDB Testing images also contain /manifest.txt containing the git version of build to report regressions. References: * [https://mariadb.org/new-service-quay-io-mariadb-foundation-mariadb-devel/ MariaDB Blog of quay.io service] Trac ticket:
- Loading branch information
1 parent
39617d8
commit 8a2079f
Showing
3 changed files
with
206 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,202 @@ | ||
| name: Database Compatibility Tests | ||
|
|
||
| on: | ||
| # The database compatiblity test suite was introduced in WordPress 6.1. | ||
| push: | ||
| branches: | ||
| - database_ci | ||
| - trunk | ||
| - '6.[1-9]' | ||
| - '[7-9].[0-9]' | ||
| tags: | ||
| - '[0-9]+.[0-9]' | ||
| - '[0-9]+.[0-9].[0-9]+' | ||
| - '![345].[0-9].[0-9]+' | ||
| - '!6.0.[0-9]+' | ||
| pull_request: | ||
| branches: | ||
| - trunk | ||
| - '6.[1-9]' | ||
| - '[7-9].[0-9]' | ||
| workflow_dispatch: | ||
|
|
||
| # Cancels all previous workflow runs for pull requests that have not completed. | ||
| concurrency: | ||
| # The concurrency group contains the workflow name and the branch name for pull requests | ||
| # or the commit hash for any other events. | ||
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| LOCAL_DIR: build | ||
|
|
||
| jobs: | ||
| wordpress-build: | ||
| name: build wordpress | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - name: Configure environment variables | ||
| run: | | ||
| echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV | ||
| echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV | ||
| - name: Checkout repository | ||
| uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | ||
|
|
||
| - name: Log debug information | ||
| run: | | ||
| npm --version | ||
| node --version | ||
| curl --version | ||
| git --version | ||
| svn --version | ||
| php --version | ||
| php -i | ||
| locale -a | ||
| - name: Install NodeJS | ||
| uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: npm | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build WordPress | ||
| run: npm run build | ||
|
|
||
| - name: Save wordpress image as tarball | ||
| run: docker export --output /tmp/wordpress.tar wordpressdevelop/php | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v2 | ||
| with: | ||
| name: wordpress | ||
| path: /tmp/wordpress.tar | ||
|
|
||
| - name: General debug information | ||
| run: | | ||
| npm --version | ||
| node --version | ||
| curl --version | ||
| git --version | ||
| svn --version | ||
| - name: Docker debug information | ||
| run: | | ||
| docker -v | ||
| docker-compose -v | ||
| 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 | ||
| # Runs the database compatibility test suite. | ||
| # | ||
| # Performs the following steps: | ||
| # - Sets environment variables. | ||
| # - Checks out the repository. | ||
| # - Logs debug information about the GitHub Action runner. | ||
| # - Installs NodeJS. | ||
| # _ 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. | ||
| # - Ensures version-controlled files are not modified or deleted. | ||
| database-tests: | ||
| name: Database Test ${{ matrix.image }} | ||
| runs-on: ubuntu-latest | ||
| needs: [ wordpress-build ] | ||
| timeout-minutes: 10 | ||
| # TODO tmp if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| image: | ||
| - mysql:5.7 | ||
| - mysql:latest | ||
| - mariadb:10.3 | ||
| - mariadb:latest | ||
| - quay.io/mariadb-foundation/mariadb-devel:10.3 | ||
| - quay.io/mariadb-foundation/mariadb-devel:10.11 | ||
|
|
||
| steps: | ||
| - name: Download artifact | ||
| uses: actions/download-artifact@v2 | ||
| with: | ||
| name: wordpress | ||
| path: /tmp | ||
|
|
||
| - name: Load Docker image | ||
| run: | | ||
| docker load --input /tmp/wordpress.tar | ||
| docker image ls -a | ||
| - name: Checkout repository | ||
| uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | ||
|
|
||
| - name: Start Docker environment | ||
| run: | | ||
| export LOCAL_DB_IMAGE=${{ matrix.image }} | ||
| npm run env:start | ||
| - name: Log running Docker containers | ||
| run: docker ps -a | ||
|
|
||
| - name: Docker debug information | ||
| run: | | ||
| docker-compose exec -t mysql mysql -ppassword -e 'select version();' | ||
| docker-compose exec mysql sh -c '[ -f /manifest.txt ] && cat /manifest.txt' | ||
| - name: Install WordPress | ||
| run: npm run env:install | ||
|
|
||
| - name: Run E2E tests | ||
| run: npm run test:e2e | ||
|
|
||
| slack-notifications: | ||
| name: Slack Notifications | ||
| uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk | ||
| needs: [ database-tests ] | ||
| if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} | ||
| with: | ||
| calling_status: ${{ needs.database-tests.result == 'success' && 'success' || needs.database-tests.result == 'cancelled' && 'cancelled' || 'failure' }} | ||
| secrets: | ||
| SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} | ||
| SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} | ||
| SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} | ||
| SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} | ||
|
|
||
| failed-workflow: | ||
| name: Failed workflow tasks | ||
| runs-on: ubuntu-latest | ||
| needs: [ database-tests, slack-notifications ] | ||
| if: | | ||
| always() && | ||
| github.repository == 'WordPress/wordpress-develop' && | ||
| github.event_name != 'pull_request' && | ||
| github.run_attempt < 2 && | ||
| ( | ||
| needs.database-tests.result == 'cancelled' || needs.database-tests.result == 'failure' | ||
| ) | ||
| steps: | ||
| - name: Dispatch workflow run | ||
| uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0 | ||
| with: | ||
| script: | | ||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| workflow_id: 'failed-workflow.yml', | ||
| ref: '${{ github.ref_name }}', | ||
| inputs: { | ||
| run_id: '${{ github.run_id }}' | ||
| } | ||
| }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters