Skip to content

Commit

Permalink
Merge pull request #5 from the-kbA-team/2-github-actions
Browse files Browse the repository at this point in the history
Switched from Travis to GitHub actions.
  • Loading branch information
gregor-j authored Apr 3, 2024
2 parents eb0336f + 6e319b6 commit 1fcddcb
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 22 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "CI workflow"
on:
# Triggers the workflow on push or pull request events
push:
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: "read"
jobs:

composer:
name: "Composer config validation"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Validate composer.json"
run: "composer validate --strict"

php:
name: "PHP tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php_version:
- "7.2"
- "7.4"
env:
CC_TEST_REPORTER_ID: "c8bc13b8787c6de68ae094688dec7fd7bb3a14445d560194b5785fae2623d489"

steps:
- name: "GIT checkout"
uses: "actions/checkout@v3"

- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php_version }}"
coverage: "xdebug"

- name: "PHP syntax validation"
run: |
php -l src/
php -l tests/
- name: "Get composer cache directory"
id: "composer-cache"
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

- name: "Cache composer dependencies"
uses: "actions/cache@v3"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Composer install dependencies"
run: "composer install --prefer-dist --no-progress"

- name: "CodeClimate Reporter Setup"
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: "PHPUnit tests"
run: |
php vendor/bin/phpunit --coverage-clover clover.xml --coverage-text
export PHPUNIT_EXIT_CODE=$?
- name: "CodeClimate report"
run: "./cc-test-reporter after-build -t clover"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.idea/
/vendor/
/.phpunit.result.cache
/.uuid
/clover.xml
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

0 comments on commit 1fcddcb

Please sign in to comment.