ci: add security check on quality workflow #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Quality checks" | |
on: | |
push: | |
branches: [ "*" ] | |
pull_request: | |
branches: [ "*" ] | |
jobs: | |
quality_check: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Setup PHP, extensions and composer with shivammathur/setup-php" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, ctype, iconv, intl | |
env: | |
update: true | |
- name: "Check PHP Version" | |
run: php -v | |
- name: "Validate composer.json and composer.lock" | |
run: composer validate --strict | |
- name: "Cache Composer packages" | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: "Install Dependencies" | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --ignore-platform-reqs | |
- name: "Coding Style validation with ECS" | |
run: vendor/bin/ecs --no-progress-bar | |
- name: "Static Code validation with PHPStan" | |
run: vendor/bin/phpstan analyse --no-progress | |
- name: "Run PHPUnit tests" | |
run: bin/phpunit --testsuite=All --coverage-clover=coverage.xml | |
- name: "SonarCloud Scan" | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
security_check: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Create SBOM | |
uses: anchore/sbom-action@v0 | |
with: | |
format: spdx-json | |
output-file: "${{ github.event.repository.name }}-sbom.spdx.json" | |
- name: Scan SBOM | |
uses: anchore/scan-action@v3 | |
with: | |
sbom: "${{ github.event.repository.name }}-sbom.spdx.json" | |
fail-build: true | |
severity-cutoff: critical |