From 866f7f161aea06910bab8859efe6e6eb56dd95de Mon Sep 17 00:00:00 2001 From: SingingBush Date: Fri, 7 May 2021 16:39:30 +0100 Subject: [PATCH 01/20] #227 use Github Actions for CI --- .github/workflows/dub.yml | 139 ++++++++++++++++++++++++++++++++++++++ README.md | 5 ++ 2 files changed, 144 insertions(+) create mode 100644 .github/workflows/dub.yml diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml new file mode 100644 index 00000000..122533a2 --- /dev/null +++ b/.github/workflows/dub.yml @@ -0,0 +1,139 @@ +name: CI + +# Overall MySQL Native should work on the last 10 minor compiler releases (same as Vibe.d). +# For simplicity and speed of the CI, the latest versions of dmd and ldc must are tested on +# all platforms (Windows, Linux, and Mac) with older compilers only being tested on Windows/Linux. +# The integration testing (via examples) is done on Linux against Mysql 5.7 + +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, macos-latest ] + compiler: + - dmd-latest + - ldc-latest + - dmd-2.096.1 + - dmd-2.095.1 + - dmd-2.094.2 + - ldc-1.25.1 # eq to dmd v2.095.1 + - ldc-1.24.0 # eq to dmd v2.094.1 + steps: + - uses: actions/checkout@v2 + + - 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 + uses: WebFreak001/dub-upgrade@v0.1 + + - name: Ensure project builds + run: dub build + + # - name: Run Tests (phobos) + # run: ./run_tests --mode=phobos + + # - name: Run Tests (vibe) + # run: ./run_tests --mode=vibe + + # cache + - uses: WebFreak001/dub-upgrade@v0.1 + if: startsWith(matrix.os, 'windows') + with: { store: true } + + # Older compiler versions + test-older: + name: ${{ matrix.compiler }} on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, windows-latest ] # don't bother with macos-latest + compiler: + - dmd-2.093.1 + - dmd-2.092.1 + - dmd-2.091.1 + - dmd-2.090.1 + - dmd-2.089.1 + - ldc-1.23.0 # eq to dmd v2.093.1 + - ldc-1.22.0 # eq to dmd v2.092.1 + - ldc-1.21.0 # eq to dmd v2.091.1 + - ldc-1.20.1 # eq to dmd v2.090.1 + - ldc-1.19.0 # eq to dmd v2.089.1 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + + - 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: Upgrade dub dependencies + uses: WebFreak001/dub-upgrade@v0.1 + + - name: Ensure project builds + run: dub build + + # cache + - uses: WebFreak001/dub-upgrade@v0.1 + 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 + + steps: + - uses: actions/checkout@v2 + + - name: Install latest DMD + uses: dlang-community/setup-dlang@v1 + with: + compiler: dmd-latest + + - name: Build The Example Project + working-directory: ./examples/homePage + run: dub build + + - name: Run The Examples (SQLite) + working-directory: ./examples/homePage + run: | + ./example "host=localhost;port=3306;user=testuser;pwd=passw0rd;db=testdb" diff --git a/README.md b/README.md index 5a896f18..04d1d9e1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +MySQL native +============ + +[![DUB Package](https://img.shields.io/dub/v/mysql-native.svg)](https://code.dlang.org/packages/mysql-native) +[![GitHub CI](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml/badge.svg)](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml) [![Build Status](https://travis-ci.org/mysql-d/mysql-native.svg?branch=master)](https://travis-ci.org/mysql-d/mysql-native) A [Boost-licensed](http://www.boost.org/LICENSE_1_0.txt) native [D](http://dlang.org) From 426fc831d690fe9d615e66df94e24e6263a5c5e6 Mon Sep 17 00:00:00 2001 From: SingingBush Date: Fri, 7 May 2021 17:43:31 +0100 Subject: [PATCH 02/20] remove dub selections from repo --- dub.selections.json | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 dub.selections.json diff --git a/dub.selections.json b/dub.selections.json deleted file mode 100644 index c849738f..00000000 --- a/dub.selections.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "libev": "5.0.0+4.04", - "libevent": "2.0.1+2.0.16", - "memutils": "0.4.13", - "openssl": "1.1.4+1.0.1g", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.6", - "unit-threaded": "0.7.45", - "vibe-core": "1.7.0" - } -} From 26b0c7c564caca3657904d3a22019072142203d6 Mon Sep 17 00:00:00 2001 From: SingingBush Date: Fri, 7 May 2021 17:53:50 +0100 Subject: [PATCH 03/20] update dependencies --- .gitignore | 5 ++++- ddox/.gitignore | 5 ++++- ddox/dub.sdl | 6 +++--- ddox/dub.selections.json | 20 -------------------- dub.sdl | 8 ++++---- 5 files changed, 15 insertions(+), 29 deletions(-) delete mode 100644 ddox/dub.selections.json diff --git a/.gitignore b/.gitignore index 4005ad83..a2c732fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ +# Ignore dub output (selections should not be committed) +.dub/ +dub.selections.json + *.[oa] *.so *.lib *.dll *.exe -.dub /bin /testConnectionStr.txt diff --git a/ddox/.gitignore b/ddox/.gitignore index cc4a2deb..5f4316f3 100644 --- a/ddox/.gitignore +++ b/ddox/.gitignore @@ -1,4 +1,7 @@ -.dub +# Ignore dub output (selections should not be committed) +.dub/ +dub.selections.json + /ddox /__* node_modules diff --git a/ddox/dub.sdl b/ddox/dub.sdl index 5de527db..176e1fe5 100644 --- a/ddox/dub.sdl +++ b/ddox/dub.sdl @@ -4,9 +4,9 @@ homepage "https://github.com/rejectedsoftware/ddox" authors "Sönke Ludwig" license "MIT" -dependency "vibe-d:web" version=">=0.7.31 <0.9.0" -dependency "hyphenate" version="~>1.1.0" -dependency "libdparse" version="~>0.8.0" +dependency "vibe-d:web" version=">=0.9.0" +dependency "hyphenate" version="~>1.1.2" +dependency "libdparse" version="~>0.17.0" configuration "application" { targetType "executable" diff --git a/ddox/dub.selections.json b/ddox/dub.selections.json deleted file mode 100644 index 1427570c..00000000 --- a/ddox/dub.selections.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "botan": "1.12.10", - "botan-math": "1.0.3", - "diet-ng": "1.5.0", - "eventcore": "0.8.35", - "hyphenate": "1.1.1", - "libasync": "0.8.3", - "libdparse": "0.8.7", - "libevent": "2.0.2+2.0.16", - "memutils": "0.4.11", - "mir-linux-kernel": "1.0.0", - "openssl": "1.1.6+1.0.1g", - "stdx-allocator": "2.77.2", - "taggedalgebraic": "0.10.11", - "vibe-core": "1.4.0", - "vibe-d": "0.8.4" - } -} diff --git a/dub.sdl b/dub.sdl index 2ea56cc1..9b07b4d8 100644 --- a/dub.sdl +++ b/dub.sdl @@ -4,7 +4,7 @@ license "BSL-1.0" copyright "Copyright (c) 2011-2019 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, and Nick Sabalausky" authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky" -dependency "vibe-core" version="~>1.0" optional=true +dependency "vibe-core" version="~>1.16.0" optional=true sourcePaths "source/" importPaths "source/" @@ -35,7 +35,7 @@ configuration "unittest-vibe" { targetName "mysqln-tests-vibe" excludedSourceFiles "source/app.d" - dependency "vibe-core" version="~>1.0" optional=false + dependency "vibe-core" version="~>1.16.0" optional=false mainSourceFile "source/mysql/package.d" debugVersions "MYSQLN_TESTS" @@ -51,9 +51,9 @@ configuration "unittest-vibe-ut" { importPaths "bin/" buildOptions "unittests" - dependency "vibe-core" version="~>1.0" optional=false + dependency "vibe-core" version="~>1.16.0" optional=false - dependency "unit-threaded" version="~>0.7.45" + dependency "unit-threaded" version="~>1.0.15" debugVersions "MYSQLN_TESTS" versions "MYSQLN_TESTS_NO_MAIN" From 3c89950e0b35cdfe0c2287fe71a34191f45d4495 Mon Sep 17 00:00:00 2001 From: SingingBush Date: Sat, 8 May 2021 10:06:09 +0100 Subject: [PATCH 04/20] Build release version with library config --- .github/workflows/dub.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index 122533a2..e3a9d12a 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -46,8 +46,13 @@ jobs: - name: Upgrade dub dependencies uses: WebFreak001/dub-upgrade@v0.1 - - name: Ensure project builds - run: dub build + - name: Build Library + run: dub build --build=release --config=library + + ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not + ## actually a unit test at all. It's an integration test and should be pulled out of the codebase. + # - name: Run unittest-vibe-ut + # run: dub run -c unittest-vibe-ut -- -t # - name: Run Tests (phobos) # run: ./run_tests --mode=phobos @@ -73,6 +78,15 @@ jobs: - dmd-2.091.1 - dmd-2.090.1 - dmd-2.089.1 + - dmd-2.088.1 + - dmd-2.087.1 + - dmd-2.086.1 + - dmd-2.085.1 + - dmd-2.084.1 + - dmd-2.083.1 + - dmd-2.082.1 + - dmd-2.081.2 + - dmd-2.080.1 - ldc-1.23.0 # eq to dmd v2.093.1 - ldc-1.22.0 # eq to dmd v2.092.1 - ldc-1.21.0 # eq to dmd v2.091.1 @@ -94,8 +108,13 @@ jobs: - name: Upgrade dub dependencies uses: WebFreak001/dub-upgrade@v0.1 - - name: Ensure project builds - run: dub build + - name: Build Library + run: dub build --build=release --config=library + + ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not + ## actually a unit test at all. It's an integration test and should be pulled out of the codebase. + # - name: Run unittest-vibe-ut + # run: dub run -c unittest-vibe-ut -- -t # cache - uses: WebFreak001/dub-upgrade@v0.1 From 3c3d41fa231979a45147daedbed1c1bf64abee66 Mon Sep 17 00:00:00 2001 From: SingingBush Date: Sun, 9 May 2021 01:52:44 +0100 Subject: [PATCH 05/20] remove selections from example project --- .github/workflows/dub.yml | 10 +++++++--- dub.sdl | 2 ++ examples/homePage/dub.sdl | 9 ++++++++- examples/homePage/dub.selections.json | 15 --------------- .../homePage/dub.selections.vibecore-1.0.0.json | 11 ----------- .../homePage/dub.selections.vibecore-1.1.1.json | 11 ----------- .../homePage/dub.selections.vibecore-1.2.0.json | 11 ----------- .../homePage/dub.selections.vibecore-1.3.0.json | 11 ----------- .../homePage/dub.selections.vibecore-1.4.0.json | 12 ------------ .../homePage/dub.selections.vibecore-1.4.3.json | 12 ------------ .../homePage/dub.selections.vibecore-1.4.7.json | 12 ------------ .../homePage/dub.selections.vibecore-1.5.0.json | 12 ------------ .../homePage/dub.selections.vibecore-1.6.0.json | 12 ------------ .../homePage/dub.selections.vibecore-1.6.2.json | 12 ------------ .../homePage/dub.selections.vibecore-1.7.0.json | 15 --------------- 15 files changed, 17 insertions(+), 150 deletions(-) delete mode 100644 examples/homePage/dub.selections.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.0.0.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.1.1.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.2.0.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.3.0.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.4.0.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.4.3.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.4.7.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.5.0.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.6.0.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.6.2.json delete mode 100644 examples/homePage/dub.selections.vibecore-1.7.0.json diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index e3a9d12a..71a0f697 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -37,7 +37,7 @@ jobs: # - 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 + # run: sudo apt-get update && sudo apt-get install libevent-dev -y # - name: Install dependencies on Mac OSX # if: startsWith(matrix.os, 'macos') @@ -103,7 +103,7 @@ jobs: # - 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 + # run: sudo apt-get update && sudo apt-get install libevent-dev -y - name: Upgrade dub dependencies uses: WebFreak001/dub-upgrade@v0.1 @@ -148,11 +148,15 @@ jobs: with: compiler: dmd-latest + - name: Install dependencies on Ubuntu + if: startsWith(matrix.os, 'ubuntu') + run: sudo apt-get update && sudo apt-get install libevent-dev -y + - name: Build The Example Project working-directory: ./examples/homePage run: dub build - - name: Run The Examples (SQLite) + - name: Run Example (MySQL 5.7) working-directory: ./examples/homePage run: | ./example "host=localhost;port=3306;user=testuser;pwd=passw0rd;db=testdb" diff --git a/dub.sdl b/dub.sdl index 9b07b4d8..016d0c1b 100644 --- a/dub.sdl +++ b/dub.sdl @@ -6,6 +6,8 @@ authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "S dependency "vibe-core" version="~>1.16.0" optional=true +toolchainRequirements frontend=">=2.068" + sourcePaths "source/" importPaths "source/" diff --git a/examples/homePage/dub.sdl b/examples/homePage/dub.sdl index a5f10e85..45330fa9 100644 --- a/examples/homePage/dub.sdl +++ b/examples/homePage/dub.sdl @@ -1,5 +1,12 @@ name "example" -dependency "mysql-native" path="../.." +description "Simple example of using MySQL Native" +dependency "mysql-native" path="../../" targetType "executable" sourcePaths "." mainSourceFile "example.d" + +configuration "default" { + subConfiguration "mysql-native" "library" + //subConfiguration "vibe-d" "win32" platform="windows-x86_64-dmd" + //excludedSourceFiles "../../source/app.d" +} \ No newline at end of file diff --git a/examples/homePage/dub.selections.json b/examples/homePage/dub.selections.json deleted file mode 100644 index c849738f..00000000 --- a/examples/homePage/dub.selections.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "libev": "5.0.0+4.04", - "libevent": "2.0.1+2.0.16", - "memutils": "0.4.13", - "openssl": "1.1.4+1.0.1g", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.6", - "unit-threaded": "0.7.45", - "vibe-core": "1.7.0" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.0.0.json b/examples/homePage/dub.selections.vibecore-1.0.0.json deleted file mode 100644 index 26606359..00000000 --- a/examples/homePage/dub.selections.vibecore-1.0.0.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.6", - "unit-threaded": "0.7.45", - "vibe-core": "1.0.0" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.1.1.json b/examples/homePage/dub.selections.vibecore-1.1.1.json deleted file mode 100644 index 5a2455fb..00000000 --- a/examples/homePage/dub.selections.vibecore-1.1.1.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.1.1" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.2.0.json b/examples/homePage/dub.selections.vibecore-1.2.0.json deleted file mode 100644 index 1ff86062..00000000 --- a/examples/homePage/dub.selections.vibecore-1.2.0.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.2.0" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.3.0.json b/examples/homePage/dub.selections.vibecore-1.3.0.json deleted file mode 100644 index f722fb93..00000000 --- a/examples/homePage/dub.selections.vibecore-1.3.0.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.3.0" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.4.0.json b/examples/homePage/dub.selections.vibecore-1.4.0.json deleted file mode 100644 index 0988f214..00000000 --- a/examples/homePage/dub.selections.vibecore-1.4.0.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.4.0" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.4.3.json b/examples/homePage/dub.selections.vibecore-1.4.3.json deleted file mode 100644 index c4570a6f..00000000 --- a/examples/homePage/dub.selections.vibecore-1.4.3.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.4.3" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.4.7.json b/examples/homePage/dub.selections.vibecore-1.4.7.json deleted file mode 100644 index 378c1a77..00000000 --- a/examples/homePage/dub.selections.vibecore-1.4.7.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.4.7" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.5.0.json b/examples/homePage/dub.selections.vibecore-1.5.0.json deleted file mode 100644 index 15ba3222..00000000 --- a/examples/homePage/dub.selections.vibecore-1.5.0.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.5.0" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.6.0.json b/examples/homePage/dub.selections.vibecore-1.6.0.json deleted file mode 100644 index 52f1deac..00000000 --- a/examples/homePage/dub.selections.vibecore-1.6.0.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.6.0" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.6.2.json b/examples/homePage/dub.selections.vibecore-1.6.2.json deleted file mode 100644 index 15246c7b..00000000 --- a/examples/homePage/dub.selections.vibecore-1.6.2.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.6.2" - } -} diff --git a/examples/homePage/dub.selections.vibecore-1.7.0.json b/examples/homePage/dub.selections.vibecore-1.7.0.json deleted file mode 100644 index c849738f..00000000 --- a/examples/homePage/dub.selections.vibecore-1.7.0.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "libev": "5.0.0+4.04", - "libevent": "2.0.1+2.0.16", - "memutils": "0.4.13", - "openssl": "1.1.4+1.0.1g", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.6", - "unit-threaded": "0.7.45", - "vibe-core": "1.7.0" - } -} From fb8d6e8adccf7569c7ba8d1b2d6e90cbcd899e90 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 17:45:25 +0100 Subject: [PATCH 06/20] remove mainSourceFile from unittest-vibe config --- dub.sdl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dub.sdl b/dub.sdl index 016d0c1b..ad7ae6ae 100644 --- a/dub.sdl +++ b/dub.sdl @@ -39,7 +39,7 @@ configuration "unittest-vibe" { dependency "vibe-core" version="~>1.16.0" optional=false - mainSourceFile "source/mysql/package.d" + // mainSourceFile "source/mysql/package.d" debugVersions "MYSQLN_TESTS" } From fd102cfed17dfa2cf4cb92fcd482cb37f4701c55 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 17:51:20 +0100 Subject: [PATCH 07/20] set MySQL port on Github Action --- .github/workflows/dub.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index 71a0f697..9fd3a1a0 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -158,5 +158,7 @@ jobs: - name: Run Example (MySQL 5.7) working-directory: ./examples/homePage + env: + PORT: ${{ job.services.mysql.ports[3306] }} run: | - ./example "host=localhost;port=3306;user=testuser;pwd=passw0rd;db=testdb" + ./example "host=localhost;port=$PORT;user=testuser;pwd=passw0rd;db=testdb" From 9c1cee0cfe61dc57b971ec402a45b44e06ce6887 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 17:53:43 +0100 Subject: [PATCH 08/20] disable travis builds --- .travis.yml => .old-travis-build-backup.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml => .old-travis-build-backup.yml (100%) diff --git a/.travis.yml b/.old-travis-build-backup.yml similarity index 100% rename from .travis.yml rename to .old-travis-build-backup.yml From 194974a45d511eeeb609d35c61ee9454cd51bf2b Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 18:00:02 +0100 Subject: [PATCH 09/20] example code creates table --- examples/homePage/example.d | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/homePage/example.d b/examples/homePage/example.d index b992b28c..2ce81da2 100644 --- a/examples/homePage/example.d +++ b/examples/homePage/example.d @@ -11,9 +11,14 @@ void main(string[] args) Connection conn = new Connection(connectionStr); scope(exit) conn.close(); - // Insert - ulong rowsAffected = conn.exec( - "INSERT INTO `tablename` (`id`, `name`) VALUES (1, 'Ann'), (2, 'Bob')"); + // Create the schema + conn.exec("CREATE TABLE IF NOT EXISTS `tablename` ( + `id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + `name` VARCHAR(250) + )"); + + // Insert Some Test Data + ulong rowsAffected = conn.exec("INSERT INTO `tablename` (`id`, `name`) VALUES (1, 'Ann'), (2, 'Bob')"); // Query ResultRange range = conn.query("SELECT * FROM `tablename`"); From b285b332b9f419ff5d886f0119fedb9aabb91138 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 18:11:11 +0100 Subject: [PATCH 10/20] change definition of id column on test table --- examples/homePage/example.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/homePage/example.d b/examples/homePage/example.d index 2ce81da2..708709ad 100644 --- a/examples/homePage/example.d +++ b/examples/homePage/example.d @@ -11,9 +11,9 @@ void main(string[] args) Connection conn = new Connection(connectionStr); scope(exit) conn.close(); - // Create the schema + // Create the schema (Would rather have `id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT but for now just get tests working) conn.exec("CREATE TABLE IF NOT EXISTS `tablename` ( - `id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + `id` INTEGER, `name` VARCHAR(250) )"); @@ -57,6 +57,7 @@ void main(string[] args) conn.exec( "INSERT INTO `tablename` (`id`, `name`) VALUES (?,?)", null, "Cam"); // Can also take Nullable!T + range = conn.query("SELECT * FROM `tablename` WHERE `name`='Cam'"); assert( range.front[0].type == typeid(typeof(null)) ); } From 3e1a92991689282102cb742be1022d60d2a9ef33 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 19:57:53 +0100 Subject: [PATCH 11/20] run unittest-vibe-ut config --- .github/workflows/dub.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index 9fd3a1a0..b658d2f3 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -93,6 +93,24 @@ jobs: - ldc-1.20.1 # eq to dmd v2.090.1 - ldc-1.19.0 # eq to dmd v2.089.1 runs-on: ${{ matrix.os }} + + services: + mysql: + image: mysql:5.7 + ports: [3306] + # Set the connection details to match testConnectionStr.txt + env: + MYSQL_ROOT_PASSWORD: f48dfhw3Hd!Asah7i2aZ + MYSQL_DATABASE: mysqln_testdb + MYSQL_USER: mysqln_test + MYSQL_PASSWORD: pass123 + # Set health checks to wait until mysql service has started + options: >- + --health-cmd "mysqladmin ping" + --health-interval 10s + --health-timeout 3s + --health-retries 4 + steps: - uses: actions/checkout@v2 @@ -113,8 +131,12 @@ jobs: ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not ## actually a unit test at all. It's an integration test and should be pulled out of the codebase. - # - name: Run unittest-vibe-ut - # run: dub run -c unittest-vibe-ut -- -t + - name: Run unittest-vibe-ut + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + echo "host=localhost;port=$MYSQL_PORT;user=mysqln_test;pwd=pass123;db=mysqln_testdb" > testConnectionStr.txt + dub run -c unittest-vibe-ut -- -t # cache - uses: WebFreak001/dub-upgrade@v0.1 From df5f5e5ab334d3a7cd83d8133faf5ee2752c7da0 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 20:25:28 +0100 Subject: [PATCH 12/20] move unittest-vibe-ut stage to Integration Test stage --- .github/workflows/dub.yml | 71 ++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index b658d2f3..cfb03f1e 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -12,7 +12,7 @@ on: pull_request: jobs: - test: + build: name: ${{ matrix.compiler }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -66,7 +66,7 @@ jobs: with: { store: true } # Older compiler versions - test-older: + build-older: name: ${{ matrix.compiler }} on ${{ matrix.os }} strategy: fail-fast: false @@ -94,23 +94,6 @@ jobs: - ldc-1.19.0 # eq to dmd v2.089.1 runs-on: ${{ matrix.os }} - services: - mysql: - image: mysql:5.7 - ports: [3306] - # Set the connection details to match testConnectionStr.txt - env: - MYSQL_ROOT_PASSWORD: f48dfhw3Hd!Asah7i2aZ - MYSQL_DATABASE: mysqln_testdb - MYSQL_USER: mysqln_test - MYSQL_PASSWORD: pass123 - # Set health checks to wait until mysql service has started - options: >- - --health-cmd "mysqladmin ping" - --health-interval 10s - --health-timeout 3s - --health-retries 4 - steps: - uses: actions/checkout@v2 @@ -129,21 +112,38 @@ jobs: - name: Build Library run: dub build --build=release --config=library - ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not - ## actually a unit test at all. It's an integration test and should be pulled out of the codebase. - - name: Run unittest-vibe-ut - env: - MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} - run: | - echo "host=localhost;port=$MYSQL_PORT;user=mysqln_test;pwd=pass123;db=mysqln_testdb" > testConnectionStr.txt - dub run -c unittest-vibe-ut -- -t - # cache - uses: WebFreak001/dub-upgrade@v0.1 with: { store: true } integration-tests: - name: Integration Tests + name: Integration Tests ${{ matrix.compiler }} + strategy: + fail-fast: false + matrix: + compiler: + - dmd-latest + - ldc-latest + - dmd-2.096.1 + - dmd-2.095.1 + - dmd-2.094.2 + - dmd-2.093.1 + - dmd-2.092.1 + - dmd-2.091.1 + - dmd-2.090.1 + - dmd-2.089.1 + - dmd-2.088.1 + - dmd-2.087.1 + - dmd-2.086.1 + - dmd-2.085.1 + - dmd-2.084.1 + - dmd-2.083.1 ## As far back as unit-threaded seems to work + - ldc-1.23.0 # eq to dmd v2.093.1 + - ldc-1.22.0 # eq to dmd v2.092.1 + - ldc-1.21.0 # eq to dmd v2.091.1 + - ldc-1.20.1 # eq to dmd v2.090.1 + - ldc-1.19.0 # eq to dmd v2.089.1 + runs-on: ubuntu-20.04 services: @@ -174,6 +174,15 @@ jobs: if: startsWith(matrix.os, 'ubuntu') run: sudo apt-get update && sudo apt-get install libevent-dev -y + ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not + ## actually a unit test at all. It's an integration test and should be pulled out of the codebase. + - name: Run unittest-vibe-ut + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt + dub run -c unittest-vibe-ut -- -t + - name: Build The Example Project working-directory: ./examples/homePage run: dub build @@ -181,6 +190,6 @@ jobs: - name: Run Example (MySQL 5.7) working-directory: ./examples/homePage env: - PORT: ${{ job.services.mysql.ports[3306] }} + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} run: | - ./example "host=localhost;port=$PORT;user=testuser;pwd=passw0rd;db=testdb" + ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" From a588a46a0ea88822ac8d1b83e596a17bfa70c1c4 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 20:42:02 +0100 Subject: [PATCH 13/20] ditch convoluted test script --- dub.selections.vibecore-1.0.0.json | 11 - dub.selections.vibecore-1.1.1.json | 11 - dub.selections.vibecore-1.2.0.json | 11 - dub.selections.vibecore-1.3.0.json | 11 - dub.selections.vibecore-1.4.0.json | 12 -- dub.selections.vibecore-1.4.3.json | 12 -- dub.selections.vibecore-1.4.7.json | 12 -- dub.selections.vibecore-1.5.0.json | 12 -- dub.selections.vibecore-1.6.0.json | 12 -- dub.selections.vibecore-1.6.2.json | 12 -- dub.selections.vibecore-1.7.0.json | 15 -- run_tests | 9 - run_tests.bat | 7 - run_tests.d | 312 ----------------------------- 14 files changed, 459 deletions(-) delete mode 100644 dub.selections.vibecore-1.0.0.json delete mode 100644 dub.selections.vibecore-1.1.1.json delete mode 100644 dub.selections.vibecore-1.2.0.json delete mode 100644 dub.selections.vibecore-1.3.0.json delete mode 100644 dub.selections.vibecore-1.4.0.json delete mode 100644 dub.selections.vibecore-1.4.3.json delete mode 100644 dub.selections.vibecore-1.4.7.json delete mode 100644 dub.selections.vibecore-1.5.0.json delete mode 100644 dub.selections.vibecore-1.6.0.json delete mode 100644 dub.selections.vibecore-1.6.2.json delete mode 100644 dub.selections.vibecore-1.7.0.json delete mode 100755 run_tests delete mode 100644 run_tests.bat delete mode 100644 run_tests.d diff --git a/dub.selections.vibecore-1.0.0.json b/dub.selections.vibecore-1.0.0.json deleted file mode 100644 index 26606359..00000000 --- a/dub.selections.vibecore-1.0.0.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.6", - "unit-threaded": "0.7.45", - "vibe-core": "1.0.0" - } -} diff --git a/dub.selections.vibecore-1.1.1.json b/dub.selections.vibecore-1.1.1.json deleted file mode 100644 index 5a2455fb..00000000 --- a/dub.selections.vibecore-1.1.1.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.1.1" - } -} diff --git a/dub.selections.vibecore-1.2.0.json b/dub.selections.vibecore-1.2.0.json deleted file mode 100644 index 1ff86062..00000000 --- a/dub.selections.vibecore-1.2.0.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.2.0" - } -} diff --git a/dub.selections.vibecore-1.3.0.json b/dub.selections.vibecore-1.3.0.json deleted file mode 100644 index f722fb93..00000000 --- a/dub.selections.vibecore-1.3.0.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.3.0" - } -} diff --git a/dub.selections.vibecore-1.4.0.json b/dub.selections.vibecore-1.4.0.json deleted file mode 100644 index 0988f214..00000000 --- a/dub.selections.vibecore-1.4.0.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.4.0" - } -} diff --git a/dub.selections.vibecore-1.4.3.json b/dub.selections.vibecore-1.4.3.json deleted file mode 100644 index c4570a6f..00000000 --- a/dub.selections.vibecore-1.4.3.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.4.3" - } -} diff --git a/dub.selections.vibecore-1.4.7.json b/dub.selections.vibecore-1.4.7.json deleted file mode 100644 index 378c1a77..00000000 --- a/dub.selections.vibecore-1.4.7.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.4.7" - } -} diff --git a/dub.selections.vibecore-1.5.0.json b/dub.selections.vibecore-1.5.0.json deleted file mode 100644 index 15ba3222..00000000 --- a/dub.selections.vibecore-1.5.0.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.5.0" - } -} diff --git a/dub.selections.vibecore-1.6.0.json b/dub.selections.vibecore-1.6.0.json deleted file mode 100644 index 52f1deac..00000000 --- a/dub.selections.vibecore-1.6.0.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.6.0" - } -} diff --git a/dub.selections.vibecore-1.6.2.json b/dub.selections.vibecore-1.6.2.json deleted file mode 100644 index 15246c7b..00000000 --- a/dub.selections.vibecore-1.6.2.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "memutils": "0.4.13", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.7", - "unit-threaded": "0.7.55", - "vibe-core": "1.6.2" - } -} diff --git a/dub.selections.vibecore-1.7.0.json b/dub.selections.vibecore-1.7.0.json deleted file mode 100644 index c849738f..00000000 --- a/dub.selections.vibecore-1.7.0.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "eventcore": "0.8.48", - "libasync": "0.8.4", - "libev": "5.0.0+4.04", - "libevent": "2.0.1+2.0.16", - "memutils": "0.4.13", - "openssl": "1.1.4+1.0.1g", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.6", - "unit-threaded": "0.7.45", - "vibe-core": "1.7.0" - } -} diff --git a/run_tests b/run_tests deleted file mode 100755 index 7b7b24f0..00000000 --- a/run_tests +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Compile using $DMD if it exists, otherwise use dmd -if [ -z "$DMD" ]; then - DMD=dmd -fi - -echo "DMD=$DMD" -$DMD -ofrun_tests_bin run_tests.d && ./run_tests_bin "$@" diff --git a/run_tests.bat b/run_tests.bat deleted file mode 100644 index 1ac60963..00000000 --- a/run_tests.bat +++ /dev/null @@ -1,7 +0,0 @@ -@echo off - -rem Compile using $DMD if it exists, otherwise use dmd -if "%DMD%" == "" set DMD=dmd - -echo DMD=%DMD% -%DMD% -ofrun_tests_bin run_tests.d && run_tests_bin %* diff --git a/run_tests.d b/run_tests.d deleted file mode 100644 index 1d5099b7..00000000 --- a/run_tests.d +++ /dev/null @@ -1,312 +0,0 @@ -import std.file; -import std.getopt; -import std.process; -import std.file; -import std.process; -import std.stdio; -import std.string; - -// Commandline args -bool useUnitThreaded; -bool coreTestsOnly; -enum Mode { phobos, vibe, combined, travis }; -Mode mode; -string[] unitThreadedArgs; - -// Exit code to be returned -int exitCode=0; - -// Utils /////////////////////////////////////////////// - -pure string flagUseUnitThreaded(bool on) -{ - return on? " --ut" : ""; -} - -pure string flagCoreTestsOnly(bool on) -{ - return on? " --core" : ""; -} - -pure string flagMode(Mode mode) -{ - final switch(mode) - { - case Mode.phobos: return " --mode=phobos"; - case Mode.vibe: return " --mode=vibe"; - case Mode.combined: return " --mode=combined"; - case Mode.travis: return " --mode=travis"; - } -} - -string fixSlashes(string path) -{ - version(Windows) return path.replace(`/`, `\`); - else version(Posix) return path.replace(`\`, `/`); - else static assert(0); -} - -string envGet(string name) -{ - return environment.get(name, null); -} - -bool envBool(string name) -{ - return environment.get(name, null) == "true"; -} - -void tryMkdir(string dir) -{ - if(!exists(dir)) - mkdir(dir); -} - -int runFromCurrentDir(string command) -{ - version(Windows) return run(command); - else return run("./"~command); -} - -int run(string command) -{ - writeln(command); - return spawnShell(command).wait; -} - -int run(string[] command) -{ - writeln(command); - return spawnProcess(command).wait; -} - -bool canRun(string command) -{ - return executeShell(command).status == 0; -} - -string findRdmd() -{ - // LDC/GDC don't always include rdmd, so allow user to specify path to it in $RDMD. - // Otherwise, use "rdmd". - // - // For travis, if "rdmd" doesn't work (ie, LDC/GDC is being tested), then use - // the copy of rdmd that was downloaded by the 'ci_setup.d' script. - auto rdmd = environment.get("RDMD"); - if(rdmd is null) - { - rdmd = "rdmd"; - if(!canRun("rdmd --help")) - { - auto travisOsName = environment.get("TRAVIS_OS_NAME"); - if(travisOsName == "osx") - rdmd = "local-dmd/dmd2/"~travisOsName~"/bin/rdmd"; - else - rdmd = "local-dmd/dmd2/"~travisOsName~"/bin64/rdmd"; - } - } - - return rdmd; -} - -// Main (Process command line) /////////////////////////////////////////////// - -int main(string[] args) -{ - try - { - auto argsHelp = getopt(args, - "ut", "Use unit-threaded (Always includes ut's --trace)", &useUnitThreaded, - "core", "Only run basic core tests (Can only be used with --mode=phobos)", &coreTestsOnly, - std.getopt.config.required, - "m|mode", "'-m=phobos': Run Phobos tests | '-m=vibe': Run Vibe.d tests | '-m=combined': Run core-only Phobos tests and all Vibe.d tests | '-m=travis': Travis-CI mode (autodetect settings from envvars)", &mode, - ); - - if(argsHelp.helpWanted) - { - defaultGetoptPrinter( - "Runs the mysql-native test suite with Phobos sockets, Vibe.d sockets, or combined.\n"~ - "\n"~ - "Usage:\n"~ - " run_tests --mode=(phobos|vibe|combined|travis) [OPTIONS] [-- [UNIT-THREADED OPTIONS]]\n"~ - "\n"~ - "Examples:\n"~ - " run_tests --mode=combined\n"~ - " run_tests --ut --mode=vibe -- --help\n"~ - " run_tests --ut --mode=vibe -- --single --random\n"~ - "\n"~ - "Options:", - argsHelp.options - ); - - return 0; - } - } - catch(Exception e) - { - stderr.writeln(e.msg); - stderr.writeln("For help: run_tests --help"); - stderr.writeln("Recommended: run_tests -m=combined"); - return 1; - } - - if(coreTestsOnly && mode==Mode.combined) - { - stderr.writeln("Cannot use --core and --mode=combined together."); - //stderr.writeln("Instead, use:"); - //stderr.writeln(" run_tests --core --mode=phobos && run_tests --core --mode=vibe"); - stderr.writeln("For help: run_tests --help"); - return 1; - } - - if(coreTestsOnly && mode==Mode.vibe) - { - stderr.writeln("Cannot use --core and --mode=vibe together."); - stderr.writeln("For help: run_tests --help"); - return 1; - } - - if(mode==Mode.travis && (coreTestsOnly || useUnitThreaded)) - { - stderr.writeln("Cannot use --mode=travis together with any other option."); - stderr.writeln("For help: run_tests --help"); - return 1; - } - - unitThreadedArgs = args[1..$]; - runTests(); - return exitCode; -} - -// Run Tests /////////////////////////////////////////////// - -void runTests() -{ - //writeln("unitThreadedArgs: ", unitThreadedArgs); - - // GDC doesn't autocreate the dir (and git doesn't beleive in empty dirs) - tryMkdir("bin"); - - final switch(mode) - { - case Mode.phobos: runPhobosTests(); break; - case Mode.vibe: runVibeTests(); break; - case Mode.combined: runCombinedTests(); break; - case Mode.travis: runTravisTests(); break; - } -} - -void runPhobosTests() -{ - // Setup compilers - auto rdmd = findRdmd(); - auto dmd = environment.get("DMD", "dmd"); - - writeln("Using:"); - writeln(" RDMD=", rdmd); - writeln(" DMD=", dmd); - stdout.flush(); - - // Setup --core - auto debugTestsId = coreTestsOnly? "MYSQLN_CORE_TESTS" : "MYSQLN_TESTS"; - auto msgSuffix = coreTestsOnly? " (core tests only)" : ""; - - // Setup unit-threaded - string dFile; - string utSuffix; - string utArgs; - if(useUnitThreaded) - { - msgSuffix = msgSuffix~" (unit-threaded)"; - auto utVer="0.7.45"; - utSuffix="-ut"; - utArgs="-version=MYSQLN_TESTS_NO_MAIN -version=Have_unit_threaded -Iunit-threaded-"~utVer~"/unit-threaded/source/ --extra-file=unit-threaded-"~utVer~"/unit-threaded/libunit-threaded.a --exclude=unit_threaded"; - dFile = "bin/ut.d"; - - // Setup local unit-threaded - run("dub fetch unit-threaded --version="~utVer~" --cache=local"); - chdir(("unit-threaded-"~utVer~"/unit-threaded").fixSlashes); - run("dub build -c gen_ut_main"); - run("dub build -c library"); - chdir(("../..").fixSlashes); - run(("unit-threaded-"~utVer~"/unit-threaded/gen_ut_main -f bin/ut.d").fixSlashes); - } - else - { - dFile = "source/mysql/package.d"; - } - - // Compile tests - writeln("Compiling Phobos-socket tests", msgSuffix, "..."); - auto status = run(rdmd~" --compiler="~dmd~" --build-only -g -unittest "~utArgs~" -debug="~debugTestsId~" -ofbin/mysqln-tests-phobos"~utSuffix~" -Isource "~dFile); - //$RDMD --compiler=$DMD --build-only -g -unittest $UT_ARGS -debug=$DEBUG_TESTS_ID -ofbin/mysqln-tests-phobos${UT_SUFFIX} -Isource $D_FILE - if(status != 0) - { - exitCode = status; - return; - } - - writeln("Running Phobos-socket tests", msgSuffix, "..."); - status = run(["bin/mysqln-tests-phobos"~utSuffix, "-t"] ~ unitThreadedArgs); - // bin/mysqln-tests-phobos${UT_SUFFIX} -t "$@" - if(status != 0) - { - exitCode = status; - return; - } -} - -void runVibeTests() -{ - auto coreMsg = coreTestsOnly? " (core tests only)" : ""; - writeln("Doing Vibe-socket tests", coreMsg, "..."); - - if(useUnitThreaded) - exitCode = run(["dub", "run", "-c", "unittest-vibe-ut", "--", "-t"] ~ unitThreadedArgs); - else - exitCode = run("dub test -c unittest-vibe"); -} - -void runCombinedTests() -{ - auto phobosStatus = runFromCurrentDir( - "run_tests"~ - flagMode(Mode.phobos)~ - flagCoreTestsOnly(true)~ - flagUseUnitThreaded(useUnitThreaded) - ); - if(phobosStatus != 0) - { - exitCode = phobosStatus; - return; - } - - auto vibeStatus = runFromCurrentDir( - "run_tests"~ - flagMode(Mode.vibe)~ - flagCoreTestsOnly(false)~ - flagUseUnitThreaded(useUnitThreaded) - ); - exitCode = vibeStatus; -} - -void runTravisTests() -{ - useUnitThreaded = envBool("USE_UNIT_THREADED"); - auto noVibe = envBool("NO_VIBE"); - - if(noVibe) - { - auto phobosStatus = runFromCurrentDir( - "run_tests"~ - flagMode(Mode.phobos)~ - flagCoreTestsOnly(false)~ - flagUseUnitThreaded(useUnitThreaded) - ); - exitCode = phobosStatus; - } - else - { - runCombinedTests(); - } -} From 958773d63fb4fcac17ee0b9868525ae88754f081 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 20:42:47 +0100 Subject: [PATCH 14/20] ensure CI can run examples after UT --- examples/homePage/example.d | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/homePage/example.d b/examples/homePage/example.d index 708709ad..5a6da345 100644 --- a/examples/homePage/example.d +++ b/examples/homePage/example.d @@ -11,6 +11,8 @@ void main(string[] args) Connection conn = new Connection(connectionStr); scope(exit) conn.close(); + conn.exec("DROP TABLE IF EXISTS `tablename`"); // So this code can run after "unittest-vibe-ut" during CI + // Create the schema (Would rather have `id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT but for now just get tests working) conn.exec("CREATE TABLE IF NOT EXISTS `tablename` ( `id` INTEGER, From bd7ada04e25cab27ddbbc5d24aa82f0fa292f763 Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 20:43:10 +0100 Subject: [PATCH 15/20] update README --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 04d1d9e1..7652bc6b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ MySQL native [![DUB Package](https://img.shields.io/dub/v/mysql-native.svg)](https://code.dlang.org/packages/mysql-native) [![GitHub CI](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml/badge.svg)](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml) -[![Build Status](https://travis-ci.org/mysql-d/mysql-native.svg?branch=master)](https://travis-ci.org/mysql-d/mysql-native) A [Boost-licensed](http://www.boost.org/LICENSE_1_0.txt) native [D](http://dlang.org) client driver for MySQL and MariaDB. @@ -21,8 +20,7 @@ type based on whether Vibe.d is used in your project. (If you use Otherwise, you can use `-version=Have_vibe_d_core` to force Vibe.d sockets instead of Phobos ones.) -See [.travis.yml](https://github.com/mysql-d/mysql-native/blob/master/.travis.yml) -for a list of officially supported D compiler versions. +Should work on D compilers from 2.068 through to the latest release but the CI only tests against version 2.080.1 and above. For a full list see the builds on Github Actions. In this document: * [API](#api) From 39b86f56b3b3ae23ab766b9c4ab67f3a32a5e99d Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 20:51:23 +0100 Subject: [PATCH 16/20] remove redundent ci_setup.d --- ci_setup.d | 99 ------------------------------------------------------ 1 file changed, 99 deletions(-) delete mode 100644 ci_setup.d diff --git a/ci_setup.d b/ci_setup.d deleted file mode 100644 index 03a0e5af..00000000 --- a/ci_setup.d +++ /dev/null @@ -1,99 +0,0 @@ -import std.file; -import std.process; -import std.stdio : writeln; - -string envGet(string name) -{ - return environment.get(name, null); -} - -bool envBool(string name) -{ - return environment.get(name, null) == "true"; -} - -void copyIfExists(string from, string to) -{ - if(exists(from) && isFile(from)) - copy(from, to); -} - -int main() -{ - auto haveRdmd = executeShell("rdmd --help").status == 0; - if(!haveRdmd) - { - auto dmdZip = "dmd.2.076.0."~environment["TRAVIS_OS_NAME"]~".zip"; - spawnShell("wget http://downloads.dlang.org/releases/2017/"~dmdZip).wait; - spawnShell("unzip -q -d local-dmd "~dmdZip).wait; - } - - // MySQL is not installed by default on OSX build agents - auto mysqlPrefix = ""; - if(environment["TRAVIS_OS_NAME"] == "osx") - { - if(envGet("DB") == "mysql-5.6") - { - spawnShell("brew update").wait; - spawnShell("brew install mysql@5.6 && brew services start mysql56").wait; - mysqlPrefix = "/usr/local/opt/mysql@5.6/bin/"; - } - else if(envGet("DB") == "mysql-latest") - { - spawnShell("brew update").wait; - spawnShell("brew install mysql && brew services start mysql").wait; - } - else - { - writeln("Envar 'DB' must be 'mysql-5.6' or 'mysql-latest', not '", envGet("DB"), "'"); - return 1; - } - } - - // Use the requested version of dub.selections.json. - if(envGet("DUB_SELECT") != null) - { - string dubSelections = "dub.selections."~envGet("DUB_SELECT")~".json"; - writeln("Using alternative dub dependencies file: ", dubSelections); - copy(dubSelections, "dub.selections.json"); - copy("examples/homePage/dub.selections."~envGet("DUB_SELECT")~".json", "examples/homePage/dub.selections.json"); - } - else if(!envBool("NO_VIBE") && !envBool("DUB_UPGRADE")) - { - writeln("ERROR: All travis jobs must specify one of the following environment variables:"); - writeln(" DUB_SELECT=... *or* DUB_UPGRADE=true *or* NO_VIBE=true."); - return 1; - } - - // Download (and maybe upgrade) DUB dependencies - // - // Doing this here, instead of when "dub test" is run later, - // ensures that any intermittent server - // failures are more likely to be correctly marked as "job error" - // rather than "tests failed". - if(envBool("DUB_UPGRADE")) - { - // Update all dependencies - writeln("Updating all DUB dependencies..."); - spawnShell("dub upgrade").wait; - chdir("examples/homePage"); - spawnShell("dub upgrade").wait; - chdir("../.."); - } - else - { - // Don't upgrade dependencies. - writeln("Downloading dependencies WITHOUT upgrading them..."); - spawnShell("dub upgrade --missing-only").wait; - chdir("examples/homePage"); - spawnShell("dub upgrade --missing-only").wait; - chdir("../.."); - } - - // Setup DB - spawnShell(mysqlPrefix~`mysql -u root -e 'SHOW VARIABLES LIKE "%version%";'`).wait; - spawnShell(mysqlPrefix~`mysql -u root -e 'CREATE DATABASE mysqln_testdb;'`).wait; - write("testConnectionStr.txt", "host=127.0.0.1;port=3306;user=root;pwd=;db=mysqln_testdb"); - - return 0; -} From 59b7cbe4fa4b5b91bad053569a8fe7b767ac5fda Mon Sep 17 00:00:00 2001 From: singingbush Date: Sat, 22 May 2021 20:57:23 +0100 Subject: [PATCH 17/20] tidy up dub.yml --- .github/workflows/dub.yml | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index cfb03f1e..15301069 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -35,31 +35,12 @@ jobs: with: compiler: ${{ matrix.compiler }} - # - name: Install dependencies on Ubuntu - # if: startsWith(matrix.os, 'ubuntu') - # run: sudo apt-get update && sudo apt-get install libevent-dev -y - - # - name: Install dependencies on Mac OSX - # if: startsWith(matrix.os, 'macos') - # run: brew bundle - - name: Upgrade dub dependencies uses: WebFreak001/dub-upgrade@v0.1 - name: Build Library run: dub build --build=release --config=library - ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not - ## actually a unit test at all. It's an integration test and should be pulled out of the codebase. - # - name: Run unittest-vibe-ut - # run: dub run -c unittest-vibe-ut -- -t - - # - name: Run Tests (phobos) - # run: ./run_tests --mode=phobos - - # - name: Run Tests (vibe) - # run: ./run_tests --mode=vibe - # cache - uses: WebFreak001/dub-upgrade@v0.1 if: startsWith(matrix.os, 'windows') @@ -102,10 +83,6 @@ jobs: with: compiler: ${{ matrix.compiler }} - # - name: Install dependencies on Ubuntu - # if: startsWith(matrix.os, 'ubuntu') - # run: sudo apt-get update && sudo apt-get install libevent-dev -y - - name: Upgrade dub dependencies uses: WebFreak001/dub-upgrade@v0.1 @@ -175,7 +152,8 @@ jobs: run: sudo apt-get update && sudo apt-get install libevent-dev -y ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not - ## actually a unit test at all. It's an integration test and should be pulled out of the codebase. + ## actually a unit test at all. It's an integration test and should be pulled out from the main + ## codebase into a separate sub module - name: Run unittest-vibe-ut env: MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} From b51f0ddeda298b64607cf8f21e466aee1abe1f10 Mon Sep 17 00:00:00 2001 From: singingbush Date: Mon, 24 May 2021 09:12:39 +0100 Subject: [PATCH 18/20] split MySQL/Mariadb into another file --- .github/workflows/dub.yml | 4 +- .github/workflows/integration-testing.yml | 214 ++++++++++++++++++++++ 2 files changed, 216 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/integration-testing.yml diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index 15301069..d3da9f18 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -142,10 +142,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install latest DMD + - name: Install ${{ matrix.compiler }} uses: dlang-community/setup-dlang@v1 with: - compiler: dmd-latest + compiler: ${{ matrix.compiler }} - name: Install dependencies on Ubuntu if: startsWith(matrix.os, 'ubuntu') diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml new file mode 100644 index 00000000..74877fc6 --- /dev/null +++ b/.github/workflows/integration-testing.yml @@ -0,0 +1,214 @@ +name: CI + +# MySQL Native should work with the following database versions: +# mysql:8 +# mysql:5.7 +# mariadb:10 + +on: + schedule: + - cron: '30 7 1 * *' + push: + pull_request: + +jobs: + mysql8-tests: + name: MySQL 8 Tests ${{ matrix.compiler }} + strategy: + fail-fast: false + matrix: + compiler: + - dmd-latest + - ldc-latest + - dmd-2.096.1 + - dmd-2.095.1 + - dmd-2.094.2 + - dmd-2.084.1 + - dmd-2.083.1 ## As far back as unit-threaded seems to work + - ldc-1.23.0 # eq to dmd v2.093.1 + - ldc-1.19.0 # eq to dmd v2.089.1 + + runs-on: ubuntu-20.04 + + services: + mysql: + image: mysql:8 + 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 + + steps: + - uses: actions/checkout@v2 + + - name: Install ${{ 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 libevent-dev -y + + ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not + ## actually a unit test at all. It's an integration test and should be pulled out from the main + ## codebase into a separate sub module + - name: Run unittest-vibe-ut + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt + dub run -c unittest-vibe-ut -- -t + + - name: Build The Example Project + working-directory: ./examples/homePage + run: dub build + + - name: Run Example (MySQL 8) + working-directory: ./examples/homePage + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" + + mysql57-tests: + name: MySQL 5.7 Tests ${{ matrix.compiler }} + strategy: + fail-fast: false + matrix: + compiler: + - dmd-latest + - ldc-latest + - dmd-2.096.1 + - dmd-2.095.1 + - dmd-2.094.2 + - dmd-2.084.1 + - dmd-2.083.1 ## As far back as unit-threaded seems to work + - ldc-1.23.0 # eq to dmd v2.093.1 + - ldc-1.19.0 # eq to dmd v2.089.1 + + 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 + + steps: + - uses: actions/checkout@v2 + + - name: Install ${{ 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 libevent-dev -y + + ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not + ## actually a unit test at all. It's an integration test and should be pulled out from the main + ## codebase into a separate sub module + - name: Run unittest-vibe-ut + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt + dub run -c unittest-vibe-ut -- -t + + - name: Build The Example Project + working-directory: ./examples/homePage + run: dub build + + - name: Run Example (MySQL 5.7) + working-directory: ./examples/homePage + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" + + mariadb10-tests: + name: MariaDB 10 Tests ${{ matrix.compiler }} + strategy: + fail-fast: false + matrix: + compiler: + - dmd-latest + - ldc-latest + - dmd-2.096.1 + - dmd-2.095.1 + - dmd-2.094.2 + - dmd-2.084.1 + - dmd-2.083.1 ## As far back as unit-threaded seems to work + - ldc-1.23.0 # eq to dmd v2.093.1 + - ldc-1.19.0 # eq to dmd v2.089.1 + + runs-on: ubuntu-20.04 + + services: + mysql: + image: mariadb:10 + 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 + + steps: + - uses: actions/checkout@v2 + + - name: Install ${{ 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 libevent-dev -y + + ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not + ## actually a unit test at all. It's an integration test and should be pulled out from the main + ## codebase into a separate sub module + - name: Run unittest-vibe-ut + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt + dub run -c unittest-vibe-ut -- -t + + - name: Build The Example Project + working-directory: ./examples/homePage + run: dub build + + - name: Run Example (mariadb 10) + working-directory: ./examples/homePage + env: + MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + run: | + ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" \ No newline at end of file From db2df74ae305ffaa9b544211d799923fe572af40 Mon Sep 17 00:00:00 2001 From: singingbush Date: Mon, 24 May 2021 10:49:22 +0100 Subject: [PATCH 19/20] don't run against MySQL v8 for now --- .github/workflows/dub.yml | 81 +----------- .github/workflows/integration-testing.yml | 146 ++++++++++------------ README.md | 3 +- 3 files changed, 71 insertions(+), 159 deletions(-) diff --git a/.github/workflows/dub.yml b/.github/workflows/dub.yml index d3da9f18..33d18666 100644 --- a/.github/workflows/dub.yml +++ b/.github/workflows/dub.yml @@ -1,4 +1,4 @@ -name: CI +name: Builds # Overall MySQL Native should work on the last 10 minor compiler releases (same as Vibe.d). # For simplicity and speed of the CI, the latest versions of dmd and ldc must are tested on @@ -92,82 +92,3 @@ jobs: # cache - uses: WebFreak001/dub-upgrade@v0.1 with: { store: true } - - integration-tests: - name: Integration Tests ${{ matrix.compiler }} - strategy: - fail-fast: false - matrix: - compiler: - - dmd-latest - - ldc-latest - - dmd-2.096.1 - - dmd-2.095.1 - - dmd-2.094.2 - - dmd-2.093.1 - - dmd-2.092.1 - - dmd-2.091.1 - - dmd-2.090.1 - - dmd-2.089.1 - - dmd-2.088.1 - - dmd-2.087.1 - - dmd-2.086.1 - - dmd-2.085.1 - - dmd-2.084.1 - - dmd-2.083.1 ## As far back as unit-threaded seems to work - - ldc-1.23.0 # eq to dmd v2.093.1 - - ldc-1.22.0 # eq to dmd v2.092.1 - - ldc-1.21.0 # eq to dmd v2.091.1 - - ldc-1.20.1 # eq to dmd v2.090.1 - - ldc-1.19.0 # eq to dmd v2.089.1 - - 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 - - steps: - - uses: actions/checkout@v2 - - - name: Install ${{ 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 libevent-dev -y - - ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not - ## actually a unit test at all. It's an integration test and should be pulled out from the main - ## codebase into a separate sub module - - name: Run unittest-vibe-ut - env: - MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} - run: | - echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt - dub run -c unittest-vibe-ut -- -t - - - name: Build The Example Project - working-directory: ./examples/homePage - run: dub build - - - name: Run Example (MySQL 5.7) - working-directory: ./examples/homePage - env: - MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} - run: | - ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index 74877fc6..1cce8a16 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -1,7 +1,7 @@ -name: CI +name: Integration Tests # MySQL Native should work with the following database versions: -# mysql:8 +# mysql:8 (Broken on MySQL 8 - see: https://github.com/mysql-d/mysql-native/issues/230) # mysql:5.7 # mariadb:10 @@ -12,88 +12,80 @@ on: pull_request: jobs: - mysql8-tests: - name: MySQL 8 Tests ${{ matrix.compiler }} - strategy: - fail-fast: false - matrix: - compiler: - - dmd-latest - - ldc-latest - - dmd-2.096.1 - - dmd-2.095.1 - - dmd-2.094.2 - - dmd-2.084.1 - - dmd-2.083.1 ## As far back as unit-threaded seems to work - - ldc-1.23.0 # eq to dmd v2.093.1 - - ldc-1.19.0 # eq to dmd v2.089.1 - - runs-on: ubuntu-20.04 - - services: - mysql: - image: mysql:8 - 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 - - steps: - - uses: actions/checkout@v2 - - - name: Install ${{ 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 libevent-dev -y - - ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not - ## actually a unit test at all. It's an integration test and should be pulled out from the main - ## codebase into a separate sub module - - name: Run unittest-vibe-ut - env: - MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} - run: | - echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt - dub run -c unittest-vibe-ut -- -t - - - name: Build The Example Project - working-directory: ./examples/homePage - run: dub build - - - name: Run Example (MySQL 8) - working-directory: ./examples/homePage - env: - MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} - run: | - ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" + # mysql8-tests: + # name: MySQL 8 Tests ${{ matrix.compiler }} + # strategy: + # fail-fast: false + # # max-parallel: 2 + # matrix: + # compiler: + # - dmd-latest + # - ldc-latest + + # runs-on: ubuntu-20.04 + + # services: + # mysql: + # image: mysql:8 + # 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 + + # steps: + # - uses: actions/checkout@v2 + + # - name: Install ${{ 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 libevent-dev -y + + # ## Turns out the unittest-vibe-ut tried to connect to an actualy MySQL on 172.18.0.1 so it's not + # ## actually a unit test at all. It's an integration test and should be pulled out from the main + # ## codebase into a separate sub module + # - name: Run unittest-vibe-ut + # env: + # MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + # run: | + # echo "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" > testConnectionStr.txt + # dub run -c unittest-vibe-ut -- -t + + # - name: Build The Example Project + # working-directory: ./examples/homePage + # run: dub build + + # - name: Run Example (MySQL 8) + # working-directory: ./examples/homePage + # env: + # MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} + # run: | + # ./example "host=localhost;port=$MYSQL_PORT;user=testuser;pwd=passw0rd;db=testdb" mysql57-tests: name: MySQL 5.7 Tests ${{ matrix.compiler }} strategy: fail-fast: false + # max-parallel: 2 matrix: compiler: - dmd-latest - ldc-latest - - dmd-2.096.1 - dmd-2.095.1 - dmd-2.094.2 - - dmd-2.084.1 - - dmd-2.083.1 ## As far back as unit-threaded seems to work - - ldc-1.23.0 # eq to dmd v2.093.1 - - ldc-1.19.0 # eq to dmd v2.089.1 + - ldc-1.25.1 # eq to dmd v2.095.1 + - ldc-1.24.0 # eq to dmd v2.094.1 runs-on: ubuntu-20.04 @@ -150,17 +142,15 @@ jobs: name: MariaDB 10 Tests ${{ matrix.compiler }} strategy: fail-fast: false + # max-parallel: 2 matrix: compiler: - dmd-latest - ldc-latest - - dmd-2.096.1 - dmd-2.095.1 - dmd-2.094.2 - - dmd-2.084.1 - - dmd-2.083.1 ## As far back as unit-threaded seems to work - - ldc-1.23.0 # eq to dmd v2.093.1 - - ldc-1.19.0 # eq to dmd v2.089.1 + - ldc-1.25.1 # eq to dmd v2.095.1 + - ldc-1.24.0 # eq to dmd v2.094.1 runs-on: ubuntu-20.04 diff --git a/README.md b/README.md index 7652bc6b..1aa95ede 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ MySQL native ============ [![DUB Package](https://img.shields.io/dub/v/mysql-native.svg)](https://code.dlang.org/packages/mysql-native) -[![GitHub CI](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml/badge.svg)](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml) +[![GitHub - Builds](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml/badge.svg)](https://github.com/mysql-d/mysql-native/actions/workflows/dub.yml) +[![GitHub - Integration Tests](https://github.com/mysql-d/mysql-native/actions/workflows/integration-testing.yml/badge.svg)](https://github.com/mysql-d/mysql-native/actions/workflows/integration-testing.yml) A [Boost-licensed](http://www.boost.org/LICENSE_1_0.txt) native [D](http://dlang.org) client driver for MySQL and MariaDB. From e95741d1d6932aa8bba5ca3ab08015cdd195889e Mon Sep 17 00:00:00 2001 From: singingbush Date: Mon, 24 May 2021 16:48:50 +0100 Subject: [PATCH 20/20] restored ci_setup.d --- ci_setup.d | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 ci_setup.d diff --git a/ci_setup.d b/ci_setup.d new file mode 100644 index 00000000..03a0e5af --- /dev/null +++ b/ci_setup.d @@ -0,0 +1,99 @@ +import std.file; +import std.process; +import std.stdio : writeln; + +string envGet(string name) +{ + return environment.get(name, null); +} + +bool envBool(string name) +{ + return environment.get(name, null) == "true"; +} + +void copyIfExists(string from, string to) +{ + if(exists(from) && isFile(from)) + copy(from, to); +} + +int main() +{ + auto haveRdmd = executeShell("rdmd --help").status == 0; + if(!haveRdmd) + { + auto dmdZip = "dmd.2.076.0."~environment["TRAVIS_OS_NAME"]~".zip"; + spawnShell("wget http://downloads.dlang.org/releases/2017/"~dmdZip).wait; + spawnShell("unzip -q -d local-dmd "~dmdZip).wait; + } + + // MySQL is not installed by default on OSX build agents + auto mysqlPrefix = ""; + if(environment["TRAVIS_OS_NAME"] == "osx") + { + if(envGet("DB") == "mysql-5.6") + { + spawnShell("brew update").wait; + spawnShell("brew install mysql@5.6 && brew services start mysql56").wait; + mysqlPrefix = "/usr/local/opt/mysql@5.6/bin/"; + } + else if(envGet("DB") == "mysql-latest") + { + spawnShell("brew update").wait; + spawnShell("brew install mysql && brew services start mysql").wait; + } + else + { + writeln("Envar 'DB' must be 'mysql-5.6' or 'mysql-latest', not '", envGet("DB"), "'"); + return 1; + } + } + + // Use the requested version of dub.selections.json. + if(envGet("DUB_SELECT") != null) + { + string dubSelections = "dub.selections."~envGet("DUB_SELECT")~".json"; + writeln("Using alternative dub dependencies file: ", dubSelections); + copy(dubSelections, "dub.selections.json"); + copy("examples/homePage/dub.selections."~envGet("DUB_SELECT")~".json", "examples/homePage/dub.selections.json"); + } + else if(!envBool("NO_VIBE") && !envBool("DUB_UPGRADE")) + { + writeln("ERROR: All travis jobs must specify one of the following environment variables:"); + writeln(" DUB_SELECT=... *or* DUB_UPGRADE=true *or* NO_VIBE=true."); + return 1; + } + + // Download (and maybe upgrade) DUB dependencies + // + // Doing this here, instead of when "dub test" is run later, + // ensures that any intermittent server + // failures are more likely to be correctly marked as "job error" + // rather than "tests failed". + if(envBool("DUB_UPGRADE")) + { + // Update all dependencies + writeln("Updating all DUB dependencies..."); + spawnShell("dub upgrade").wait; + chdir("examples/homePage"); + spawnShell("dub upgrade").wait; + chdir("../.."); + } + else + { + // Don't upgrade dependencies. + writeln("Downloading dependencies WITHOUT upgrading them..."); + spawnShell("dub upgrade --missing-only").wait; + chdir("examples/homePage"); + spawnShell("dub upgrade --missing-only").wait; + chdir("../.."); + } + + // Setup DB + spawnShell(mysqlPrefix~`mysql -u root -e 'SHOW VARIABLES LIKE "%version%";'`).wait; + spawnShell(mysqlPrefix~`mysql -u root -e 'CREATE DATABASE mysqln_testdb;'`).wait; + write("testConnectionStr.txt", "host=127.0.0.1;port=3306;user=root;pwd=;db=mysqln_testdb"); + + return 0; +}