overviewUpload #7179
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: | |
push: | |
branches: [ "main" ] | |
env: | |
HOME: /home/aiku_test | |
XDEBUG_MODE: coverage | |
jobs: | |
laravel-tests: | |
name: Run backend tests 🧪 | |
runs-on: [ self-hosted ] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Composer install | |
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Prepare environment | |
run: | | |
ln -s ../../../../.pgpass .pgpass | |
ln -s ../../../../env.aiku.testing .env.testing | |
ln -s ../../../../env.aiku.testing .env | |
ln -s ../../../../../artifacts/public/grp public/grp | |
ln -s ../../../../../artifacts/public/iris public/iris | |
ln -s ../../../../../artifacts/public/retina public/retina | |
ln -s ../../../../../artifacts/public/aiku-public public/aiku-public | |
mkdir private | |
cd private | |
ln -s ../../../../../artifacts/fa . | |
- name: Get db changed files | |
id: changed-db-files | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
app/Enums/** | |
app/Stubs/** | |
database/migrations/** | |
- name: Get coverage changed files | |
id: changed-coverage-files | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
app/** | |
tests/** | |
database/migrations/** | |
- name: Generate database dumps 📚 | |
run: ./generate_testing_db_dumps.sh php8.3 aiku_test;cp tests/datasets/db_dumps/aiku.dump ../../../../artifacts/ | |
- name: Retrieve db dumps | |
run: cp ../../../../artifacts/aiku.dump tests/datasets/db_dumps/ | |
- name: Run test with coverage | |
if: steps.changed-coverage-files.outputs.any_changed == 'true' | |
run: vendor/bin/pest -d memory_limit=-1 --coverage-clover clover.xml --exclude-group=integration --stop-on-defect | |
- name: Run test without coverage | |
if: steps.changed-coverage-files.outputs.any_changed != 'true' | |
run: vendor/bin/pest --exclude-group=integration --stop-on-defect | |
- name: Upload coverage to Codecov | |
if: steps.changed-coverage-files.outputs.any_changed == 'true' | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
file: ./clover.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true |