v / .github / workflows / db_ci.yml
117 lines · 112 sloc · 3.57 KB · 93162641ddda0809e8e8c2da69af8b13982567ee
Raw
1name: Database CI
2
3on:
4 workflow_dispatch:
5 push:
6 branches:
7 - master
8 paths-ignore:
9 - '**.md'
10 - '**.yml'
11 - '!**/db_ci.yml'
12 - 'examples/**'
13 - 'doc/**'
14 pull_request:
15 paths-ignore:
16 - '**.md'
17 - '**.yml'
18 - '!**/db_ci.yml'
19 - 'examples/**'
20 - 'doc/**'
21
22concurrency:
23 group: db-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
24 cancel-in-progress: true
25
26jobs:
27 mysql-driver-tests:
28 runs-on: ubuntu-24.04
29 timeout-minutes: 30
30 services:
31 mysql:
32 image: mysql:8.0
33 env:
34 MYSQL_ROOT_PASSWORD: 12345678
35 MYSQL_ROOT_HOST: '%'
36 ports:
37 - 3306:3306
38 options: >-
39 --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -p12345678"
40 --health-interval=10s
41 --health-timeout=5s
42 --health-retries=24
43 steps:
44 - uses: actions/checkout@v6
45 - name: Build V
46 run: make -j4 && ./v symlink
47 - name: Install mysql client headers
48 run: |
49 .github/workflows/disable_azure_mirror.sh
50 ./v retry -- sudo apt update
51 ./v retry -- sudo apt install --quiet -y libmariadb-dev
52 - name: Run mysql driver tests
53 run: ./v -d network -d started_mysqld -silent test vlib/db/mysql/
54
55 postgres-driver-tests:
56 runs-on: ubuntu-24.04
57 timeout-minutes: 30
58 services:
59 postgres:
60 image: postgres:16
61 env:
62 POSTGRES_PASSWORD: 12345678
63 ports:
64 - 5432:5432
65 options: >-
66 --health-cmd="pg_isready -U postgres -d postgres"
67 --health-interval=10s
68 --health-timeout=5s
69 --health-retries=24
70 steps:
71 - uses: actions/checkout@v6
72 - name: Build V
73 run: make -j4 && ./v symlink
74 - name: Install postgres client headers
75 run: |
76 .github/workflows/disable_azure_mirror.sh
77 ./v retry -- sudo apt update
78 ./v retry -- sudo apt install --quiet -y libpq-dev
79 - name: Run postgres driver tests
80 run: ./v -d network -d started_postgres -silent test vlib/db/pg/
81
82 mssql-driver-tests:
83 runs-on: ubuntu-24.04
84 timeout-minutes: 30
85 services:
86 mssql:
87 image: mcr.microsoft.com/mssql/server:2022-latest
88 env:
89 ACCEPT_EULA: Y
90 MSSQL_PID: Developer
91 MSSQL_SA_PASSWORD: Vlang12345678!
92 ports:
93 - 1433:1433
94 steps:
95 - uses: actions/checkout@v6
96 - name: Build V
97 run: make -j4 && ./v symlink
98 - name: Install ODBC dependencies
99 run: |
100 .github/workflows/disable_azure_mirror.sh
101 [ -f /usr/share/keyrings/microsoft-prod.gpg ] || curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --batch --no-tty --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
102 curl -fsSL https://packages.microsoft.com/config/ubuntu/24.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
103 ./v retry -- sudo apt update
104 sudo ACCEPT_EULA=Y apt install --quiet -y msodbcsql18 unixodbc-dev
105 - name: Wait for sql server
106 run: |
107 for _ in $(seq 1 60); do
108 if (echo > /dev/tcp/127.0.0.1/1433) >/dev/null 2>&1; then
109 exit 0
110 fi
111 sleep 2
112 done
113 exit 1
114 - name: Run mssql driver tests
115 env:
116 VMSSQL_CONN_STR: 'Driver={ODBC Driver 18 for SQL Server};Server=127.0.0.1;Port=1433;UID=sa;PWD=Vlang12345678!;Database=master;TrustServerCertificate=yes'
117 run: ./v -d network -d started_mssql -silent test vlib/db/mssql/
118