-
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (136 loc) · 4 KB
/
laravel.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Prod
on:
push:
branches:
- 'main'
- 'main_de'
- 'main_us'
- 'main_20241018'
paths-ignore:
- 'README.md'
- .github/**
- docs/**
- 'Dockerfile'
pull_request:
branches:
- 'main'
- 'main_de'
- 'main_us'
paths-ignore:
- 'README.md'
- 'Dockerfile'
- .github/**
- docs/**
delete:
branches:
- 'main'
- 'main_de'
- 'main_us'
paths-ignore:
- 'README.md'
- 'Dockerfile'
- .github/**
- docs/**
jobs:
laravel-tests:
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
nexamerchant:
image: nicesteven/nexamerchant:latest
ports:
- 8080:80
options: --health-cmd="curl -f http://localhost:80" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: xdebug
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: composer update
run: composer update -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: Execute tests (Unit and Feature tests) via pest
env:
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: password
run: php artisan migrate && php artisan db:seed
- 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
# run: php artisan migrate
# - name: Tests
# run: ./vendor/bin/pest
- name: Sync to Server 1 and Do it
uses: appleboy/ssh-action@master
env:
GITHUB_SHA_X: ${GITHUB_SHA}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{secrets.SSH_PORT }}
script: |
cd ${{ secrets.WWW_DIR }} && sudo git pull
composer dump-autoload
cd storage && sudo chmod -R 777 *
cd ${{ secrets.WWW_DIR_2 }} && sudo git pull
composer dump-autoload
cd storage && sudo chmod -R 777 *
cd ${{ secrets.WWW_DIR_3 }} && sudo git pull
composer dump-autoload
cd storage && sudo chmod -R 777 *
cd ${{ secrets.WWW_DIR_4 }} && sudo git pull
composer dump-autoload
cd storage && sudo chmod -R 777 *
- name: Sync to Server 2 and Do it
uses: appleboy/ssh-action@master
env:
GITHUB_SHA_X: ${GITHUB_SHA}
with:
host: ${{ secrets.SSH_HOST_US }}
username: ${{ secrets.SSH_USERNAME_US }}
key: ${{ secrets.DEPLOY_KEY_US }}
port: ${{secrets.SSH_PORT_US }}
script: |
cd ${{ secrets.WWW_DIR_US }} && git pull
composer dump-autoload
cd storage && sudo chmod -R 777 *