-
Notifications
You must be signed in to change notification settings - Fork 32
feat: move to Github actions #356
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - main | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - php: '7.4' | ||
| env: | ||
| PHPCS: '1' | ||
| name: 'PHP 7.4 Lint' | ||
| - php: '8.2' | ||
| env: | ||
| PHPUNIT_VERSION: '9.6.7' | ||
| WP: 'latest' | ||
| name: 'PHP 8.2 / WP latest' | ||
| - php: '8.1' | ||
| env: | ||
| PHPUNIT_VERSION: '9.6.7' | ||
| WP: 'latest' | ||
| name: 'PHP 8.1 / WP latest' | ||
| - php: '8.0' | ||
| env: | ||
| PHPUNIT_VERSION: '9.6.7' | ||
| WP: 'latest' | ||
| name: 'PHP 8.0 / WP latest' | ||
| - php: '7.4' | ||
| env: | ||
| PHPUNIT_VERSION: '7.5.20' | ||
| WP: 'latest' | ||
| name: 'PHP 7.4 / WP latest' | ||
| - php: '7.3' | ||
| env: | ||
| PHPUNIT_VERSION: '7.5.20' | ||
| WP: 'latest' | ||
| name: 'PHP 7.3 / WP latest' | ||
| - php: '7.2' | ||
| env: | ||
| PHPUNIT_VERSION: '7.5.20' | ||
| WP: 'latest' | ||
| name: 'PHP 7.2 / WP latest' | ||
| - php: '7.1' | ||
| env: | ||
| PHPUNIT_VERSION: '7.5.20' | ||
| WP: '6.5.5' | ||
| name: 'PHP 7.1 / WP 6.5.5' | ||
| - php: '7.0' | ||
| env: | ||
| PHPUNIT_VERSION: '6.5.14' | ||
| WP: '6.5.5' | ||
| name: 'PHP 7.0 / WP 6.5.5' | ||
| - php: '5.6' | ||
| env: | ||
| PHPUNIT_VERSION: '5.7.27' | ||
| WP: '6.2.2' | ||
| name: 'PHP 5.6 / WP 6.2.2' | ||
|
|
||
| name: ${{ matrix.name }} | ||
|
|
||
| services: | ||
| mysql: | ||
| image: mysql:5.7 | ||
| env: | ||
| MYSQL_ROOT_PASSWORD: root | ||
| ports: | ||
| - 3306:3306 | ||
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| extensions: mysql, mysqli, pdo, pdo_mysql, zip, libonig5 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CRITICAL_BUG] The extensions: mysqli, pdo_mysql, zip, mbstring |
||
| coverage: none | ||
| tools: composer:v2 | ||
|
|
||
| - name: Install subversion | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y subversion | ||
|
|
||
| - name: Install dependencies (PHPCS) | ||
| if: matrix.env.PHPCS == '1' | ||
| run: | | ||
| cd tests | ||
| composer install | ||
|
|
||
| - name: Run PHPCS | ||
| if: matrix.env.PHPCS == '1' | ||
| run: tests/vendor/bin/phpcs | ||
|
|
||
| - name: Setup Test Environment | ||
| if: matrix.env.PHPCS != '1' | ||
| env: | ||
| PHPUNIT_VERSION: ${{ matrix.env.PHPUNIT_VERSION }} | ||
| WP_VERSION: ${{ matrix.env.WP }} | ||
| run: | | ||
| # Install WP Tests | ||
| bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:$((3306)) $WP_VERSION | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [VALIDATION] The call to bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 $WP_VERSION |
||
|
|
||
| # Install PHPUnit | ||
| wget -q https://phar.phpunit.de/phpunit-$PHPUNIT_VERSION.phar -O /tmp/phpunit | ||
| chmod +x /tmp/phpunit | ||
|
|
||
|
Comment on lines
+114
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [REFACTORING] Downloading phpunit via |
||
| - name: Install Polyfills | ||
| if: matrix.env.PHPCS != '1' | ||
| run: composer require yoast/phpunit-polyfills | ||
|
|
||
|
Comment on lines
+118
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CRITICAL_BUG] Running |
||
| - name: Run Tests | ||
| if: matrix.env.PHPCS != '1' | ||
| run: | | ||
| /tmp/phpunit | ||
| WP_MULTISITE=1 /tmp/phpunit | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ https://core.trac.wordpress.org/ticket/44043 | |
|
|
||
| # Travis CI Status | ||
|
|
||
| [](https://app.travis-ci.com/github/CybotAS/CookiebotWP) | ||
| [](https://github.com/CybotAS/CookiebotWP/actions/workflows/test.yml) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [NITPICK] You replaced the Travis badge with a generic GitHub Actions badge titled [](https://github.com/CybotAS/CookiebotWP/actions/workflows/test.yml)Or, update the workflow name in name: CI / Tests |
||
|
|
||
| # Sonarcloud status | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CRITICAL_BUG] Mapping the MySQL service to host port
3306:3306can cause port conflicts on the runner and is unnecessary for service containers in GitHub Actions. Remove theports:mapping and rely on the service network (uselocalhostor the service hostname provided by Actions). Also confirm the--health-cmdworks for the image used; if you need stricter health checks prefer--health-cmd='mysqladmin ping -p$MYSQL_ROOT_PASSWORD'or rely on built-in images' defaults.