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 5 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
162 changes: 162 additions & 0 deletions .github/workflows/dub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
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 }}
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: 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/[email protected]

- 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/[email protected]
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
- 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: 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/[email protected]

- 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/[email protected]
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: 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 Example (MySQL 5.7)
working-directory: ./examples/homePage
run: |
./example "host=localhost;port=3306;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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
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.

10 changes: 6 additions & 4 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ 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

toolchainRequirements frontend=">=2.068"

sourcePaths "source/"
importPaths "source/"
Expand Down Expand Up @@ -35,7 +37,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"
Expand All @@ -51,9 +53,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"
Expand Down
15 changes: 0 additions & 15 deletions dub.selections.json

This file was deleted.

9 changes: 8 additions & 1 deletion examples/homePage/dub.sdl
Original file line number Diff line number Diff line change
@@ -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"
}
15 changes: 0 additions & 15 deletions examples/homePage/dub.selections.json

This file was deleted.

11 changes: 0 additions & 11 deletions examples/homePage/dub.selections.vibecore-1.0.0.json

This file was deleted.

11 changes: 0 additions & 11 deletions examples/homePage/dub.selections.vibecore-1.1.1.json

This file was deleted.

11 changes: 0 additions & 11 deletions examples/homePage/dub.selections.vibecore-1.2.0.json

This file was deleted.

11 changes: 0 additions & 11 deletions examples/homePage/dub.selections.vibecore-1.3.0.json

This file was deleted.

12 changes: 0 additions & 12 deletions examples/homePage/dub.selections.vibecore-1.4.0.json

This file was deleted.

12 changes: 0 additions & 12 deletions examples/homePage/dub.selections.vibecore-1.4.3.json

This file was deleted.

12 changes: 0 additions & 12 deletions examples/homePage/dub.selections.vibecore-1.4.7.json

This file was deleted.

Loading