Skip to content

Commit 6275a7d

Browse files
Merge pull request #497 from kaanucarci/ci-improvements
Improve CI pipeline with Laravel optimization step
2 parents 052b3cd + 1c188cf commit 6275a7d

File tree

1 file changed

+50
-45
lines changed

1 file changed

+50
-45
lines changed

.github/workflows/tests.yml

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,59 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
10-
1110
tests:
1211
runs-on: ubuntu-latest
13-
12+
1413
steps:
15-
- uses: actions/checkout@v5
16-
17-
- name: Setup PHP
18-
uses: shivammathur/setup-php@v2
19-
with:
20-
php-version: '8.3'
21-
22-
23-
- name: Start database
24-
run: sudo /etc/init.d/mysql start
25-
26-
- name: Create database
27-
run: mysql -e "CREATE DATABASE IF NOT EXISTS liberu;" -uroot -proot
28-
29-
- name: Copy environment file
30-
run: cp .env.testing .env
31-
32-
- name: Install dependencies
33-
run: composer install
34-
35-
- name: Generate application key
36-
run: php artisan key:generate
37-
38-
- name: Run database migrations
39-
run: php artisan migrate
40-
41-
- name: Seed database
42-
run: php artisan db:seed
43-
44-
- name: Run tests
45-
run: vendor/bin/phpunit --coverage-clover=coverage.xml
46-
47-
- name: Upload coverage to Codecov
48-
uses: codecov/codecov-action@v5
49-
with:
50-
token: ${{ secrets.CODECOV_TOKEN }}
51-
files: ./coverage.xml
52-
flags: unittests
53-
name: codecov-umbrella
54-
fail_ci_if_error: true
55-
14+
- uses: actions/checkout@v5
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.3'
20+
extensions: mbstring, bcmath, pdo, mysql, dom, curl
21+
22+
- name: Start database
23+
run: sudo /etc/init.d/mysql start
24+
25+
- name: Create database
26+
run: mysql -e "CREATE DATABASE IF NOT EXISTS liberu;" -uroot -proot
27+
28+
- name: Copy environment file
29+
run: cp .env.testing .env
30+
31+
- name: Install dependencies
32+
run: composer install --no-progress --prefer-dist
33+
34+
- name: Generate application key
35+
run: php artisan key:generate
36+
37+
- name: Optimize Laravel
38+
run: |
39+
php artisan config:clear
40+
php artisan cache:clear
41+
php artisan route:clear
42+
php artisan config:cache
43+
44+
- name: Run database migrations
45+
run: php artisan migrate --force
46+
47+
- name: Seed database
48+
run: php artisan db:seed
49+
50+
- name: Run tests
51+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
52+
53+
- name: Upload coverage to Codecov
54+
uses: codecov/codecov-action@v5
55+
with:
56+
token: ${{ secrets.CODECOV_TOKEN }}
57+
files: ./coverage.xml
58+
flags: unittests
59+
name: codecov-umbrella
60+
fail_ci_if_error: true

0 commit comments

Comments
 (0)