-
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (78 loc) · 2.48 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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 }}