Skip to content

Commit

Permalink
Merge pull request #9 from adnweedon/githubActions
Browse files Browse the repository at this point in the history
Start moving CI from Travis to GitHub Actions
  • Loading branch information
kylekatarnls authored Jan 3, 2025
2 parents e325f21 + f7d82eb commit 0153c34
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 45 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/tests.yaml
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
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

0 comments on commit 0153c34

Please sign in to comment.