Upgrade/enso6 dr #143
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: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
deployment: | |
workflow_dispatch: | |
env: | |
DB_DATABASE: enso | |
DB_USERNAME: enso | |
DB_PASSWORD: secret | |
jobs: | |
yarn: | |
runs-on: ubuntu-20.04 | |
env: | |
NODE_OPTIONS: --max_old_space_size=3072 | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_URL: ${{ secrets.SENTRY_URL }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: borales/[email protected] | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
- name: 'test node' | |
run: node -v | |
- name: 'install & build' | |
run: | | |
sudo composer install | |
sed -i 's/GOOGLE_ANALITICS_TOKEN/${{ secrets.GOOGLE_ANALITICS_TOKEN }}/g' resources/views/stubs/production-index.blade.stub | |
sudo cp -f resources/views/stubs/production-index.blade.stub vendor/laravel-enso/core/stubs | |
cd client | |
cp .env.example .env | |
yarn install | |
yarn build | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: resources | |
path: | | |
public/css/ | |
public/js/ | |
public/images/ | |
resources/views | |
phpunit: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
- name: 'PhpUnit' | |
run: | | |
sudo composer install | |
sudo php artisan test | |
phpcpd: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
- name: 'Run Phpcpd' | |
run: | | |
sudo composer install | |
sudo test -f phpcpd.phar || curl -L https://phar.phpunit.de/phpcpd.phar -o phpcpd.phar | |
sudo php phpcpd.phar app/ | |
php-insights: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
- name: 'Run php-insight' | |
run: | | |
sudo composer install | |
sudo php artisan insights --min-quality=90 --min-complexity=90 --min-architecture=80 --min-style=90 --no-interaction | |
security: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
- name: 'Run php-insight' | |
run: | | |
PHP_SC_VERSION=$(curl -s "https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/;s/^v//') | |
curl -LSs https://github.com/fabpot/local-php-security-checker/releases/download/v${PHP_SC_VERSION}/local-php-security-checker_${PHP_SC_VERSION}_linux_amd64 > ./php-security-checker | |
chmod +x ./php-security-checker | |
unset PHP_SC_VERSION | |
./php-security-checker | |
migration: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: mirromutth/[email protected] | |
with: | |
mysql database: ${{env.DB_DATABASE}} | |
mysql user: ${{env.DB_USERNAME}} | |
mysql password: ${{env.DB_PASSWORD}} | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
- name: 'Run migration' | |
run: | | |
sudo composer install | |
php artisan migrate --force | |
deploy: | |
runs-on: ubuntu-20.04 | |
if: ${{ github.event_name == 'deployment' || github.event_name == 'push' }} | |
needs: [phpunit, phpcpd, migration, yarn, security, php-insights] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 'Trig envoyer' | |
run: | | |
curl ${{ secrets.DEPLOY_WEBHOOK }} |