Repository navigation
161 lines (131 loc) · 4.46 KB
/
Copy pathci.yml
File metadata and controls
161 lines (131 loc) · 4.46 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
frontend:
name: Frontend checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.19'
cache: pnpm
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Run frontend checks
run: pnpm check
- name: Validate OpenAPI contract
run: pnpm api:lint
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
php: ['8.4']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, xml, curl, intl, json, mysqlnd, sockets
coverage: pcov
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Validate environment configuration
env:
DB_PASSWORD: db-${{ github.run_id }}-${{ github.run_attempt }}-validation-value
DB_ROOT_PASSWORD: root-${{ github.run_id }}-${{ github.run_attempt }}-validation-value
WEBSOCKET_TOKEN_SECRET: websocket-${{ github.sha }}-${{ github.run_id }}
run: |
cp .env.example .env
sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=${DB_PASSWORD}|" .env
sed -i "s|^DB_ROOT_PASSWORD=.*|DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}|" .env
sed -i "s|^WEBSOCKET_TOKEN_SECRET=.*|WEBSOCKET_TOKEN_SECRET=${WEBSOCKET_TOKEN_SECRET}|" .env
php spark env:check --no-header
php spark env:diff --no-header
- name: Check PHP coding style
run: composer cs-check
- name: Run PHPUnit tests with coverage
if: github.event_name == 'pull_request'
run: composer test:coverage
- name: Upload PHP coverage to Codecov
if: github.event_name == 'pull_request'
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5
with:
fail_ci_if_error: true
files: build/logs/clover.xml
flags: php
name: php-8.4
use_oidc: true
- name: Run PHPUnit tests
if: github.event_name != 'pull_request'
run: composer test
- name: Run database integration tests
if: github.event_name == 'pull_request'
run: composer test:integration
- name: Run Composer audit
run: composer audit
mysql-integration:
name: MySQL 8 integration
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.4
env:
MYSQL_DATABASE: codeigniter_chat_test
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --host=127.0.0.1 --user=root --password=root"
--health-interval=10s
--health-timeout=5s
--health-retries=10
env:
database.tests.hostname: 127.0.0.1
database.tests.username: root
database.tests.password: root
database.tests.database: codeigniter_chat_test
database.tests.DBDriver: MySQLi
database.tests.DBPrefix: db_
database.tests.port: 3306
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring, xml, curl, intl, json, mysqli, sockets
coverage: none
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Run database integration tests against MySQL
run: composer test:integration:mysql