Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 116 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,110 @@
name: CI

on: [push]
on: [push, pull_request]

permissions:
contents: read
actions: read
id-token: none

jobs:
composer:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.1, 8.2, 8.3, 8.4, 8.5 ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache Composer dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}

- uses: php-actions/composer@v6
- name: Composer install
uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php }}

- name: Archive build
run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
run: mkdir /tmp/github-actions/ && tar --exclude=".git" -cvf /tmp/github-actions/build.tar ./

- name: Upload build archive for test runners
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-artifact
name: build-artifact-${{ matrix.php }}
path: /tmp/github-actions
retention-days: 1

phpunit:
runs-on: ubuntu-latest
needs: [composer]
needs: [ composer ]
strategy:
matrix:
php: [ 8.1, 8.2, 8.3, 8.4, 8.5 ]

outputs:
coverage: ${{ steps.store-coverage.outputs.coverage_text }}

steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: build-artifact
name: build-artifact-${{ matrix.php }}
path: /tmp/github-actions

- name: Extract build archive
run: tar -xvf /tmp/github-actions/build.tar ./

- name: PHP Unit tests
uses: php-actions/phpunit@v3
uses: php-actions/phpunit@v4
env:
XDEBUG_MODE: cover
with:
php_version: 8.0
php_version: ${{ matrix.php }}
php_extensions: xdebug
configuration: test/phpunit/phpunit.xml
bootstrap: vendor/autoload.php
coverage_text: _coverage/coverage.txt
coverage_clover: _coverage/clover.xml

- name: Store coverage data
uses: actions/upload-artifact@v4
with:
name: code-coverage-${{ matrix.php }}-${{ github.run_number }}
path: _coverage

coverage:
runs-on: ubuntu-latest
needs: [ phpunit ]
strategy:
matrix:
php: [ 8.1, 8.2, 8.3, 8.4, 8.5 ]

steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: code-coverage-${{ matrix.php }}-${{ github.run_number }}
path: _coverage

- name: Output coverage
run: cat "_coverage/coverage.txt"

- name: Upload to Codecov
uses: codecov/codecov-action@v5

phpstan:
runs-on: ubuntu-latest
needs: [composer]
needs: [ composer ]
strategy:
matrix:
php: [ 8.1, 8.2, 8.3, 8.4, 8.5 ]

steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: build-artifact
name: build-artifact-${{ matrix.php }}
path: /tmp/github-actions

- name: Extract build archive
Expand All @@ -63,5 +113,52 @@ jobs:
- name: PHP Static Analysis
uses: php-actions/phpstan@v3
with:
php_version: ${{ matrix.php }}
path: src/

phpmd:
runs-on: ubuntu-latest
needs: [ composer ]
strategy:
matrix:
php: [ 8.1, 8.2, 8.3, 8.4, 8.5 ]

steps:
- uses: actions/download-artifact@v4
with:
name: build-artifact-${{ matrix.php }}
path: /tmp/github-actions

- name: Extract build archive
run: tar -xvf /tmp/github-actions/build.tar ./

- name: PHP Mess Detector
uses: php-actions/phpmd@v1
with:
php_version: ${{ matrix.php }}
path: src/
output: text
ruleset: phpmd.xml

phpcs:
runs-on: ubuntu-latest
needs: [ composer ]
strategy:
matrix:
php: [ 8.1, 8.2, 8.3, 8.4, 8.5 ]

steps:
- uses: actions/download-artifact@v4
with:
name: build-artifact-${{ matrix.php }}
path: /tmp/github-actions

- name: Extract build archive
run: tar -xvf /tmp/github-actions/build.tar ./

- name: PHP Code Sniffer
uses: php-actions/phpcs@v1
with:
php_version: ${{ matrix.php }}
path: src/
level: 6
standard: phpcs.xml
32 changes: 0 additions & 32 deletions .scrutinizer.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ The `CipherText` class also exposes a `getUri()` function, for creating a pre-en
<a href="https://github.com/PhpGt/Cipher/actions" target="_blank">
<img src="https://badge.status.php.gt/cipher-build.svg" alt="Build status" />
</a>
<a href="https://scrutinizer-ci.com/g/PhpGt/Cipher" target="_blank">
<a href="https://app.codacy.com/gh/PhpGt/Cipher" target="_blank">
<img src="https://badge.status.php.gt/cipher-quality.svg" alt="Code quality" />
</a>
<a href="https://scrutinizer-ci.com/g/PhpGt/Cipher" target="_blank">
<a href="https://app.codecov.io/gh/PhpGt/Cipher" target="_blank">
<img src="https://badge.status.php.gt/cipher-coverage.svg" alt="Code coverage" />
</a>
<a href="https://packagist.org/packages/PhpGt/Cipher" target="_blank">
Expand Down
19 changes: 17 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"phpgt/http": "v1.*"
},
"require-dev": {
"phpstan/phpstan": "^v1.8 || ^2.0",
"phpunit/phpunit": "^v9.5"
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^10.5",
"phpmd/phpmd": "^2.13",
"squizlabs/php_codesniffer": "^3.7"
},
"autoload": {
"psr-4": {
Expand All @@ -22,6 +24,19 @@
}
},

"scripts": {
"phpunit": "vendor/bin/phpunit --configuration phpunit.xml",
"phpstan": "vendor/bin/phpstan analyse --level 6 src",
"phpcs": "vendor/bin/phpcs src --standard=phpcs.xml",
"phpmd": "vendor/bin/phpmd src/ text phpmd.xml",
"test": [
"@phpunit",
"@phpstan",
"@phpcs",
"@phpmd"
]
},

"authors": [
{
"name": "Greg Bowler",
Expand Down
Loading
Loading