Skip to content

Commit

Permalink
Merge pull request #399 from dveeden/macos_ci
Browse files Browse the repository at this point in the history
CI: Add job for macOS
  • Loading branch information
dveeden authored Nov 10, 2023
2 parents 50e5ff7 + e93ad00 commit 34c3895
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci_mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI on MacOS

on: [push, pull_request, workflow_dispatch]
jobs:
test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: "Install dependencies"
run: |
brew install cpanminus [email protected] [email protected]
cpanm Devel::CheckLib
cpanm Test::More
cpanm Test::Deep
cpanm DBI
- name: "Run build"
run: |
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
perl Makefile.PL --testhost=127.0.0.1 --testuser=root
make
- name: "Start MySQL"
run: |
brew services start [email protected]
- name: "Run test"
run: make test
11 changes: 6 additions & 5 deletions t/gh352.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ require 'lib.pl';

use vars qw($test_dsn $test_user $test_password);

plan tests => 2;

my $dbh;
eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
{ RaiseError => 0, PrintError => 1, AutoCommit => 0 });};
{ RaiseError => 1, PrintError => 1, AutoCommit => 0 });};

if ($@) {
diag $@;
plan skip_all => "no database connection";
}
plan tests => 2;

# https://github.com/perl5-dbi/DBD-mysql/issues/352
# Calling prepare on a disconnected handle causes the call to mysql_real_escape_string to segfault

my $sth;
ok $dbh->disconnect;
ok !$dbh->prepare('SELECT ?');

my $result = eval {
$dbh->prepare('SELECT ?');
};
ok !$result
5 changes: 5 additions & 0 deletions t/gh360.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ my $dsnA = $test_dsn . ';mysql_enable_utf8mb4=1';
eval {$dbhA = DBI->connect($dsnA, $test_user, $test_password,
{ RaiseError => 1, AutoCommit => 1});};

if ($@) {
diag $@;
plan skip_all => "no database connection";
}

my $dsnB = $test_dsn;
$dsnB =~ s/DBI:mysql/DBI:mysql(mysql_enable_utf8mb4=1)/;
eval {$dbhB = DBI->connect($dsnB . ';mysql_enable_utf8mb4=1', $test_user, $test_password,
Expand Down

0 comments on commit 34c3895

Please sign in to comment.