From 924ee80d3e3e5c1d666cbeb70e637a30e3af214d Mon Sep 17 00:00:00 2001 From: Thomas Shone Date: Mon, 18 Dec 2023 01:01:05 +0100 Subject: [PATCH] Added github actions to run phpunit tests (#378) The ci.yml is configured to run the phpunit tests on any push to the repository. This will run the tests for a matrix of PHP versions to ensure all major versions supported are properly tests. In addition, if the tests all pass, code coverage for the tests will be generated and uploaded as an artifact of the run so they can be downloaded and examined. To support this I needed to specify which directories to be included in the code coverage in the phpunit.xml file. --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ phpunit.xml | 5 +++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b0822cd2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: [push] + +jobs: + build-test: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: + - 5.4 + - 5.5 + - 5.6 + - 7.2 + - 7.3 + - 7.4 + - 8.2 + - 8.3 + - nightly + + steps: + - uses: actions/checkout@v3 + + - uses: php-actions/composer@v6 + + - name: PHPUnit Tests + uses: php-actions/phpunit@master + env: + XDEBUG_MODE: coverage + with: + php_extensions: "xdebug" + coverage_html: "coverage/html/" + version: 9.5 + bootstrap: tests/bootstrap.php + configuration: phpunit.xml + + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + with: + name: code-coverage-report + path: coverage/html \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml index 3183df81..69b41d69 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,4 +8,9 @@ tests + + + ./src + +