Merge pull request #129 from johanvanhelden/develop #323
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code-analysis: | |
name: Code Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Up PHP and Tools | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: '8.3' | |
tools: composer:v2 | |
coverage: none | |
- name: Install Composer Dependencies | |
run: make vendor | |
- name: Static Code Analysis | |
run: make stan | |
code-style: | |
name: Code Style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Up PHP and Tools | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: '8.3' | |
tools: composer:v2, phpcs, php-cs-fixer, phpmd | |
coverage: none | |
- name: Syntax Errors | |
run: make syntax | |
- name: PHP_CodeSniffer | |
run: make cs | |
- name: PHP-CS-Fixer | |
run: make cs-fix-dry | |
- name: PHPMD | |
run: make md | |
- name: Install NPM | |
run: make node_modules | |
- name: Validate Assets | |
run: make validate-fe | |
security-check: | |
name: Security Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check Composer Packages | |
uses: symfonycorp/security-checker-action@v5 | |
- name: Check NPM Packages | |
run: make audit | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Up PHP and Tools | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: '8.3' | |
extensions: bz2, bcmath, curl, exif, gd, imagick, imap, intl, mysqli, pcntl, pcov, pdo_mysql, redis, soap, xmlrpc, xsl, zip, iconv, pdo | |
tools: composer:v2 | |
coverage: pcov | |
- name: Install Composer Dependencies | |
run: make vendor | |
- name: Install NPM | |
run: make node_modules | |
- name: Build Assets | |
run: make assets | |
- name: Test and Coverage | |
run: make test-coverage | |
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] | |
steps: | |
- uses: actions/checkout@v4 | |
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] | |
steps: | |
- uses: actions/checkout@v4 | |
- 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] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Trigger Forge Production Webhook | |
run: | | |
[ -n "${{ secrets.FORGE_WEBHOOK_PRODUCTION }}" ] && curl "${{ secrets.FORGE_WEBHOOK_PRODUCTION }}" || echo "No deploy webhook set" |