forked from ClientXCMS/ClientXCMS
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (105 loc) · 3.5 KB
/
Copy pathclientxcms_actions.yml
File metadata and controls
113 lines (105 loc) · 3.5 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
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
name: ClientX CMS Actions
on:
push:
branches:
- master
- develop
- "v2*"
pull_request:
branches:
- master
- develop
- "v2*"
jobs:
unit-test:
name: Unit testing
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: testdb
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: json, zip, sodium, pcntl, bcmath, pdo_mysql
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('composer.lock') }}
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Wait for MySQL to be ready
run: |
for i in {1..30}; do
if mysqladmin ping -h 127.0.0.1 -u root -proot --silent; then
echo "MySQL is up!"
break
fi
echo "Waiting for MySQL..."
sleep 2
done
# - name: Export translations
# if: github.ref == 'refs/heads/master'
# run: php artisan translations:export
# - name: Checkout ctx-translations repository
# if: github.ref == 'refs/heads/master'
# uses: actions/checkout@v3
# with:
# repository: ${{ vars.CTX_TRANSLATIONS_REPO }}
# ssh-key: ${{ secrets.CTX_TRANSLATIONS_DEPLOY_KEY }}
# ssh-known-hosts: ${{ secrets.CTX_KNOWN_HOSTS }}
# path: translations
# ref: main
# fetch-depth: 0
# - name: Copy translations to translations
# if: github.ref == 'refs/heads/master'
# run: |
# mkdir -p translations/translations
# cp storage/fr.json translations/translations/fr.json
# - name: Commit and push translations
# if: github.ref == 'refs/heads/master'
# run: |
# cd translations
# git config user.name "github-actions[bot]"
# git config user.email "github-actions[bot]@users.noreply.github.com"
# if git diff --quiet; then
# echo "No changes in translations, skipping commit."
# else
# git add translations/fr.json
# git commit -m "Update translations from source repository"
# git push origin main
# fi
- name: Create installed flag
run: mkdir -p storage && touch storage/installed
- name: Set up environment
run: cp .env.testing .env
- name: Generate application key
run: php artisan key:generate
- name: Generate OpenAPI documentation
run: php artisan l5-swagger:generate
- name: Run migrations
run: php artisan migrate --force --no-interaction --no-ansi --seed
- name: Build assets
run: npm install && npm run build
- name: Run translations
run: php artisan translations:import
- name: Run PHPUnit
run: ./vendor/bin/phpunit --configuration phpunit_github.xml -d date.timezone=Europe/Paris