Skip to content

Commit fef2fcd

Browse files
authored
Merge pull request #60 from lapaliv/ci-test
ci: updated the troubles with CI build: updated dependencies
2 parents 678b2e8 + d8d5daf commit fef2fcd

File tree

6 files changed

+446
-1539
lines changed

6 files changed

+446
-1539
lines changed

.github/workflows/check.yml

Lines changed: 69 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,95 @@
11
name: PHPUnit & Psalm
22

3-
on: [push]
4-
5-
permissions:
6-
contents: read
3+
on: [pull_request]
74

85
jobs:
96
phpunit:
10-
runs-on: ubuntu-latest
11-
7+
runs-on: ubuntu-22.04
128
strategy:
139
matrix:
14-
include:
15-
- php: '8.0'
16-
- php: '8.1'
17-
- php: '8.2'
18-
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v4
21-
with:
22-
fetch-depth: 2
10+
php-version: [8.0, 8.1, 8.2, 8.3]
11+
services:
12+
mysql:
13+
image: mysql:8.0
14+
env:
15+
MYSQL_ROOT_PASSWORD: root
16+
MYSQL_DATABASE: test_db
17+
MYSQL_USER: test_user
18+
MYSQL_PASSWORD: test_password
19+
ports:
20+
- 3306:3306
21+
options: >-
22+
--health-cmd="mysqladmin ping --silent"
23+
--health-interval=10s
24+
--health-timeout=5s
25+
--health-retries=3
26+
postgres:
27+
image: postgres:14
28+
env:
29+
POSTGRES_USER: test_user
30+
POSTGRES_PASSWORD: test_password
31+
POSTGRES_DB: test_db
32+
ports:
33+
- 5432:5432
34+
options: >-
35+
--health-cmd="pg_isready"
36+
--health-interval=10s
37+
--health-timeout=5s
38+
--health-retries=3
2339
24-
- name: Copy .env
25-
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
26-
27-
- name: Load .env file
28-
uses: xom9ikk/dotenv@v2
29-
30-
- uses: isbang/compose-action@v1.4.1
31-
with:
32-
compose-file: "./docker-compose.yml"
40+
steps:
41+
- uses: actions/checkout@v4
3342

3443
- name: Setup PHP
3544
uses: shivammathur/setup-php@v2
3645
with:
37-
coverage: "none"
38-
php-version: "${{ matrix.php }}"
39-
tools: flex
46+
php-version: ${{ matrix.php-version }}
47+
extensions: mbstring, pdo, mysql, pgsql
48+
coverage: none
49+
50+
- name: Wait for MySQL
51+
run: |
52+
echo "Waiting for MySQL..."
53+
until mysqladmin ping -h 127.0.0.1 --silent; do
54+
sleep 2
55+
done
56+
echo "MySQL is up!"
57+
58+
echo "Waiting for PostgreSQL..."
59+
until pg_isready -h 127.0.0.1 -p 5432; do
60+
sleep 2
61+
done
62+
echo "PostgreSQL is up!"
4063
4164
- name: Install dependencies
42-
run: composer install --prefer-dist --no-progress
65+
run: composer install --prefer-dist --no-progress --ignore-platform-reqs
4366

44-
- name: Waiting for MySQL
67+
- name: Create .env file for testing
4568
run: |
46-
while ! mysqladmin ping --host=${{ env.MYSQL_HOST }} --port=${{ env.MYSQL_PORT }} --password=${{ env.MYSQL_PASSWORD }} --silent; do
47-
sleep 1
48-
done
69+
echo "POSTGRESQL_HOST=127.0.0.1" > .env
70+
echo "POSTGRESQL_DATABASE=test_db" >> .env
71+
echo "POSTGRESQL_USERNAME=test_user" >> .env
72+
echo "POSTGRESQL_PASSWORD=test_password" >> .env
73+
echo "POSTGRESQL_PORT=5432" >> .env
74+
echo "MYSQL_HOST=127.0.0.1" >> .env
75+
echo "MYSQL_DATABASE=test_db" >> .env
76+
echo "MYSQL_USERNAME=test_user" >> .env
77+
echo "MYSQL_PASSWORD=test_password" >> .env
78+
echo "MYSQL_PORT=3306" >> .env
79+
80+
- name: Run Tests
81+
run: ./vendor/bin/phpunit --testdox
4982

50-
- name: PHPUnit
51-
run: ./vendor/bin/phpunit
5283
psalm:
53-
runs-on: ubuntu-latest
54-
84+
runs-on: ubuntu-22.04
5585
env:
56-
php-version: '8.0'
86+
php_version: '8.0'
87+
5788
steps:
5889
- name: Setup PHP
5990
uses: shivammathur/setup-php@v2
6091
with:
61-
php-version: ${{ env.php-version }}
92+
php-version: ${{ env.php_version }}
6293
ini-values: "memory_limit=-1"
6394
coverage: none
6495

composer.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"require": {
3333
"php": "^8.0",
3434
"nesbot/carbon": "^2.0|^3.0",
35-
"illuminate/database": "^8.19|^9.0|^10.0|^11.0"
35+
"illuminate/database": "^8.19|^9.0|^10.0|^11.0|^12.0"
3636
},
3737
"require-dev": {
3838
"ext-pdo": "*",
@@ -54,11 +54,5 @@
5454
"optimize-autoloader": true,
5555
"preferred-install": "dist",
5656
"sort-packages": true
57-
},
58-
"scripts": {
59-
"post-autoload-dump": [
60-
"@php -r \"copy('dev/pre-commit', '.git/hooks/pre-commit'); chmod('.git/hooks/pre-commit', 0755);\"",
61-
"@php -r \"copy('dev/cs-fixer.sh','.git/hooks/cs-fixer.sh'); chmod('.git/hooks/cs-fixer.sh', 0755);\""
62-
]
6357
}
6458
}

0 commit comments

Comments
 (0)