Repository navigation
198 lines (171 loc) · 6.44 KB
/
Copy pathtests.yml
File metadata and controls
198 lines (171 loc) · 6.44 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: "Tests"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE: databases-dev
CACHE_KEY: databases-dev-${{ github.event.pull_request.head.sha || github.sha }}
CACHE_5_KEY: databases-dev-cache-5-${{ github.event.pull_request.head.sha || github.sha }}
on: [pull_request, workflow_dispatch]
jobs:
setup:
name: Setup & Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build Docker Image
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1
with:
context: .
file: Dockerfile
push: false
tags: ${{ env.IMAGE }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar
- name: Cache Docker Image
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
key: ${{ env.CACHE_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
unit_test:
name: Unit Test
runs-on: ubuntu-latest
needs: setup
steps:
- name: checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Load Cache
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
key: ${{ env.CACHE_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
fail-on-cache-miss: true
- name: Load and Start Services
run: |
docker load --input /tmp/${{ env.IMAGE }}.tar
docker compose up -d --wait
- name: Run Unit Tests
run: docker compose exec -e XDEBUG_MODE=off tests vendor/bin/paratest --configuration phpunit.xml --functional --processes 4 /usr/src/code/tests/unit
adapter_test:
name: "Adapter Tests (${{ matrix.adapter }})"
runs-on: ubuntu-latest
needs: setup
strategy:
fail-fast: false
matrix:
include:
- adapter: MongoDB
profiles: "--profile mongo"
- adapter: MariaDB
profiles: "--profile mariadb"
- adapter: MySQL
profiles: "--profile mysql"
- adapter: Postgres
profiles: "--profile postgres"
- adapter: SQLite
profiles: ""
- adapter: Memory
profiles: ""
- adapter: Mirror
profiles: "--profile mariadb --profile mariadb-mirror --profile redis-mirror"
- adapter: Pool
profiles: "--profile mysql"
- adapter: Redis
profiles: ""
- adapter: SharedTables/MongoDB
profiles: "--profile mongo"
- adapter: SharedTables/MariaDB
profiles: "--profile mariadb"
- adapter: SharedTables/MySQL
profiles: "--profile mysql"
- adapter: SharedTables/Postgres
profiles: "--profile postgres"
- adapter: SharedTables/SQLite
profiles: ""
- adapter: SharedTables/Redis
profiles: ""
- adapter: Schemaless/MongoDB
profiles: "--profile mongo"
steps:
- name: checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Load Cache
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
key: ${{ env.CACHE_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
fail-on-cache-miss: true
- name: Load and Start Services
run: |
docker load --input /tmp/${{ env.IMAGE }}.tar
docker compose ${{ matrix.profiles }} up -d --wait
- name: Run Tests
run: docker compose exec -T -e XDEBUG_MODE=off tests vendor/bin/paratest --configuration phpunit.xml --functional --processes 4 /usr/src/code/tests/e2e/Adapter/${{matrix.adapter}}Test.php
setup_cache_5:
name: Setup & Build Docker Image (utopia-php/cache 5.x)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build Docker Image
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1
with:
context: .
file: Dockerfile
build-args: |
UTOPIA_CACHE_VERSION=^5.1
push: false
tags: ${{ env.IMAGE }}
load: true
cache-from: |
type=gha
type=gha,scope=cache-5
cache-to: type=gha,mode=max,scope=cache-5
outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar
- name: Cache Docker Image
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
key: ${{ env.CACHE_5_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
cache_5_test:
name: "Cache 5.x Tests (${{ matrix.suite }})"
runs-on: ubuntu-latest
needs: setup_cache_5
strategy:
fail-fast: false
matrix:
include:
- suite: Unit
profiles: ""
path: /usr/src/code/tests/unit
- suite: MariaDB
profiles: "--profile mariadb"
path: /usr/src/code/tests/e2e/Adapter/MariaDBTest.php
steps:
- name: checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Load Cache
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
key: ${{ env.CACHE_5_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
fail-on-cache-miss: true
- name: Load and Start Services
run: |
docker load --input /tmp/${{ env.IMAGE }}.tar
docker compose ${{ matrix.profiles }} up -d --wait
- name: Show utopia-php/cache Version
run: |
docker compose exec -T tests php -r '
require "vendor/autoload.php";
echo "utopia-php/cache ", \Composer\InstalledVersions::getPrettyVersion("utopia-php/cache"), PHP_EOL;
'
- name: Run Tests
run: docker compose exec -T -e XDEBUG_MODE=off tests vendor/bin/paratest --configuration phpunit.xml --functional --processes 4 ${{ matrix.path }}