2020-05-20 13:37:22 +02:00
|
|
|
name: PHP Code Testing
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-03-19 22:35:37 +01:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- 'releases/**'
|
|
|
|
- 'feat_**'
|
2021-04-16 22:53:27 +02:00
|
|
|
- staging
|
|
|
|
- production
|
2020-05-20 13:37:22 +02:00
|
|
|
pull_request:
|
2021-04-25 22:42:44 +02:00
|
|
|
workflow_dispatch:
|
2020-05-20 13:37:22 +02:00
|
|
|
|
|
|
|
jobs:
|
2020-05-20 20:39:25 +02:00
|
|
|
tests:
|
2021-04-20 15:40:43 +02:00
|
|
|
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
|
2020-05-20 20:40:56 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-05-20 20:37:53 +02:00
|
|
|
strategy:
|
2020-09-13 13:03:26 +02:00
|
|
|
matrix:
|
2021-12-24 18:16:23 +01:00
|
|
|
php-versions: ['8.0']
|
2020-12-19 18:47:47 +01:00
|
|
|
name: Testing ${{ matrix.php-versions }}
|
2020-05-20 13:37:22 +02:00
|
|
|
steps:
|
2020-09-13 13:08:39 +02:00
|
|
|
- name: Checkout
|
2023-09-04 16:56:29 +02:00
|
|
|
uses: actions/checkout@v4
|
2020-09-13 13:08:39 +02:00
|
|
|
|
2020-05-26 09:35:09 +02:00
|
|
|
- name: Dump GitHub context
|
2020-05-26 09:24:26 +02:00
|
|
|
env:
|
|
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
|
|
run: echo "$GITHUB_CONTEXT"
|
|
|
|
|
2020-05-20 20:37:53 +02:00
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
|
|
|
extensions: mbstring, intl
|
2020-12-15 16:05:35 +01:00
|
|
|
ini-values: post_max_size=256M, log_errors = on, error_reporting = 32767, error_log = /tmp/php.log
|
2020-09-13 13:03:26 +02:00
|
|
|
coverage: xdebug, pcov
|
2020-05-20 20:37:53 +02:00
|
|
|
|
2020-09-13 13:03:26 +02:00
|
|
|
- name: Setup NodeJS
|
2023-10-23 18:20:10 +02:00
|
|
|
uses: actions/setup-node@v4
|
2020-09-13 13:03:26 +02:00
|
|
|
with:
|
2021-12-24 18:13:51 +01:00
|
|
|
node-version: '14'
|
2020-09-13 13:03:26 +02:00
|
|
|
|
2021-12-24 18:13:51 +01:00
|
|
|
- name: Build frontend
|
|
|
|
working-directory: frontend
|
2020-09-13 13:03:26 +02:00
|
|
|
run: |
|
2021-12-24 18:16:23 +01:00
|
|
|
npm ci
|
2021-12-24 18:13:51 +01:00
|
|
|
npm run build
|
2020-05-20 20:37:53 +02:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2021-12-24 18:13:51 +01:00
|
|
|
working-directory: backend
|
2020-09-23 23:36:14 +02:00
|
|
|
run: |
|
|
|
|
composer install --prefer-dist --no-progress
|
2020-09-13 13:03:26 +02:00
|
|
|
|
2021-04-16 22:53:27 +02:00
|
|
|
staging_deployment:
|
2021-04-16 23:33:49 +02:00
|
|
|
if: github.event.ref == 'refs/heads/staging'
|
2021-04-20 15:40:43 +02:00
|
|
|
needs: tests
|
2021-04-16 22:53:27 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: staging
|
|
|
|
name: Deploy to staging
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-04 16:56:29 +02:00
|
|
|
uses: actions/checkout@v4
|
2021-04-16 22:53:27 +02:00
|
|
|
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
2021-12-24 18:23:06 +01:00
|
|
|
php-version: 8.0
|
2021-04-16 22:53:27 +02:00
|
|
|
extensions: mbstring, intl
|
|
|
|
ini-values: post_max_size=256M, log_errors = on, error_reporting = 32767, error_log = /tmp/php.log
|
|
|
|
coverage: xdebug, pcov
|
|
|
|
|
|
|
|
- name: Setup NodeJS
|
2023-10-23 18:20:10 +02:00
|
|
|
uses: actions/setup-node@v4
|
2021-04-16 22:53:27 +02:00
|
|
|
with:
|
2021-12-24 18:23:06 +01:00
|
|
|
node-version: '14'
|
2021-04-16 22:53:27 +02:00
|
|
|
|
2021-04-18 00:31:57 +02:00
|
|
|
- name: Deploy
|
2021-04-16 22:53:27 +02:00
|
|
|
run: |
|
2021-04-18 00:23:41 +02:00
|
|
|
ls
|
2021-04-18 00:11:51 +02:00
|
|
|
sudo wget -O deployment.phar https://github.com/dg/ftp-deployment/releases/download/v3.4.0/deployment.phar
|
2021-04-29 23:39:31 +02:00
|
|
|
echo '<?php $remotes = [ "staging" => [ "remote" => "${{ secrets.DEPLOY_URL }}", "sentry_env" => "staging", "skip_composer_upload" => true ] ]; ?>' > deployment_remotes.php
|
2021-04-18 00:11:51 +02:00
|
|
|
cat deployment_remotes.php
|
2021-04-18 00:37:31 +02:00
|
|
|
ls
|
2021-04-18 00:31:57 +02:00
|
|
|
php deployment.phar deployment.php --section staging
|
2021-04-18 00:35:12 +02:00
|
|
|
php -r 'require("deployment_remotes.php");'
|
2021-04-27 23:25:14 +02:00
|
|
|
cat deployment.log | grep "After-jobs:" ; exit $?
|
2021-04-16 22:53:27 +02:00
|
|
|
|
2022-03-03 19:25:02 +01:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-04-20 14:46:40 +02:00
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
2021-04-20 15:10:57 +02:00
|
|
|
name: deploy_php_log_${{ github.run_id }}
|
2021-04-20 14:46:40 +02:00
|
|
|
path: /tmp/php.log
|
|
|
|
|
2022-03-03 19:25:02 +01:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-04-20 15:10:57 +02:00
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
|
|
|
name: deploy_log_${{ github.run_id }}
|
|
|
|
path: deployment.log
|
|
|
|
|
2021-04-16 22:53:27 +02:00
|
|
|
production_deployment:
|
2021-04-16 23:33:49 +02:00
|
|
|
if: github.event.ref == 'refs/heads/production'
|
2021-04-20 15:40:43 +02:00
|
|
|
needs: tests
|
2021-04-16 22:53:27 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: production
|
|
|
|
name: Deploy to production
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-04 16:56:29 +02:00
|
|
|
uses: actions/checkout@v4
|
2021-04-16 22:53:27 +02:00
|
|
|
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
2021-12-24 18:23:06 +01:00
|
|
|
php-version: 8.0
|
2021-04-16 22:53:27 +02:00
|
|
|
extensions: mbstring, intl
|
|
|
|
ini-values: post_max_size=256M, log_errors = on, error_reporting = 32767, error_log = /tmp/php.log
|
|
|
|
coverage: xdebug, pcov
|
|
|
|
|
|
|
|
- name: Setup NodeJS
|
2023-10-23 18:20:10 +02:00
|
|
|
uses: actions/setup-node@v4
|
2021-04-16 22:53:27 +02:00
|
|
|
with:
|
2021-12-24 18:23:06 +01:00
|
|
|
node-version: '14'
|
2021-04-16 22:53:27 +02:00
|
|
|
|
2021-04-20 15:31:01 +02:00
|
|
|
- name: Deploy
|
2021-04-16 22:53:27 +02:00
|
|
|
run: |
|
2021-04-20 15:31:01 +02:00
|
|
|
ls
|
|
|
|
sudo wget -O deployment.phar https://github.com/dg/ftp-deployment/releases/download/v3.4.0/deployment.phar
|
2021-04-29 23:39:31 +02:00
|
|
|
echo '<?php $remotes = [ "production" => [ "remote" => "${{ secrets.DEPLOY_URL }}", "sentry_env" => "prod", "skip_composer_upload" => true ] ]; ?>' > deployment_remotes.php
|
2021-04-20 15:31:01 +02:00
|
|
|
cat deployment_remotes.php
|
|
|
|
ls
|
|
|
|
php deployment.phar deployment.php --section production
|
|
|
|
php -r 'require("deployment_remotes.php");'
|
2021-04-27 23:25:14 +02:00
|
|
|
cat deployment.log | grep "After-jobs:" ; exit $?
|
2021-04-16 22:53:27 +02:00
|
|
|
|
2022-03-03 19:25:02 +01:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-04-20 15:31:01 +02:00
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
|
|
|
name: deploy_php_log_${{ github.run_id }}
|
|
|
|
path: /tmp/php.log
|
|
|
|
|
2022-03-03 19:25:02 +01:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-04-20 15:31:01 +02:00
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
|
|
|
name: deploy_log_${{ github.run_id }}
|
|
|
|
path: deployment.log
|
2021-04-20 16:22:42 +02:00
|
|
|
|