-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Travis CI with GitHub Actions (#193)
* Add PHPUnit GitHub workflow * Add lint GitHub workflow * Add dependabot.yml
- Loading branch information
Showing
5 changed files
with
190 additions
and
88 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,20 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
time: "04:00" | ||
timezone: "Europe/Zurich" | ||
open-pull-requests-limit: 10 | ||
reviewers: | ||
- "ocean90" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
time: "04:00" | ||
timezone: "Europe/Zurich" | ||
open-pull-requests-limit: 10 | ||
reviewers: | ||
- "ocean90" |
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,54 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.4" | ||
coverage: none | ||
tools: composer, cs2pr | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Get Composer home directory | ||
id: composer-home | ||
run: | | ||
echo "::set-output name=dir::$(composer config home)" | ||
- name: Cache PHP dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install PHP dependencies | ||
run: | | ||
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader | ||
composer global require ergebnis/composer-normalize | ||
echo "${PWD}/vendor/bin" >> $GITHUB_PATH | ||
echo "${{ steps.composer-home.outputs.dir }}/vendor/bin" >> $GITHUB_PATH | ||
- name: Lint PHP files | ||
run: phpcs -q --report=checkstyle | cs2pr | ||
|
||
- name: Analyze PHP files | ||
run: composer run-script analyze | ||
|
||
- name: Lint composer.json | ||
run: composer normalize --dry-run |
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,116 @@ | ||
name: PHPUnit | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
phpunit: | ||
name: PHPUnit (PHP ${{ matrix.php }}, WordPress ${{ matrix.wordpress }}, GlotPress ${{ matrix.glotpress }}) | ||
runs-on: ${{ matrix.os }} | ||
continue-on-error: ${{ matrix.experimental }} | ||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
ports: | ||
- 3306/tcp | ||
env: | ||
MYSQL_ROOT_PASSWORD: password | ||
# Set health checks to wait until mysql has started | ||
options: >- | ||
--health-cmd "mysqladmin ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 3 | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
php: [ '7.4', '7.3', '7.2' ] | ||
wordpress: [ 'latest', 'nightly' ] | ||
glotpress: [ 'develop' ] | ||
experimental: [ false ] | ||
include: | ||
# - php: '8.0' | ||
# os: ubuntu-latest | ||
# experimental: true | ||
- os: ubuntu-latest | ||
php: '7.4' | ||
wordpress: 'latest' | ||
glotpress: 'develop' | ||
experimental: false | ||
coverage: true | ||
- os: ubuntu-latest | ||
php: '7.1' | ||
wordpress: 'latest' | ||
glotpress: 'latest' | ||
experimental: false | ||
- os: ubuntu-latest | ||
php: '7.1' | ||
wordpress: 'nightly' | ||
glotpress: 'latest' | ||
experimental: false | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set PHP_COVERAGE | ||
run: | | ||
if [ ${{ matrix.coverage }} == 'true' ]; then | ||
echo "PHP_COVERAGE=xdebug" >> $GITHUB_ENV | ||
else | ||
echo "PHP_COVERAGE=none" >> $GITHUB_ENV | ||
fi | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: ${{ env.PHP_COVERAGE }} | ||
tools: composer | ||
|
||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache PHP dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install WP-CLI | ||
run: | | ||
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | ||
chmod +x wp-cli.phar | ||
mkdir -p bin | ||
mv wp-cli.phar bin/wp | ||
echo "WP_CLI_BIN_DIR=${PWD}/bin" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: | | ||
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader | ||
echo "${PWD}/vendor/bin" >> $GITHUB_PATH | ||
- name: Install WordPress test setup | ||
env: | ||
WP_VERSION: ${{ matrix.wordpress }} | ||
GP_VERSION: ${{ matrix.glotpress }} | ||
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: bash bin/install-wp-tests.sh wordpress_test root password "127.0.0.1:$MYSQL_PORT" "$WP_VERSION" "$GP_VERSION" | ||
|
||
- name: Setup problem matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Run tests | ||
run: composer run-script test | ||
|
||
- name: Upload coverage to Codecov | ||
if: ${{ matrix.coverage }} | ||
uses: codecov/codecov-action@v1 |
This file was deleted.
Oops, something went wrong.