Skip to content

Commit 5d94019

Browse files
authored
Merge pull request #38 from charsbar/github_actions
Add GitHub actions
2 parents c16d0a8 + 1dde45c commit 5d94019

23 files changed

Lines changed: 129 additions & 47 deletions

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
tags-ignore:
8+
- '*'
9+
pull_request:
10+
11+
jobs:
12+
sqlite:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: perl -V
18+
run: perl -V
19+
- name: Install dependencies
20+
run: curl -sL https://git.io/cpm | sudo perl - install -g --with-recommends --with-test --with-configure --show-build-log-on-failure --feature=test_sqlite
21+
- name: Run tests
22+
run: prove -lr -j4 t
23+
24+
mysql:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v1
29+
- name: perl -V
30+
run: perl -V
31+
- name: apt-get
32+
run: sudo apt-get update && sudo apt-get install -y libdbd-mysql-perl mysql-server
33+
- name: Install dependencies
34+
run: curl -sL https://git.io/cpm | sudo perl - install -g --with-recommends --with-test --with-configure --show-build-log-on-failure --feature=test_mysql
35+
- name: Run tests
36+
run: DOD_TEST_DRIVER=MySQL prove -lr -j4 t
37+
38+
postgresql:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- uses: actions/checkout@v1
43+
- name: perl -V
44+
run: perl -V
45+
- name: apt-get
46+
run: sudo apt-get update && sudo apt-get install -y libdbd-pg-perl postgresql
47+
- name: Install dependencies
48+
run: curl -sL https://git.io/cpm | sudo perl - install -g --with-recommends --with-test --with-configure --show-build-log-on-failure --feature=test_postgresql
49+
- name: Run tests
50+
run: DOD_TEST_DRIVER=PostgreSQL prove -lr -j4 t

cpanfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,19 @@ on develop => sub {
2323
on test => sub {
2424
requires 'version';
2525
};
26+
27+
feature 'test_sqlite', 'Test SQLite' => sub {
28+
requires 'DBD::SQLite';
29+
};
30+
31+
feature 'test_mysql', 'Test MySQL' => sub {
32+
requires 'DBD::mysql';
33+
requires 'Test::mysqld';
34+
requires 'SQL::Translator';
35+
};
36+
37+
feature 'test_postgresql', 'Test PostgreSQL' => sub {
38+
requires 'DBD::Pg';
39+
requires 'Test::PostgreSQL';
40+
requires 'SQL::Translator';
41+
};

t/01-col-inheritance.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ ok ($wine->has_column("id")) ;
3636
ok ($wine->has_column("rating")) ;
3737

3838
END {
39-
Wine->driver->dbh->disconnect;
39+
disconnect_all(qw( Wine ));
4040
teardown_dbs(qw( global ));
4141
}

t/02-basic.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@ setup_dbs({
281281
}
282282

283283
END {
284-
for (qw/Wine Recipe/) {
285-
$_->driver->rw_handle->disconnect;
286-
}
284+
disconnect_all(qw/Wine Recipe/);
287285
teardown_dbs(qw( global ));
288286
}
289287

t/03-primary-keys.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ SKIP: {
106106
}
107107

108108
END {
109-
for (qw/Wine Recipe Ingredient PkLess/) {
110-
$_->driver->rw_handle->disconnect;
111-
}
109+
disconnect_all(qw/Wine Recipe Ingredient PkLess/);
112110
teardown_dbs(qw( global ));
113111
}
114112

t/04-clone.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ test_basic_cloning('clone_all');
8888
}
8989

9090
END {
91-
for (qw/Wine Recipe Ingredient/) {
92-
$_->driver->rw_handle->disconnect;
93-
}
91+
disconnect_all(qw/Wine Recipe Ingredient/);
9492
teardown_dbs(qw( global ));
9593
}
9694

t/05-deflate.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ is $is->[1]->name, 'Milk';
9393
ok $is->[1]->{__cached};
9494

9595
END {
96-
for (qw/Recipe Ingredient/) {
97-
$_->driver->rw_handle->disconnect;
98-
}
96+
disconnect_all(qw( Recipe Ingredient ));
9997
teardown_dbs(qw( global ));
10098
}

t/06-errors.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ is(ErrorTest->driver->last_error,
3030
'Failed because of a unique constraint');
3131

3232
END {
33-
ErrorTest->driver->rw_handle->disconnect;
33+
disconnect_all(qw( ErrorTest ));
3434
teardown_dbs(qw( global ));
3535
}

t/07-has-a-cached.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ $i3->save;
6666
is $ingredient->{__cache_recipe}, undef, "cache has effectively been destroyed";
6767

6868
END {
69-
for (qw/Recipe Ingredient/) {
70-
$_->driver->rw_handle->disconnect;
71-
}
69+
disconnect_all(qw/Recipe Ingredient/);
7270
teardown_dbs(qw( global ));
7371
}

t/07-has-a.t

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ my $r = $ingredient->recipe;
6565
is $r->recipe_id, $recipe->recipe_id, "recipe id back using 'parent_method'";
6666

6767
END {
68-
for (qw/Recipe Ingredient/) {
69-
$_->driver->rw_handle->disconnect;
70-
}
68+
disconnect_all(qw/Recipe Ingredient/);
7169
teardown_dbs(qw( global ));
7270
}

0 commit comments

Comments
 (0)