Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update php unit test workflow to run in docker #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/php-unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
type: string
required: false
default: "composer test"
run_docker:
type: boolean
required: false
default: false
run_sonar:
type: boolean
required: false
Expand All @@ -28,6 +32,14 @@ on:
type: string
required: false
default: "phpunit-code-coverage-report"
health_check_command:
type: string
required: false
default: null
health_check_timeout:
type: number
required: false
default: 300
secrets:
packagist_username:
required: true
Expand Down Expand Up @@ -80,6 +92,21 @@ jobs:
timeout_minutes: 5
max_attempts: 5
command: composer install --prefer-dist --no-interaction --no-progress
- name: Docker compose pull
if: ${{ inputs.run_docker }}
run: docker compose --project-directory . pull
- name: Docker compose up
if: ${{ inputs.run_docker }}
run: docker compose --project-directory . up --build -d
- name: Wait for docker container to be ready
if: ${{ inputs.run_docker }}
run: |
timeout=${{ inputs.health_check_timeout }}
until [ $timeout -eq 0 ] || ${{ inputs.health_check_command }}; do
sleep 5
timeout=$((timeout-5))
done
[ $timeout -gt 0 ]
- name: Execute tests
run: |
${{ inputs.test_command }}
Expand Down