-
Notifications
You must be signed in to change notification settings - Fork 25
693 lines (585 loc) Β· 28.5 KB
/
clang-cl-qt6.yml
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# MySQL
# ---
# Forces TLS connections with the caching_sha2_password and certificate validation, also validates
# issuer == CN=MySQL_Server_TinyORM_Auto_Generated_CA_Certificate and
# subject == CN=MySQL_Server_TinyORM_Auto_Generated_Client_Certificate.
# PostgreSQL
# ---
# Forces TLS connections with the scram-sha-256 authentication and full certificate validation
# using the clientcert=verify-full in the pg_hba.conf and sslmode=verify-full on the libpq client
# side, so the the server host name is matched against the CN (Common Name)
# stored in the server certificate.
name: Clang-cl MSVC2022 Qt6.5
on:
push:
branches:
- main
- gh-actions
jobs:
build:
name: cmake build / ctest
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: TinyORM prepare environment
run: |
$runnerWorkPath = Resolve-Path -Path '${{ runner.workspace }}/..'
"TinyRunnerWorkPath=$runnerWorkPath" >> $env:GITHUB_ENV
$sqlitePath = Join-Path -Path $runnerWorkPath -ChildPath "SQLite/$env:DB_SQLITE_DATABASE"
"TinySQLitePath=$sqlitePath" >> $env:GITHUB_ENV
$mysqlExePath = (Get-Command -Name mysql.exe).Source
$mysqlInstallationPath = Split-Path -Parent -Path (Split-Path -Parent -Path $mysqlExePath)
"TinyMySQLInstallationPath=$mysqlInstallationPath" >> $env:GITHUB_ENV
env:
DB_SQLITE_DATABASE: ${{ secrets.DB_SQLITE_DATABASE }}
- name: Hosts add PostgreSQL server hostname
run: >-
"127.0.0.1`t$env:DB_PGSQL_HOST" |
Add-Content -Path "$env:windir/System32/drivers/etc/hosts" -Force
env:
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST_SSL }}
- name: PostgreSQL initialize configuration
working-directory: .github/resources/postgresql
run: |
Copy-Item -Path ./conf.d -Destination $env:PGDATA -Recurse -Force
"include_dir = 'conf.d'" >> (Join-Path -Path $env:PGDATA -ChildPath 'postgresql.conf')
- name: PostgreSQL SSL certificates initialize
id: openssl-initialize-postgresql-certificates
run: |
$folderPath = Join-Path -Path ${{ env.TinyRunnerWorkPath }} `
-ChildPath 'tiny-postgresql-certificates'
# Create an empty folder for generating certificates
New-Item -Type Directory $folderPath
"FolderPath=$folderPath" >> $env:GITHUB_OUTPUT
# This hash invalidates the PostgreSQL certificates cache every month
$hash = Get-Date -Format 'yyyyMM'
"Hash=$hash" >> $env:GITHUB_OUTPUT
- name: PostgreSQL SSL certificates restore cache
uses: actions/cache/restore@v3
id: openssl-cache-postgresql-certificates
with:
path: |
${{ env.folder_path }}/*.crt
${{ env.folder_path }}/*.key
key: ${{ runner.os }}-openssl-${{ env.cache_name }}-${{ env.cache_hash }}
env:
# This hash invalidates this certificates cache every month
cache_hash: ${{ steps.openssl-initialize-postgresql-certificates.outputs.Hash }}
cache_name: postgresql-certificates
folder_path: ${{ steps.openssl-initialize-postgresql-certificates.outputs.FolderPath }}
- name: PostgreSQL SSL certificates generate
if: steps.openssl-cache-postgresql-certificates.outputs.cache-hit != 'true'
working-directory: ${{ steps.openssl-initialize-postgresql-certificates.outputs.FolderPath }}
run: |
Write-Output '::group::Print openssl version'
openssl.exe version -a
Write-Output '::endgroup::'
Write-Output '::group::Create .rnd file'
openssl.exe rand -out ./.rnd -writerand ./.rnd
Write-Output '::endgroup::'
Write-Output '::group::CA certificate'
# -days 32 is important, -days 30 is not enough
openssl.exe req -new -x509 -nodes -subj $env:DB_PGSQL_SSL_SUBJECT_CA -days 32 `
-keyout ./root.key -out ./root.crt
Write-Output '::endgroup::'
Write-Output '::group::Server certificate'
openssl.exe req -new -nodes -subj $env:DB_PGSQL_SSL_SUBJECT_SERVER -keyout ./server.key `
-out ./server.csr
$env:OPENSSL_SAN = "DNS:${env:DB_PGSQL_HOST}"
openssl.exe x509 -req -CA ./root.crt -CAkey ./root.key -days 32 -set_serial 01 `
-extfile $env:extfile -in ./server.csr -out ./server.crt
Write-Output '::endgroup::'
Write-Output '::group::Client certificate'
openssl.exe req -new -nodes -subj $env:DB_PGSQL_SSL_SUBJECT_CLIENT `
-keyout ./postgresql.key -out postgresql.csr
$env:OPENSSL_SAN = "DNS:${env:DB_PGSQL_USERNAME}"
openssl.exe x509 -req -CA ./root.crt -CAkey ./root.key -days 32 -set_serial 02 `
-extfile $env:extfile -in ./postgresql.csr -out ./postgresql.crt
Write-Output '::endgroup::'
env:
extfile: ${{ github.workspace }}/.github/resources/openssl/usr_cert.cnf
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST_SSL }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
DB_PGSQL_SSL_SUBJECT_CA: ${{ secrets.DB_PGSQL_SSL_SUBJECT_CA }}
DB_PGSQL_SSL_SUBJECT_CLIENT: ${{ secrets.DB_PGSQL_SSL_SUBJECT_CLIENT }}
DB_PGSQL_SSL_SUBJECT_SERVER: ${{ secrets.DB_PGSQL_SSL_SUBJECT_SERVER }}
# Always verify, regardless if certificates were newly generated or restored from the cache
- name: PostgreSQL SSL certificates verify
working-directory: ${{ steps.openssl-initialize-postgresql-certificates.outputs.FolderPath }}
run: |
openssl.exe verify -CAfile ./root.crt ./server.crt ./postgresql.crt
# Save the cache only if certificates were newly generated
# The actions/cache/save allows to use the Move-Item during the install step
- name: PostgreSQL SSL certificates save cache
if: steps.openssl-cache-postgresql-certificates.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
${{ env.folder_path }}/*.crt
${{ env.folder_path }}/*.key
key: ${{ steps.openssl-cache-postgresql-certificates.outputs.cache-primary-key }}
env:
folder_path: ${{ steps.openssl-initialize-postgresql-certificates.outputs.FolderPath }}
- name: PostgreSQL SSL certificates install
working-directory: ${{ steps.openssl-initialize-postgresql-certificates.outputs.FolderPath }}
run: |
Write-Output '::group::Install server certificates'
Copy-Item -Path ./root.crt -Destination $env:PGDATA
Move-Item -Path ./server.crt, ./server.key -Destination $env:PGDATA
Write-Output '::endgroup::'
Write-Output '::group::Install client certificates'
$folderPath = Join-Path -Path $env:APPDATA -ChildPath 'postgresql'
New-Item -Type Directory $folderPath
Move-Item -Path ./postgresql.crt, ./postgresql.key, ./root.crt -Destination $folderPath
Write-Output '::endgroup::'
- name: PostgreSQL add PGBIN on the $env:Path
run: |
"$env:PGBIN" >> $env:GITHUB_PATH
- name: PostgreSQL service start
run: |
Set-Service -Name postgresql-x64-14 -StartupType Manual
Start-Service postgresql-x64-14
- name: PostgreSQL change ${{ secrets.DB_PGSQL_ROOT_USERNAME }} password
run: >-
"alter user `"$env:DB_PGSQL_ROOT_USERNAME`"
with password '$env:DB_PGSQL_ROOT_PASSWORD';" | psql.exe
env:
DB_PGSQL_ROOT_PASSWORD: ${{ secrets.DB_PGSQL_ROOT_PASSWORD }}
DB_PGSQL_ROOT_USERNAME: ${{ secrets.DB_PGSQL_ROOT_USERNAME }}
- name: PostgreSQL create TinyORM user
run: >-
"create user `"$env:DB_PGSQL_USERNAME`"
with createdb password '$env:DB_PGSQL_PASSWORD';" | psql.exe
env:
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
PGPASSWORD: ${{ secrets.DB_PGSQL_ROOT_PASSWORD }}
- name: PostgreSQL create TinyORM database
run: |
createdb.exe --owner=$env:DB_PGSQL_USERNAME $env:DB_PGSQL_DATABASE
env:
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
PGPASSWORD: ${{ secrets.DB_PGSQL_ROOT_PASSWORD }}
- name: PostgreSQL initialize client authentication
working-directory: .github/resources/postgresql
run: >-
$env:DB_PGSQL_DATABASE, $env:TINYORM_DATABASE_TESTS_SCHEMABUILDER |
Set-Content -Path (Join-Path -Path $env:PGDATA -ChildPath 'tinyorm_dbs')
$pgHbaConf = Join-Path -Path $env:PGDATA -ChildPath 'pg_hba.conf'
$pgHbaTmplTmpl = "`n`n" +
"# crystal`n" +
'hostssl @tinyorm_dbs {0} 127.0.0.1/32 ' +
'scram-sha-256 clientcert=verify-full'
$pgHbaTmpl = $pgHbaTmplTmpl -f $env:DB_PGSQL_USERNAME
(Get-Content -Path $pgHbaConf) -creplace
'(# +TYPE +DATABASE +USER +ADDRESS +METHOD)', "`$1$pgHbaTmpl" |
Set-Content -Path $pgHbaConf
env:
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_SSL_DN: ${{ secrets.DB_PGSQL_SSL_DN }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
TINYORM_DATABASE_TESTS_SCHEMABUILDER: ${{ secrets.TINYORM_DATABASE_TESTS_SCHEMABUILDER }}
- name: PostgreSQL service restart
run: |
Restart-Service postgresql-x64-14
- name: PostgreSQL service check status
run: |
$serviceName = 'postgresql-x64-14'
Write-Output '::group::Get-Service'
$pgsqlService = Get-Service $serviceName
Write-Output $pgsqlService
Write-Output '::endgroup::'
Write-Output '::group::Service running check'
$pgsqlService.status.ToString() -ceq 'Running' -or `
$(throw "$serviceName service is not running") > $null
Write-Output '::endgroup::'
Write-Output '::group::pg_isready'
pg_isready.exe
Write-Output '::endgroup::'
- name: Hosts add MySQL server hostname
run: >-
"127.0.0.1`t$env:DB_MYSQL_HOST" |
Add-Content -Path "$env:windir/System32/drivers/etc/hosts" -Force
env:
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST_SSL }}
- name: MySQL create data folder
run: |
New-Item -Type Directory '${{ env.TinyRunnerWorkPath }}/mysql/data'
- name: MySQL initialize my.ini configuration
working-directory: .github/resources/windows
run: >-
(Get-Content -Path ./my_8_ssl.template.ini) -creplace
'\{MYSQL_DATADIR\}', '${{ env.TinyRunnerWorkPath }}/mysql/data' -creplace
'\{MYSQL_HOST\}', $env:DB_MYSQL_HOST |
Set-Content -Path '${{ env.TinyMySQLInstallationPath }}/my.ini'
env:
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST_SSL }}
- name: MySQL initialize data directory
run: |
mysqld.exe --initialize-insecure --console
- name: MySQL generate SSL certificates
working-directory: ${{ env.TinyRunnerWorkPath }}/mysql/data
run: |
# It's enough to remove only these three certificate-related files
Remove-Item ./ca.pem, ./server-cert.pem, ./server-key.pem
mysql_ssl_rsa_setup.exe --suffix=TinyORM
- name: MySQL service install/start
run: |
mysqld.exe --install MySQL
Start-Service MySQL
- name: MySQL change ${{ secrets.DB_MYSQL_ROOT_USERNAME }} password
run: >-
"alter user '$env:DB_MYSQL_ROOT_USERNAME'@'localhost'
identified with caching_sha2_password by '$env:DB_MYSQL_ROOT_PASSWORD'
require issuer '/CN=MySQL_Server_TinyORM_Auto_Generated_CA_Certificate' and
subject '/CN=MySQL_Server_TinyORM_Auto_Generated_Client_Certificate';" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --skip-password
env:
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL time zone POSIX tables initialize download
id: downloads-initialize-mysql-timezone-tables
run: |
$filename = (Split-Path -Path $env:URL_MYSQL_TIMEZONE_TABLES -Leaf)
"Filename=$filename" >> $env:GITHUB_OUTPUT
$filepath = Join-Path -Path ${{ runner.temp }} -ChildPath $filename
"Filepath=$filepath" >> $env:GITHUB_OUTPUT
$basename = Split-Path -Path $filename -LeafBase
$extractedFolder = Join-Path -Path ${{ runner.temp }} -ChildPath $basename
"ExtractedFolder=$extractedFolder" >> $env:GITHUB_OUTPUT
"Hash=$basename" >> $env:GITHUB_OUTPUT
env:
URL_MYSQL_TIMEZONE_TABLES: ${{ secrets.URL_MYSQL_TIMEZONE_TABLES }}
- name: MySQL time zone POSIX tables restore cache (download)
uses: actions/cache@v3
id: downloads-cache-mysql-timezone-tables
with:
path: ${{ env.extracted_folder }}
key: ${{ runner.os }}-databases-${{ env.cache_name }}-${{ env.cache_hash }}
env:
cache_hash: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.Hash }}
cache_name: mysql-timezone-tables
extracted_folder: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.ExtractedFolder }}
- name: MySQL time zone POSIX tables download
if: steps.downloads-cache-mysql-timezone-tables.outputs.cache-hit != 'true'
run: >-
# $response = Invoke-WebRequest -Uri $env:URL_MYSQL_TIMEZONE_TABLES -HttpVersion 2.0
# $response | Select-Object -ExpandProperty Content |
Set-Content -Path $env:archive_filepath -AsByteStream
curl.exe --fail --silent --show-error --location --remote-name
--output-dir '${{ runner.temp }}' "$env:URL_MYSQL_TIMEZONE_TABLES"
7z.exe x -y -o'${{ runner.temp }}' "$env:archive_filepath"
env:
archive_filepath: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.Filepath }}
URL_MYSQL_TIMEZONE_TABLES: ${{ secrets.URL_MYSQL_TIMEZONE_TABLES }}
- name: MySQL populate time zone tables π
run: >-
$filepath = Join-Path -Path $env:extracted_folder -ChildPath 'timezone_posix.sql'
# source path can't be quoted, it works correctly even with spaces
"source $filepath" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --password=$env:DB_MYSQL_ROOT_PASSWORD mysql
Restart-Service MySQL
env:
extracted_folder: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.ExtractedFolder }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL service check status
run: |
$serviceName = 'MySQL'
Write-Output '::group::Get-Service'
$mysqlService = Get-Service MySQL
Write-Output $mysqlService
Write-Output '::endgroup::'
Write-Output '::group::Service running check'
$mysqlService.status.ToString() -ceq 'Running' -or `
$(throw "$serviceName service is not running") > $null
Write-Output '::endgroup::'
Write-Output '::group::Ping'
mysqladmin.exe --user=$env:DB_MYSQL_ROOT_USERNAME `
--password=$env:DB_MYSQL_ROOT_PASSWORD ping
Write-Output '::endgroup::'
env:
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL create TinyORM database
run: >-
"create database if not exists ``$env:DB_MYSQL_DATABASE``
default character set $env:DB_MYSQL_CHARSET
default collate $env:DB_MYSQL_COLLATION;" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --password=$env:DB_MYSQL_ROOT_PASSWORD
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL create TinyORM user
run: >-
"create user '$env:DB_MYSQL_USERNAME'@'%'
identified with caching_sha2_password by '$env:DB_MYSQL_PASSWORD'
require issuer '/CN=MySQL_Server_TinyORM_Auto_Generated_CA_Certificate' and
subject '/CN=MySQL_Server_TinyORM_Auto_Generated_Client_Certificate';
grant all privileges on ``tinyorm\_%``.* to '$env:DB_MYSQL_USERNAME'@'%';
grant select on ``mysql``.``time_zone_name`` to '$env:DB_MYSQL_USERNAME'@'%';
flush privileges;" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --password=$env:DB_MYSQL_ROOT_PASSWORD
env:
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
- name: MySQL add libmysql.dll on the $env:Path
run: |
'${{ env.TinyMySQLInstallationPath }}\lib' >> $env:GITHUB_PATH
- name: SQLite create TinyORM database
run: |
New-Item -Type Directory (Split-Path -Parent -Path '${{ env.TinySQLitePath }}')
New-Item -Type File -Path '${{ env.TinySQLitePath }}'
- name: Print MySQL, PostgreSQL database versions
run: |
Write-Output '::group::MySQL version'
mysql.exe --version
Write-Output '::endgroup::'
Write-Output '::group::PostgreSQL version'
postgres.exe --version
Write-Output '::endgroup::'
- name: Qt 6.5.3 install base components
uses: jurplel/install-qt-action@v3
with:
archives: qtbase
version: 6.5.3
arch: win64_msvc2019_64
cache: true
setup-python: false
extra: --external 7z.exe
dir: ${{ env.TinyRunnerWorkPath }}
- name: QMYSQL driver dlls initialize download (Qt 6.5.3)
id: downloads-initialize-qmysql-dlls
run: |
$filename = (Split-Path -Path $env:URL_QMYSQL_DLLS_MSVC_X64_6_5_3 -Leaf)
"Filename=$filename" >> $env:GITHUB_OUTPUT
$filepath = Join-Path -Path ${{ runner.temp }} -ChildPath $filename
"Filepath=$filepath" >> $env:GITHUB_OUTPUT
$response = Invoke-WebRequest -Uri $env:URL_CACHE_HASH_WINDOWS
"Hash=$($response.Content)" >> $env:GITHUB_OUTPUT
env:
URL_QMYSQL_DLLS_MSVC_X64_6_5_3: ${{ secrets.URL_QMYSQL_DLLS_MSVC_X64_6_5_3 }}
URL_CACHE_HASH_WINDOWS: ${{ secrets.URL_CACHE_HASH_WINDOWS }}
- name: QMYSQL driver dlls restore cache (download)
uses: actions/cache@v3
id: downloads-cache-qmysql-dlls
with:
path: ${{ env.archive_filepath }}
key: ${{ runner.os }}-drivers-${{ env.cache_name }}-${{ env.cache_hash }}
env:
archive_filepath: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Filepath }}
cache_hash: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Hash }}
cache_name: qmysql-dlls-qt6
- name: QMYSQL driver dlls download (Qt 6.5.3)
if: steps.downloads-cache-qmysql-dlls.outputs.cache-hit != 'true'
run: >-
$response = Invoke-WebRequest -Uri $env:URL_QMYSQL_DLLS_MSVC_X64_6_5_3
$response | Select-Object -ExpandProperty Content |
Set-Content -Path $env:archive_filepath -AsByteStream
env:
archive_filepath: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Filepath }}
URL_QMYSQL_DLLS_MSVC_X64_6_5_3: ${{ secrets.URL_QMYSQL_DLLS_MSVC_X64_6_5_3 }}
- name: QMYSQL driver dlls install (Qt 6.5.3)
working-directory: ${{ runner.temp }}
run: |
7z.exe x -y -o"$env:QT_PLUGIN_PATH/sqldrivers" $env:archive_filepath
env:
archive_filepath: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Filepath }}
- name: Cache LLVM and Clang
id: llvm-cache
uses: actions/cache@v3
with:
path: |
C:/Program Files/LLVM
key: llvm-17.0.2
- name: Install LLVM and Clang 17.0.2
uses: KyleMayes/install-llvm-action@v1
with:
version: 17.0.2
force-version: true
cached: ${{ steps.llvm-cache.outputs.cache-hit }}
- name: Ccache initialize
id: ccache-initialize-cache
run: |
Write-Output '::group::Install'
choco.exe install ccache --yes
Write-Output '::endgroup::'
Write-Output '::group::get-config cache_dir'
$cachePath = ccache.exe --get-config cache_dir
"CachePath=$cachePath" >> $env:GITHUB_OUTPUT
"ImageOS=$env:ImageOS" >> $env:GITHUB_OUTPUT
Write-Output '::endgroup::'
- name: Ccache restore cache πΊ
uses: actions/cache@v3
with:
path: ${{ env.cache_path }}
key: ${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-
env:
cache_name: clang-cl-msvc2022-qt65
cache_path: ${{ steps.ccache-initialize-cache.outputs.CachePath }}
image_os: ${{ steps.ccache-initialize-cache.outputs.ImageOS }}
- name: Ccache prepare configuration π₯³
run: |
# ~ 135 * 3 + 100
ccache.exe --set-config max_size=600M
ccache.exe --set-config sloppiness=pch_defines,time_macros
- name: Ccache print version and configuration
run: |
Write-Output '::group::Print version'
ccache.exe --version
Write-Output '::endgroup::'
Write-Output '::group::Print ccache config'
ccache.exe --show-config
Write-Output '::endgroup::'
- name: Visual Studio 2022 pwsh shell setup
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
# Must be after the ilammy/msvc-dev-cmd@v1 because vcvars64 overrides the VCPKG_ROOT
- name: vcpkg prepare environment
run: |
"VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV
'VCPKG_DEFAULT_TRIPLET=x64-windows' >> $env:GITHUB_ENV
'VCPKG_MAX_CONCURRENCY=2' >> $env:GITHUB_ENV
- name: CMake print version
run: |
cmake.exe --version
- name: TinyORM create build folder (clang-cl-cmake-debug)
run: |
New-Item -Type Directory '../TinyORM-builds-cmake/build-clang-cl-cmake-debug'
- name: Ccache clear statistics
run: |
ccache.exe --zero-stats
- name: TinyORM cmake configure (clang-cl-cmake-debug)
run: >-
cmake.exe
-S .
-B ../TinyORM-builds-cmake/build-clang-cl-cmake-debug
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH='C:/ProgramData/chocolatey/bin/ccache.exe'
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_C_COMPILER:FILEPATH="$env:LLVM_PATH/bin/clang-cl.exe"
-D CMAKE_CXX_COMPILER:FILEPATH="$env:LLVM_PATH/bin/clang-cl.exe"
-D CMAKE_EXPORT_PACKAGE_REGISTRY:BOOL=OFF
-D CMAKE_BUILD_TYPE:STRING=Debug
-D VCPKG_APPLOCAL_DEPS:BOOL=OFF
-D VERBOSE_CONFIGURE:BOOL=ON
-D MYSQL_PING:BOOL=ON
-D BUILD_TESTS:BOOL=ON
-D ORM:BOOL=ON
-D TOM:BOOL=ON
-D TOM_EXAMPLE:BOOL=ON
- name: TinyORM cmake build β¨ (clang-cl-cmake-debug)
run: >-
cmake.exe --build ../TinyORM-builds-cmake/build-clang-cl-cmake-debug --target all
--parallel 2
- name: Ccache print statistics
run: |
ccache.exe --show-stats -vv
- name: Create and Seed tables for unit tests π
working-directory: ../TinyORM-builds-cmake/build-clang-cl-cmake-debug/tests/testdata_tom
run: >-
$env:Path = '..\..;' + $env:Path
.\tom_testdata.exe migrate
--database=tinyorm_testdata_tom_mysql,tinyorm_testdata_tom_postgres,tinyorm_testdata_tom_sqlite
--seed --no-ansi
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST_SSL }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_SSL_CA: ${{ env.TinyRunnerWorkPath }}/mysql/data/ca.pem
DB_MYSQL_SSL_CERT: ${{ env.TinyRunnerWorkPath }}/mysql/data/client-cert.pem
DB_MYSQL_SSL_KEY: ${{ env.TinyRunnerWorkPath }}/mysql/data/client-key.pem
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST_SSL }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_SSLMODE: ${{ secrets.DB_PGSQL_SSLMODE }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_TESTDATA_ENV: testing
- name: TinyORM execute ctest π₯
working-directory: ../TinyORM-builds-cmake/build-clang-cl-cmake-debug
run: |
ctest.exe --output-on-failure
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST_SSL }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_SSL_CA: ${{ env.TinyRunnerWorkPath }}/mysql/data/ca.pem
DB_MYSQL_SSL_CERT: ${{ env.TinyRunnerWorkPath }}/mysql/data/client-cert.pem
DB_MYSQL_SSL_KEY: ${{ env.TinyRunnerWorkPath }}/mysql/data/client-key.pem
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST_SSL }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_SSLMODE: ${{ secrets.DB_PGSQL_SSLMODE }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_TESTS_ENV: testing
- name: Tom example test some commands (MySQL) π
working-directory: ../TinyORM-builds-cmake/build-clang-cl-cmake-debug/examples/tom
run: |
$env:Path = '..\..;' + $env:Path
.\tom.exe migrate:install --database=tinyorm_tom_mysql --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_mysql --no-ansi
.\tom.exe migrate --database=tinyorm_tom_mysql --seed --no-ansi
.\tom.exe migrate:refresh --database=tinyorm_tom_mysql --seed --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_mysql --no-ansi
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST_SSL }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_SSL_CA: ${{ env.TinyRunnerWorkPath }}/mysql/data/ca.pem
DB_MYSQL_SSL_CERT: ${{ env.TinyRunnerWorkPath }}/mysql/data/client-cert.pem
DB_MYSQL_SSL_KEY: ${{ env.TinyRunnerWorkPath }}/mysql/data/client-key.pem
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
TOM_EXAMPLE_ENV: testing
- name: Tom example test some commands (PostgreSQL) π
working-directory: ../TinyORM-builds-cmake/build-clang-cl-cmake-debug/examples/tom
run: |
$env:Path = '..\..;' + $env:Path
.\tom.exe migrate:install --database=tinyorm_tom_postgres --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_postgres --no-ansi
.\tom.exe migrate --database=tinyorm_tom_postgres --seed --no-ansi
.\tom.exe migrate:refresh --database=tinyorm_tom_postgres --seed --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_postgres --no-ansi
env:
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST_SSL }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_SSLMODE: ${{ secrets.DB_PGSQL_SSLMODE }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
TOM_EXAMPLE_ENV: testing
- name: Tom example test some commands (SQLite) π
working-directory: ../TinyORM-builds-cmake/build-clang-cl-cmake-debug/examples/tom
run: |
$env:Path = '..\..;' + $env:Path
.\tom.exe migrate:install --database=tinyorm_tom_sqlite --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_sqlite --no-ansi
.\tom.exe migrate --database=tinyorm_tom_sqlite --seed --no-ansi
.\tom.exe migrate:refresh --database=tinyorm_tom_sqlite --seed --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_sqlite --no-ansi
env:
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_EXAMPLE_ENV: testing