-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from adnweedon/githubActions
Start moving CI from Travis to GitHub Actions
- Loading branch information
Showing
2 changed files
with
74 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- gh-pages | ||
- "**" | ||
|
||
jobs: | ||
test: | ||
name: PHP Test Matrix | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CC_TEST_REPORTER_ID: a706e45a0731ff71fe03470fefba2e1469a856018f131d0aee0be3f26ec4fc16 | ||
|
||
strategy: | ||
matrix: | ||
php-version: [7.1, 7.2, 7.3] | ||
setup: [basic] | ||
include: | ||
- php-version: nightly | ||
setup: nightly | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: composer | ||
|
||
- name: Cache/Restore Composer | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.composer/cache | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Install Dependencies | ||
run: | | ||
if [ "${{ matrix.setup }}" == "nightly" ]; then | ||
composer update --prefer-dist --no-interaction --no-suggest --ignore-platform-reqs; | ||
elif [ "${{ matrix.setup }}" == "basic" ]; then | ||
composer update --prefer-dist --prefer-stable --no-interaction --no-suggest; | ||
fi | ||
- name: Download Code Climate Test Reporter | ||
run: | | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
chmod +x ./cc-test-reporter | ||
./cc-test-reporter before-build | ||
- name: Run Tests | ||
run: vendor/bin/phpunit --coverage-clover=coverage.xml --coverage-text --log-junit test-results.xml | ||
|
||
- name: Upload Test Results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "${{ matrix.php-version }}-phpunit-results" | ||
path: test-results.xml | ||
if: ${{ always() }} | ||
|
||
- name: Upload Coverage to Codecov | ||
if: success() | ||
run: bash <(curl -s https://codecov.io/bash) | ||
|
||
- name: Finalize Code Climate Report | ||
run: | | ||
cp coverage.xml clover.xml | ||
EXIT_CODE=$([ "${{ steps.test.outcome }}" == "success" ] && echo 0 || echo 1) | ||
./cc-test-reporter after-build --coverage-input-type clover --exit-code $EXIT_CODE |
This file was deleted.
Oops, something went wrong.