From bc41b3f78a4878889e4ff58d587a4edea01818ca Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 3 Apr 2024 09:24:35 +0200 Subject: [PATCH 1/7] add .uuid to git ignore list --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 57baea2..d68fe48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.idea/ /vendor/ /.phpunit.result.cache +/.uuid From d444358c2607f6e7af69110c92f718b581bb572a Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 3 Apr 2024 09:41:42 +0200 Subject: [PATCH 2/7] delete travis config #2 --- .travis.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 81bc69d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: php -os: linux -dist: bionic -php: - - 7.2 - - 7.3 - - 7.4 -env: - global: - - CC_TEST_REPORTER_ID=c8bc13b8787c6de68ae094688dec7fd7bb3a14445d560194b5785fae2623d489 - - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi) -before_script: - - 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 - - composer self-update - - composer install --no-interaction -script: - - vendor/bin/phpunit --coverage-clover clover.xml -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT - From 1aa9668f8445ffdc8956a21443f6a99bd39d19b0 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 3 Apr 2024 09:42:07 +0200 Subject: [PATCH 3/7] add github workflow config #2 --- .github/workflows/main.yml | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cdc9215 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,62 @@ +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: "Check PHP version" + run: "php -v" + + - name: "PHP syntax validation" + run: | + php -l src/ + php -l tests/ + + - 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 + ./cc-test-reporter after-build -t clover --exit-code $? From c7da2001310f3ea8bb2b505e4daacaf256cfc305 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 3 Apr 2024 10:12:22 +0200 Subject: [PATCH 4/7] add clover to git ignore list --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d68fe48..51bfe9b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /vendor/ /.phpunit.result.cache /.uuid +/clover.xml From 5c0a096eb94a35a3878b4acaf3a8c5648b3871bc Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 3 Apr 2024 11:41:16 +0200 Subject: [PATCH 5/7] split code climate reporter from phpunit step #2 --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cdc9215..fe73960 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,4 +59,7 @@ jobs: - name: "PHPUnit tests" run: | php vendor/bin/phpunit --coverage-clover clover.xml --coverage-text - ./cc-test-reporter after-build -t clover --exit-code $? + export PHPUNIT_EXIT_CODE=$? + + - name: "CodeClimate report" + run: "./cc-test-reporter after-build -t clover" From bb106ce0545ff76b30cc8f54d4a6d3fbd1bef797 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 3 Apr 2024 11:45:08 +0200 Subject: [PATCH 6/7] remove PHP version check #2 --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe73960..1edc47d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,9 +39,6 @@ jobs: php-version: "${{ matrix.php_version }}" coverage: "xdebug" - - name: "Check PHP version" - run: "php -v" - - name: "PHP syntax validation" run: | php -l src/ From 6e319b6b6db011fcb815df78f2ca031bee82ff04 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 3 Apr 2024 11:45:20 +0200 Subject: [PATCH 7/7] add composer cache to github action #2 --- .github/workflows/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1edc47d..e7f2513 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,6 +44,19 @@ jobs: 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"