CI #198
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
# Overall ddbc should work on the last 10 minor compiler releases (same as Vibe.d). | |
# For simplicity and speed of the CI, some compiler versions are skipped. The latest | |
# versions of dmd and ldc must be tested on all platforms (Windows, Linux, and Mac) | |
# with older compilers only being tested on Windows/Linux. | |
# The integration testing is done on Linux against Mysql and Postgres | |
on: | |
schedule: | |
- cron: '30 7 1 * *' | |
push: | |
pull_request: | |
jobs: | |
test: | |
name: ${{ matrix.compiler }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, windows-latest ] | |
compiler: | |
- dmd-latest | |
- ldc-latest | |
- dmd-2.105.3 # (released in 2023) | |
- dmd-2.104.2 # (released in 2023) | |
- dmd-2.103.1 # (released in 2023) | |
- dmd-2.102.2 # (released in 2023) | |
- dmd-2.101.2 # (released in 2023) | |
- dmd-2.100.2 # (released in 2022) ## GDC 12 can support 2.100 | |
- dmd-2.099.1 # (released in 2022) | |
- dmd-2.098.1 # (released in 2021) ## Has issue re: phobos/std/variant.d | |
- dmd-2.097.2 # (released in 2021) | |
- ldc-1.33.0 # eq to dmd v2.103.1 | |
- ldc-1.32.2 # eq to dmd v2.102.2 | |
- ldc-1.28.1 # eq to dmd v2.098.1 | |
- ldc-1.27.1 # eq to dmd v2.097.2 | |
include: | |
- { os: macos-latest, compiler: dmd-latest } | |
- { os: macos-latest, compiler: ldc-latest } | |
- { os: macos-latest, compiler: dmd-2.100.2 } | |
- { os: macos-latest, compiler: ldc-1.32.2 } | |
exclude: | |
- { os: windows-latest, compiler: dmd-2.098.1 } | |
- { os: windows-latest, compiler: dmd-2.097.2 } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install D ${{ matrix.compiler }} | |
uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
- name: Install dependencies on Ubuntu | |
if: startsWith(matrix.os, 'ubuntu') | |
run: sudo apt-get update && sudo apt-get install libev-dev libpq-dev libevent-dev libsqlite3-dev -y | |
- name: Install dependencies on Mac OSX | |
if: startsWith(matrix.os, 'macos') | |
run: brew bundle | |
- name: Upgrade dub dependencies | |
if: startsWith(matrix.os, 'windows') | |
uses: WebFreak001/dub-upgrade@v0.1 | |
# full build | |
- name: dub build (FULL) | |
run: dub build --config=full --arch=x86_64 | |
# x86 (Windows Only) | |
- name: dub test with full config (x86) | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
run: dub test --config=full --arch=x86 | |
#- name: dub run with test config (x86) | |
# if: ${{ startsWith(matrix.os, 'windows') }} | |
# run: dub run --config=test --arch=x86 | |
- name: run the ddbctest project (x86) | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
working-directory: example | |
run: dub build --config=SQLite --arch=x86 && ./ddbctest --connection=sqlite:ddbc-test.sqlite | |
# x86_64 (all platforms) | |
- name: dub test with full config (x86_64) | |
run: dub test --config=full --arch=x86_64 | |
#- name: dub run with test config (x86_64) | |
# run: dub run --config=test --arch=x86_64 | |
- name: run the ddbctest project (x86_64) | |
working-directory: example | |
run: dub build --config=SQLite --arch=x86_64 && ./ddbctest --connection=sqlite:ddbc-test.sqlite | |
# x86_mscoff (Windows with dmd Only) | |
- name: dub test with full config (x86_mscoff) | |
if: ${{ startsWith(matrix.os, 'windows') && startsWith(matrix.compiler, 'dmd') }} | |
run: dub test --config=full --arch=x86_mscoff | |
#- name: dub run with test config (x86_mscoff) | |
# if: ${{ startsWith(matrix.os, 'windows') && startsWith(matrix.compiler, 'dmd') }} | |
# run: dub run --config=test --arch=x86_mscoff | |
- name: run the ddbctest project (x86_mscoff) | |
if: ${{ startsWith(matrix.os, 'windows') && startsWith(matrix.compiler, 'dmd') }} | |
working-directory: example | |
run: dub build --config=SQLite --arch=x86_mscoff && ./ddbctest --connection=sqlite:ddbc-test.sqlite | |
# cache | |
- uses: WebFreak001/dub-upgrade@v0.1 | |
if: startsWith(matrix.os, 'windows') | |
with: { store: true } | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-20.04 | |
services: | |
mysql: | |
image: mysql:5.7 | |
ports: [3306] | |
env: | |
MYSQL_ROOT_PASSWORD: f48dfhw3Hd!Asah7i2aZ | |
MYSQL_DATABASE: testdb | |
MYSQL_USER: testuser | |
MYSQL_PASSWORD: passw0rd | |
# Set health checks to wait until mysql service has started | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 3s | |
--health-retries 4 | |
postgres: | |
image: postgres | |
ports: [5432] | |
env: | |
POSTGRES_DB: testdb | |
POSTGRES_USER: testuser | |
POSTGRES_PASSWORD: passw0rd | |
# Set health checks to wait until postgres service has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 3s | |
--health-retries 3 | |
mssql: | |
#image: microsoft/mssql-server-linux:2017-latest | |
#image: mcr.microsoft.com/mssql/server:2019-latest | |
image: mcr.microsoft.com/mssql/server:2022-latest | |
ports: [1433] | |
env: | |
MSSQL_PID: Developer | |
SA_PASSWORD: MSbbk4k77JKH88g54 | |
ACCEPT_EULA: Y | |
# options: >- | |
# --health-cmd "sqlcmd -S localhost -U sa -P MSbbk4k77JKH88g54 -Q 'SELECT 1' || exit 1" | |
# --health-interval 10s | |
# --health-timeout 3s | |
# --health-retries 3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install latest DMD | |
uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: dmd-latest | |
- name: Install Microsoft ODBC | |
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y | |
- name: Run ddbctest | |
env: | |
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} | |
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }} | |
MSSQL_PORT: ${{ job.services.mssql.ports[1433] }} | |
run: dub run --config=test | |
- name: Build The Example Project | |
working-directory: ./example | |
run: dub build | |
- name: Run The Examples (SQLite) | |
working-directory: ./example | |
run: | | |
./ddbctest --connection=sqlite::memory: | |
- name: Run The Examples (MySQL) | |
working-directory: ./example | |
env: | |
PORT: ${{ job.services.mysql.ports[3306] }} | |
run: | | |
./ddbctest --connection=mysql://127.0.0.1:$PORT --database=testdb --user=testuser --password=passw0rd | |
- name: Run The Examples (Postgres) | |
working-directory: ./example | |
env: | |
PORT: ${{ job.services.postgres.ports[5432] }} | |
run: | | |
./ddbctest --connection=postgresql://127.0.0.1:$PORT --database=testdb --user=testuser --password=passw0rd | |
- name: Run The Examples (SQL Server) | |
working-directory: ./example | |
env: | |
PORT: ${{ job.services.mssql.ports[1433] }} | |
run: | | |
./ddbctest --connection=odbc://127.0.0.1:$PORT --user=SA --password=MSbbk4k77JKH88g54 --driver="ODBC Driver 18 for SQL Server" --trusted_connection=yes |