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

chore: remove sonar #96

chore: remove sonar

chore: remove sonar #96

Workflow file for this run

name: CICD
on:
push:
branches:
- main
- develop
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: xdebug
env:
update: true
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: |
composer self-update
composer install --no-interaction --no-progress
yarn install --non-interactive
- name: Execute lint
run: yarn lint
- name: Build JS
run: yarn build
- name: Execute tests
run: vendor/bin/phpunit -c phpunit.xml.dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Production - Build and push PHP FPM
id: docker_build_php
uses: docker/build-push-action@v2
if: github.ref == 'refs/heads/main'
with:
file: ./docker/production/Dockerfile-phpfpmalpine
build-args: MIX_GOOGLE_ANALYTICS_ID=${{ secrets.MIX_GOOGLE_ANALYTICS_ID }}
push: true
tags: paulthebaud/phpunitgen-phpfpm:latest
- name: Production - Build and push Nginx
id: docker_build_nginx
uses: docker/build-push-action@v2
if: github.ref == 'refs/heads/main'
with:
file: ./docker/production/Dockerfile-nginxalpine
build-args: MIX_GOOGLE_ANALYTICS_ID=${{ secrets.MIX_GOOGLE_ANALYTICS_ID }}
push: true
tags: paulthebaud/phpunitgen-nginx:latest
- name: Staging - Build and push PHP FPM
id: docker_build_php_staging
uses: docker/build-push-action@v2
if: github.ref == 'refs/heads/develop'
with:
file: ./docker/staging/Dockerfile-phpfpmalpine
push: true
tags: paulthebaud/phpunitgen-phpfpm:staging
- name: Staging - Build and push Nginx
id: docker_build_nginx_staging
uses: docker/build-push-action@v2
if: github.ref == 'refs/heads/develop'
with:
file: ./docker/staging/Dockerfile-nginxalpine
push: true
tags: paulthebaud/phpunitgen-nginx:staging
- name: Production - Update deployment
uses: steebchen/kubectl@v2.0.0
if: github.ref == 'refs/heads/main'
with:
config: ${{ secrets.KUBE_CONFIG }}
command: apply -k kubernetes/production/
- name: Staging - Update deployment
uses: steebchen/kubectl@v2.0.0
if: github.ref == 'refs/heads/develop'
with:
config: ${{ secrets.KUBE_CONFIG }}
command: apply -k kubernetes/staging/
- name: Production - Restart deployment PHP FPM
uses: steebchen/kubectl@v2.0.0
if: github.ref == 'refs/heads/main'
with:
config: ${{ secrets.KUBE_CONFIG }}
command: rollout restart deployment/phpunitgen-phpfpm --namespace=phpunitgen
- name: Staging - Restart deployment PHP FPM
uses: steebchen/kubectl@v2.0.0
if: github.ref == 'refs/heads/develop'
with:
config: ${{ secrets.KUBE_CONFIG }}
command: rollout restart deployment/phpunitgen-phpfpm-staging --namespace=phpunitgen-staging
- name: Production - Restart deployment Nginx
uses: steebchen/kubectl@v2.0.0
if: github.ref == 'refs/heads/main'
with:
config: ${{ secrets.KUBE_CONFIG }}
command: rollout restart deployment/phpunitgen-nginx --namespace=phpunitgen
- name: Staging - Restart deployment Nginx
uses: steebchen/kubectl@v2.0.0
if: github.ref == 'refs/heads/develop'
with:
config: ${{ secrets.KUBE_CONFIG }}
command: rollout restart deployment/phpunitgen-nginx-staging --namespace=phpunitgen-staging