Skip to content

Merge pull request #727 from Pixilib/fixci #1939

Merge pull request #727 from Pixilib/fixci

Merge pull request #727 from Pixilib/fixci #1939

Workflow file for this run

name: 'tests'
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
tests:
name: 'Tests Gaelo'
runs-on: ubuntu-latest
steps:
- name: 'Build checkout'
uses: actions/checkout@v4
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: 'Copy .env'
working-directory: ./GaelO2
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: 'Install Dependencies'
working-directory: ./GaelO2
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: 'Generate key'
working-directory: ./GaelO2
run: php artisan key:generate
- name: 'Directory Permissions'
working-directory: ./GaelO2
run: chmod -R 777 storage bootstrap/cache
- name: 'Create Database'
working-directory: ./GaelO2
run: |
mkdir -p database
touch database/database.sqlite
- name: 'Execute tests (Unit and Feature tests) via PHPUnit'
working-directory: ./GaelO2
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
APP_ENV: testing
run: vendor/bin/phpunit --coverage-cobertura=coverage.xml
- name: Fix code coverage paths
working-directory: ./GaelO2
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: Produce the coverage report
uses: insightsengineering/coverage-action@v2
with:
# Path to the Cobertura XML report.
path: ./GaelO2/coverage.xml
# Minimum total coverage, if you want to the
# workflow to enforce it as a standard.
# This has no effect if the `fail` arg is set to `false`.
threshold: 70
# Fail the workflow if the minimum code coverage
# reuqirements are not satisfied.
fail: false
# Publish the rendered output as a PR comment
publish: true
# Create a coverage diff report.
diff: true
# Branch to diff against.
# Compare the current coverage to the coverage
# determined on this branch.
diff-branch: GaelO2
diff-storage: GaelO2_code_coverage
permissions:
contents: read
packages: read
pull-requests: write