Skip to content

#227 use Github Actions for CI #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/dub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
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
# 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:
build:
name: ${{ matrix.compiler }} on ${{ matrix.os }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is already part of the display name in the Github UI so it might be redundant.

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: Upgrade dub dependencies
uses: WebFreak001/[email protected]

- name: Build Library
run: dub build --build=release --config=library

# cache
- uses: WebFreak001/[email protected]
if: startsWith(matrix.os, 'windows')
with: { store: true }

# Older compiler versions
build-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
- 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
- ldc-1.20.1 # eq to dmd v2.090.1
- ldc-1.19.0 # eq to dmd v2.089.1
Comment on lines +54 to +75
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the include/exclude options look handy I'll take a look once I've finished getting the tests running. I hate that the supposed unit tests are actually integration tests but would like to run them at least before moving things around.

So far I feel the changes are a lot better than the travis builds. I currently have (https://github.com/SingingBush/mysql-native/actions/runs/867000447) 60 jobs running in about 3 minutes, which includes running the example code against MySQL:

image

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: Upgrade dub dependencies
uses: WebFreak001/[email protected]

- name: Build Library
run: dub build --build=release --config=library

# cache
- uses: WebFreak001/[email protected]
with: { store: true }
204 changes: 204 additions & 0 deletions .github/workflows/integration-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
name: Integration Tests

# MySQL Native should work with the following database versions:
# mysql:8 (Broken on MySQL 8 - see: https://github.com/mysql-d/mysql-native/issues/230)
# 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
# # 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.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

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
# max-parallel: 2
matrix:
compiler:
- dmd-latest
- ldc-latest
- 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

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"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -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

Expand Down
File renamed without changes.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[![Build Status](https://travis-ci.org/mysql-d/mysql-native.svg?branch=master)](https://travis-ci.org/mysql-d/mysql-native)
MySQL native
============

[![DUB Package](https://img.shields.io/dub/v/mysql-native.svg)](https://code.dlang.org/packages/mysql-native)
[![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.
Expand All @@ -16,8 +21,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)
Expand Down
5 changes: 4 additions & 1 deletion ddox/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.dub
# Ignore dub output (selections should not be committed)
.dub/
dub.selections.json

/ddox
/__*
node_modules
Expand Down
6 changes: 3 additions & 3 deletions ddox/dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 0 additions & 20 deletions ddox/dub.selections.json

This file was deleted.

Loading