Skip to content
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
/t/test-data/dzil_module/build_dir
/t/test-data/module-build_module/_build
/t/test-data/module-build_module/build_dir
/t/test-data/module-build_module/MANIFEST*
/t/test-data/module-build_module/Build

11 changes: 11 additions & 0 deletions bin/build-dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ elif [[ -e minil.toml ]]; then
# shellcheck disable=SC2012
DIR=$(ls -td -- */ | head -n 1 | cut -d'/' -f1)
mv "$DIR" build_dir
elif [[ -e Build.PL ]]; then
rm -rf "$BUILD_DIR"
perl Build.PL
./Build clean
./Build manifest
./Build distdir

# Module::Build does not support a build directory, so we have to find
# the last created dir and use that.
DIR="$(perl -MModule::Build -e'print Module::Build->resume->dist_dir;')"
mv "$DIR" $BUILD_DIR
fi

exit 0
31 changes: 31 additions & 0 deletions t/module_build_module.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bats

PATH="$PATH:../../../bin"

setup() {
cd t/test-data/module-build_module
}

@test "Build.PL cpan-install-dist-deps" {
run cpan-install-build-deps
[ "$status" -eq 0 ]
}

@test "Build.PL build-dist" {
run build-dist
[ "$status" -eq 0 ]
}

@test "Build.PL test-dist" {
run cd build_dir && test-dist
[ "$status" -eq 0 ]
}

@test "Build.PL auto-build-and-test-dist" {
GITHUB_ACTIONS=${GITHUB_ACTIONS:=''}
if [[ $GITHUB_ACTIONS=true ]]; then
skip "Tricky to test under CI"
fi
run rm -rf build_dir && bash auto-build-and-test-dist && rm -rf build_dir
[ "$status" -eq 0 ]
}
5 changes: 5 additions & 0 deletions t/test-data/module-build_module/Build.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use Module::Build;
Module::Build->new(
module_name => 'Acme::Helpers',
license => 'perl',
)->create_build_script;
14 changes: 14 additions & 0 deletions t/test-data/module-build_module/lib/Acme/Helpers.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package Acme::Helpers;

use strict;
use warnings;

our $VERSION = '0.01';

sub true {
return 1;
}

1;

# ABSTRACT: turns baubles into trinkets
9 changes: 9 additions & 0 deletions t/test-data/module-build_module/t/load.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use strict;
use warnings;

use Test::More;

use Acme::Helpers ();
ok( Acme::Helpers::true() );

done_testing();
9 changes: 9 additions & 0 deletions t/test-data/module-build_module/xt/load.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use strict;
use warnings;

use Test::More;

use Acme::Helpers ();
ok( Acme::Helpers::true() );

done_testing();