-
Notifications
You must be signed in to change notification settings - Fork 63
147 lines (126 loc) · 4.06 KB
/
tests.yml
File metadata and controls
147 lines (126 loc) · 4.06 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
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
139
140
141
142
143
144
145
146
147
name: tests
on: [push]
jobs:
ci:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=5
postgres:
image: postgres:16
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
mongodb:
image: mongo:8
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: root
ports:
- 27017:27017
options: >-
--health-cmd="mongosh --eval 'db.adminCommand({ping:1})' --quiet"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
ssh:
image: linuxserver/openssh-server:latest
env:
PUID: 1000
PGID: 1000
TZ: UTC
USER_NAME: testuser
USER_PASSWORD: testpass
PASSWORD_ACCESS: "true"
DOCKER_MODS: linuxserver/mods:openssh-server-ssh-tunnel
ports:
- 2222:2222
options: >-
--health-cmd="netstat -tlnp | grep ':2222' || exit 1"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.5
tools: composer:v2
coverage: pcov
extensions: pdo, pdo_mysql, pdo_pgsql, mongodb-2.3.0, sockets
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y mysql-client postgresql-client redis-tools zstd p7zip-full sshpass sqlite3
# Install MongoDB tools (mongodump, mongorestore)
wget -qO - https://www.mongodb.org/static/pgp/server-8.0.asc | sudo gpg --dearmor -o /usr/share/keyrings/mongodb-server-8.0.gpg
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
sudo apt-get update
sudo apt-get install -y mongodb-database-tools
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Install Dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Install Node Dependencies
run: npm i
- name: Build Assets
run: npm run build
- name: Generate Application Key
run: php artisan key:generate
- name: Run Pint
run: vendor/bin/pint
- name: Run phpstan
run: vendor/bin/phpstan analyse
- name: Run Tests
env:
MYSQL_CLI_TYPE: mysql
DB_HOST: 127.0.0.1
TEST_MYSQL_HOST: 127.0.0.1
TEST_POSTGRES_HOST: 127.0.0.1
TEST_REDIS_HOST: 127.0.0.1
TEST_MONGODB_HOST: 127.0.0.1
TEST_SSH_HOST: 127.0.0.1
run: |
php artisan migrate --force
php artisan test --parallel --coverage-clover=coverage.xml --log-junit junit.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: coverage
files: coverage.xml
- name: Upload test results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results