-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (63 loc) · 1.8 KB
/
Copy pathmain.yml
File metadata and controls
78 lines (63 loc) · 1.8 KB
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
name: Deploy Codante
on:
push:
branches: [main]
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: codante_test
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: secretroot
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: mbstring, bcmath, zip
tools: composer:v2
coverage: none
- name: Composer install
run: composer install --prefer-dist --no-interaction
- name: Boot Laravel application
run: |
cp .env.github .env
php artisan key:generate
php artisan --version
- name: Run migrations
run: php artisan migrate --force
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2
coverage: none
- name: Composer install
run: composer install --prefer-dist --no-interaction
- name: Setup Deployer
uses: deployphp/action@master
with:
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
dep: deploy -v