Skip to content

Commit a2a226f

Browse files
authored
Merge pull request #7 from simbabque/module-build
2 parents 532b12d + dbe3ef4 commit a2a226f

File tree

7 files changed

+84
-0
lines changed

7 files changed

+84
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
/t/test-data/dzil_module/build_dir
2+
/t/test-data/module-build_module/_build
3+
/t/test-data/module-build_module/build_dir
4+
/t/test-data/module-build_module/MANIFEST*
5+
/t/test-data/module-build_module/Build
6+

bin/build-dist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ elif [[ -e minil.toml ]]; then
1515
# shellcheck disable=SC2012
1616
DIR=$(ls -td -- */ | head -n 1 | cut -d'/' -f1)
1717
mv "$DIR" build_dir
18+
elif [[ -e Build.PL ]]; then
19+
rm -rf "$BUILD_DIR"
20+
perl Build.PL
21+
./Build clean
22+
./Build manifest
23+
./Build distdir
24+
25+
# Module::Build does not support a build directory, so we have to find
26+
# the last created dir and use that.
27+
DIR="$(perl -MModule::Build -e'print Module::Build->resume->dist_dir;')"
28+
mv "$DIR" $BUILD_DIR
1829
fi
1930

2031
exit 0

t/module_build_module.bats

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bats
2+
3+
PATH="$PATH:../../../bin"
4+
5+
setup() {
6+
cd t/test-data/module-build_module
7+
}
8+
9+
@test "Build.PL cpan-install-dist-deps" {
10+
run cpan-install-build-deps
11+
[ "$status" -eq 0 ]
12+
}
13+
14+
@test "Build.PL build-dist" {
15+
run build-dist
16+
[ "$status" -eq 0 ]
17+
}
18+
19+
@test "Build.PL test-dist" {
20+
run cd build_dir && test-dist
21+
[ "$status" -eq 0 ]
22+
}
23+
24+
@test "Build.PL auto-build-and-test-dist" {
25+
GITHUB_ACTIONS=${GITHUB_ACTIONS:=''}
26+
if [[ $GITHUB_ACTIONS=true ]]; then
27+
skip "Tricky to test under CI"
28+
fi
29+
run rm -rf build_dir && bash auto-build-and-test-dist && rm -rf build_dir
30+
[ "$status" -eq 0 ]
31+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use Module::Build;
2+
Module::Build->new(
3+
module_name => 'Acme::Helpers',
4+
license => 'perl',
5+
)->create_build_script;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package Acme::Helpers;
2+
3+
use strict;
4+
use warnings;
5+
6+
our $VERSION = '0.01';
7+
8+
sub true {
9+
return 1;
10+
}
11+
12+
1;
13+
14+
# ABSTRACT: turns baubles into trinkets
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More;
5+
6+
use Acme::Helpers ();
7+
ok( Acme::Helpers::true() );
8+
9+
done_testing();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More;
5+
6+
use Acme::Helpers ();
7+
ok( Acme::Helpers::true() );
8+
9+
done_testing();

0 commit comments

Comments
 (0)