Repository navigation
160 lines (131 loc) · 4.77 KB
/
Copy pathci.yml
File metadata and controls
160 lines (131 loc) · 4.77 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
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
quality:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
container:
image: ghcr.io/cboxdk/php-baseimages/php-cli:${{ matrix.php }}-bookworm-dev-v1
strategy:
fail-fast: false
matrix:
php: ['8.4', '8.5']
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Validate Composer metadata
run: composer validate --strict
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Check formatting
run: vendor/bin/pint --test
- name: Run static analysis
run: vendor/bin/phpstan analyse --no-progress --memory-limit=1G
- name: Run tests
run: vendor/bin/pest
- name: Run tests against a store that shares no objects across commits
run: vendor/bin/pest
env:
SYNC_STORE: rehydrating
- name: Run tests against the durable SQLite adapter
run: vendor/bin/pest
env:
SYNC_STORE: sqlite
- name: Run tests against the durable client state
run: vendor/bin/pest
env:
SYNC_CLIENT: sqlite
- name: Run deterministic simulator
run: composer simulate
- name: Run deterministic simulator on the durable adapter
run: php bin/simulate.php --store=sqlite
- name: Prove concurrent writers keep the log gapless
run: php bin/concurrency.php --writers=4 --mutations=25
- name: Audit locked dependencies
run: composer security-audit
- name: Check documentation examples parse
run: php bin/lint-docs.php
- name: Check dependency licenses
run: composer license-check
- name: Check generated requirements
run: |
php bin/generate-requirements.php
git diff --exit-code -- docs/requirements.md
test -z "$(git status --porcelain --untracked-files=all -- docs/requirements.md)"
- name: Check SBOM drift
run: |
composer sbom
git diff --exit-code -- sbom.json
test -z "$(git status --porcelain --untracked-files=all -- sbom.json)"
databases:
name: ${{ matrix.database }} on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
container:
image: ghcr.io/cboxdk/php-baseimages/php-cli:${{ matrix.php }}-bookworm-dev-v1
strategy:
fail-fast: false
matrix:
php: ['8.4', '8.5']
database: [postgres, mysql]
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: sync
POSTGRES_PASSWORD: secret
POSTGRES_DB: sync
ports: ['5432:5432']
options: >-
--health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10
mysql:
image: mysql:8.4
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: sync
ports: ['3306:3306']
options: >-
--health-cmd "mysqladmin ping" --health-interval 5s --health-timeout 5s --health-retries 10
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Resolve connection
id: connection
run: |
if [ "${{ matrix.database }}" = "postgres" ]; then
echo "dsn=pgsql:host=postgres;port=5432;dbname=sync" >> "$GITHUB_OUTPUT"
echo "user=sync" >> "$GITHUB_OUTPUT"
else
echo "dsn=mysql:host=mysql;port=3306;dbname=sync" >> "$GITHUB_OUTPUT"
echo "user=root" >> "$GITHUB_OUTPUT"
fi
- name: Run tests against the database
run: vendor/bin/pest
env:
SYNC_STORE: pdo
SYNC_DSN: ${{ steps.connection.outputs.dsn }}
SYNC_DB_USER: ${{ steps.connection.outputs.user }}
SYNC_DB_PASSWORD: secret
- name: Run deterministic simulator against the database
run: |
php bin/simulate.php \
--dsn="${{ steps.connection.outputs.dsn }}" \
--user="${{ steps.connection.outputs.user }}" \
--password=secret
- name: Prove concurrent writers keep the log gapless
run: |
php bin/concurrency.php --writers=6 --mutations=25 \
--dsn="${{ steps.connection.outputs.dsn }}" \
--user="${{ steps.connection.outputs.user }}" \
--password=secret
- name: Prove writers in different spaces do not block each other
run: |
php bin/concurrency.php --writers=6 --mutations=50 --spaces=separate \
--dsn="${{ steps.connection.outputs.dsn }}" \
--user="${{ steps.connection.outputs.user }}" \
--password=secret