fix #1
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: Tests | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
- .github/** | |
- docs/** | |
pull_request: | |
paths-ignore: | |
- 'README.md' | |
- .github/** | |
- docs/** | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
container: | |
image: kirschbaumdevelopment/laravel-test-runner:8.1 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: test | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: redis | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
tools: composer:v2 | |
coverage: xdebug | |
- name: Install Dependencies | |
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-scripts | |
- uses: actions/checkout@v3 | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: composer install | |
run: composer install -vvv --no-scripts | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Create Database | |
run: | | |
mkdir -p database | |
touch database/database.sqlite | |
- name: Download init db | |
run: sudo apt-get install wget && sudo apt-get install unzip && wget -c ${{secrets.INIT_DB_URL }}?v=${{ github.sha }} -O db.zip | |
- name: unzip | |
run: unzip db.zip -d ./ | |
- name: mysql import | |
run: mysql -u root -ppassword -h mysql test < db.sql | |
- name: migrate db | |
run: php artisan migrate | |
- name: route list | |
run: php artisan route:list | |
- name: Execute tests (Unit and Feature tests) via PestPHP | |
run: vendor/bin/pest --coverage-clover clover.xml | |
- name: Generate test coverage badge | |
uses: timkrase/[email protected] | |
with: | |
coverage_badge_path: 'badge-coverage.svg' | |
push_badge: true | |
repo_token: ${{ secrets.GITHUB_TOKEN }} |