chore(main): release 1.2.1 #723
Workflow file for this run
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: Backend Tests | |
on: | |
pull_request: | |
types: [ opened, synchronize ] | |
workflow_call: | |
inputs: | |
ref: | |
type: string | |
description: The branch, tag or SHA to deploy | |
required: true | |
jobs: | |
backend-tests: | |
name: Backend Tests | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mariadb:10 | |
env: | |
MYSQL_DATABASE: test_db | |
MYSQL_USER: user | |
MYSQL_PASSWORD: secret | |
MYSQL_ROOT_PASSWORD: secretroot | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
if: inputs.ref | |
with: | |
ref: ${{ inputs.ref }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
if: github.event_name == 'pull_request' | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: mbstring, intl | |
ini-values: post_max_size=256M, max_execution_time=180 | |
coverage: xdebug | |
tools: php-cs-fixer, phpunit | |
- name: Verify MySQL connection | |
run: | | |
mysql --version | |
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uuser -psecret -e "SHOW DATABASES" | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Generate key | |
run: php artisan jwt:secret | |
- name: Directory Permissions | |
run: chmod -R 777 storage | |
- name: Execute tests (Unit and Feature tests) via PHPUnit | |
env: | |
DB_DATABASE: test_db | |
DB_USERNAME: user | |
DB_PASSWORD: secret | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
run: vendor/bin/phpunit --coverage-clover=coverage.xml | |
- name: Upload code coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./backend/coverage.xml | |
fail_ci_if_error: true |