-
Notifications
You must be signed in to change notification settings - Fork 95
64 lines (50 loc) · 1.58 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
name: Tests
on:
push:
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: 8.2
- name: Setup MySQL database
run: mysql -u root -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} -e "CREATE DATABASE benjamincrozat_test"
- name: Setup Redis
uses: zhulik/redis-action@1.1.0
- name: Checkout code
uses: actions/checkout@v3
- name: Create .env file
run: cp .env.example .env
- name: Install back-end dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate encryption key
run: php artisan key:generate
- name: Install front-end dependencies
run: yarn
- name: Build CSS and JavaScript
run: yarn build
- name: Run tests
run: php artisan test
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DEPLOYMENT_URL: ${{ secrets.DEPLOYMENT_URL }}
TORCHLIGHT_TOKEN: ${{ secrets.TORCHLIGHT_TOKEN }}
- name: Deploy on production
run: curl -X POST ${{ secrets.DEPLOYMENT_URL }}
if: github.ref == 'refs/heads/main' && success()