Bump phpunit/phpunit from 10.3.1 to 10.4.2 #312
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: Continuous Integration | |
on: push | |
jobs: | |
code-analysis: | |
name: Code Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Up PHP and Tools | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: "8.1" | |
tools: composer:v2 | |
coverage: none | |
- name: Install Composer Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Static Code Analysis | |
run: ./vendor/bin/phpstan analyse --memory-limit=2G | |
code-style: | |
name: Code Style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Up PHP and Tools | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: "8.1" | |
tools: composer:v2, phpcs, php-cs-fixer, phpmd, phpcpd | |
coverage: none | |
- name: Install NPM | |
run: npm ci | |
- name: Syntax Errors | |
run: find app config lang routes tests -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | |
- name: PHP_CodeSniffer | |
run: phpcs | |
- name: PHP-CS-Fixer | |
run: php-cs-fixer fix app config lang routes tests --dry-run --diff --allow-risky=yes --config=.php-cs-fixer.php | |
- name: PHPMD | |
run: phpmd app text phpmd.xml | |
- name: PHPCPD | |
run: phpcpd app | |
- name: Check Assets | |
run: npm run check | |
security-check: | |
name: Security Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check Composer Packages | |
uses: symfonycorp/security-checker-action@v4 | |
- name: Check NPM Packages | |
run: npm audit --production | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Up PHP and Tools | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: "8.1" | |
extensions: bz2, bcmath, curl, exif, gd, imagick, imap, intl, mysqli, pcntl, pcov, pdo_mysql, soap, xmlrpc, xsl, zip, iconv, pdo | |
tools: composer:v2 | |
coverage: pcov | |
- name: Install Composer Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Install NPM | |
run: npm ci | |
- name: Setup PHPUnit Environment | |
run: yes | cp .env.testing.example .env | |
- name: Build Assets | |
run: ./buildHook.sh $PWD | |
- name: Run Tests & Generate Coverage Report | |
run: ./vendor/bin/phpunit --coverage-clover ./coverage.xml | |
- name: Check Test Coverage | |
uses: johanvanhelden/gha-clover-test-coverage-check@v1 | |
with: | |
percentage: "95" | |
filename: "coverage.xml" | |
dusk: | |
name: Dusk | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: tests_db | |
ports: | |
- 13306:3306 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Initialize the Database | |
run: | | |
sudo systemctl start mysql | |
mysql --user="root" --password="root" -e "CREATE DATABASE tests_db character set UTF8mb4 collate utf8mb4_bin;" | |
- name: Set Up PHP and Tools | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: "8.1" | |
extensions: bz2, bcmath, curl, exif, gd, imagick, imap, intl, mysqli, pcntl, pcov, pdo_mysql, soap, xmlrpc, xsl, zip, iconv, pdo | |
tools: composer:v2 | |
coverage: pcov | |
- name: Install Composer Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Build Assets | |
run: ./buildHook.sh $PWD | |
- name: Setup Dusk Environment | |
run: yes | cp .env.dusk.local.example .env | |
- name: Set the Chrome Driver | |
run: php artisan dusk:chrome-driver --detect | |
- name: Start Chrome Driver | |
run: ./vendor/laravel/dusk/bin/chromedriver-linux & | |
- name: Start Server | |
run: php artisan serve --no-reload & | |
- name: Run Dusk | |
run: composer test-browser | |
env: | |
APP_URL: "http://127.0.0.1:8000" | |
- name: Upload Dusk Artifacts | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: Dusk Artifacts | |
path: | | |
./tests/Browser/screenshots | |
./tests/Browser/console | |
./storage/logs | |
sentry-release: | |
name: Sentry Release | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'merged')) | |
needs: [code-analysis, code-style, security-check, tests, dusk] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create a Sentry Release | |
uses: getsentry/action-release@v1.0.1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_ORG: johan-van-helden | |
with: | |
environment: production | |
deploy-staging: | |
name: Deploy Staging | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'merged')) | |
needs: [code-analysis, code-style, security-check, tests, dusk] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Trigger Forge Staging Webhook | |
run: | | |
[ -n "${{ secrets.FORGE_WEBHOOK_STAGING }}" ] && curl "${{ secrets.FORGE_WEBHOOK_STAGING }}" || echo "No deploy webhook set" | |
deploy-production: | |
name: Deploy Production | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'merged')) | |
needs: [code-analysis, code-style, security-check, tests, dusk] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Trigger Forge Production Webhook | |
run: | | |
[ -n "${{ secrets.FORGE_WEBHOOK_PRODUCTION }}" ] && curl "${{ secrets.FORGE_WEBHOOK_PRODUCTION }}" || echo "No deploy webhook set" |