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.110.0 # (released in 2025) - dmd-2.109.1 # (released in 2024) - dmd-2.108.1 # (released in 2024) - dmd-2.107.1 # (released in 2024) - dmd-2.106.1 # (released in 2024) - 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.41.0 - ldc-1.40.1 # eq to dmd v2.110.0 - ldc-1.39.0 # eq to dmd v2.109.1 - ldc-1.38.0 # eq to dmd v2.108.1 - 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: ## LDC supports Apple silicon - { os: macos-latest, compiler: ldc-latest } ## macos-13 is the latest Mac runner with Intel cpu - { os: macos-13, compiler: dmd-latest } - { os: macos-13, compiler: ldc-latest } - { os: macos-13, compiler: dmd-2.108.1 } - { os: macos-13, compiler: ldc-1.32.2 } exclude: - { os: ubuntu-latest, compiler: dmd-2.107.1 } - { os: windows-latest, compiler: dmd-2.098.1 } - { os: windows-latest, compiler: dmd-2.097.2 } steps: - uses: actions/checkout@v5 - 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 unixodbc-dev -y - name: Install dependencies on Mac OSX if: startsWith(matrix.os, 'macos') run: brew bundle # Seems ODBC is missing on the latest macos runners so install using homebrew - name: Install ODBC on Mac OSX ${{ runner.arch }} if: ${{ startsWith(matrix.os, 'macos') && runner.arch == 'ARM64' }} run: | brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release brew update HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18 # - name: Upgrade dub dependencies # if: startsWith(matrix.os, 'windows') # uses: WebFreak001/dub-upgrade@v0.1 # full build - name: dub build (FULL) ${{ runner.arch }} run: dub build --config=full # 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 # Use the default arch (either x86_64 or aarch64 all platforms) - name: dub test with full config (${{ runner.arch }}) run: dub test --config=full #- name: dub run with test config (x86_64) # run: dub run --config=test --arch=x86_64 - name: run the ddbctest project (${{ runner.arch }}) working-directory: example run: dub build --config=SQLite && ./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-latest 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@v5 - name: Install latest DMD uses: dlang-community/setup-dlang@v1 with: compiler: dmd-latest - name: Install dependencies run: sudo apt-get update && sudo apt-get install libev-dev libpq-dev libevent-dev libsqlite3-dev unixodbc-dev -y - 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" --trust_server_certificate=yes