Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Merge pull request #2403 from liberu-genealogy/dependabot/composer/co… #1794

Merge pull request #2403 from liberu-genealogy/dependabot/composer/co…

Merge pull request #2403 from liberu-genealogy/dependabot/composer/co… #1794

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
deployment:
workflow_dispatch:
env:
DB_DATABASE: liberu
DB_USERNAME: liberu
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@v4
- uses: actions/setup-node@v4
with:
node-version: '14'
- uses: borales/actions-yarn@v4
with:
cmd: install
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- 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-liberu/core/stubs
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: resources
path: |
public/css/
public/js/
public/images/
resources/views
phpunit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: 'PhpUnit'
run: |
sudo composer install
sudo php artisan test
phpcpd:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- 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@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- 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@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- 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@v4
- 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.2'
- 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@v4
- name: 'Trig envoyer'
run: |
curl ${{ secrets.DEPLOY_WEBHOOK }}
docker:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: liberu/genealogy-backend
-
# Setting up Docker Buildx with docker-container driver is required
# at the moment to be able to use a subdirectory with Git context
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
# context: "{{defaultContext}}:.docker/prod/app/"
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}