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