Skip to content

Commit

Permalink
Merge branch 'release/1.01'
Browse files Browse the repository at this point in the history
  • Loading branch information
gugod committed Nov 18, 2024
2 parents 1b0b7e7 + 206704e commit e8f48c3
Show file tree
Hide file tree
Showing 14 changed files with 178 additions and 19 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
needs: mbtiny-dist
strategy:
matrix:
version: ["5.40","5.38", "5.36", "5.34", "5.18"]
name: cpanm-dist-perl-${{ matrix.version }}
os: ["ubuntu-latest", "macos-latest", "macos-13"]
version: ["5.40","5.38", "5.18"]
name: cpanm-dist-perl-${{ matrix.version }}-${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: shogo82148/[email protected]
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: E2E

on:
workflow_dispatch:
push:
paths:
- perlbrew

jobs:
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get update
sudo apt-get install zsh
- run: zsh ./test-e2e/run.zsh

fedora:
runs-on: ubuntu-latest
container:
image: fedora:latest
steps:
- run: sudo dnf install -y zsh perl
- uses: actions/checkout@v4
- run: zsh ./test-e2e/run.zsh

macos:
strategy:
matrix:
os: ["macos-latest", "macos-13"]
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: shogo82148/[email protected]
with:
perl-version: "5.40"
- uses: actions/checkout@v4
- run: /bin/zsh ./test-e2e/run.zsh
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.01
- Released at 2024-11-18T20:46:04+0900
- fix: `perlbrew install skaji-relocatable-perl-$version` on macOS.

1.00
- Released at 2024-10-04T10:48:40+0900
- Experimental: `perlbrew install` now accept names like skaji-relocatable-perl-$version.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
^.circleci
^.perlcriticrc
^metamerge.json
^test-e2e/
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"App::perlbrew" : {
"file" : "lib/App/perlbrew.pm",
"version" : "1.00"
"version" : "1.01"
}
},
"release_status" : "stable",
Expand All @@ -86,7 +86,7 @@
"web" : "https://github.com/gugod/App-perlbrew"
}
},
"version" : "1.00",
"version" : "1.01",
"x_serialization_backend" : "JSON::PP version 4.16",
"x_spdx_expression" : "MIT",
"x_static_install" : "1"
Expand Down
4 changes: 2 additions & 2 deletions META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ provides:
file: lib/App/Perlbrew/Util.pm
App::perlbrew:
file: lib/App/perlbrew.pm
version: '1.00'
version: '1.01'
requires:
CPAN::Perl::Releases: '5.20240920'
Capture::Tiny: '0.48'
Expand All @@ -48,7 +48,7 @@ requires:
resources:
bugtracker: https://github.com/gugod/App-perlbrew/issues
repository: https://github.com/gugod/App-perlbrew.git
version: '1.00'
version: '1.01'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
x_spdx_expression: MIT
x_static_install: '1'
12 changes: 7 additions & 5 deletions dev-bin/release.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/bin/bash
#!/usr/bin/zsh

# Make sure we are at the right directory.
cd $(dirname $0)/..

git clean -xdf

CURRENT_VERSION=$(egrep 'our \$VERSION = "[\.0-9]+";' lib/App/perlbrew.pm | egrep -o '[0-9]+' | tail -1)
RELEASE_VERSION=1.$((CURRENT_VERSION+1))
CURRENT_VERSION=$(grep -E 'our \$VERSION = "[\.0-9]+";' lib/App/perlbrew.pm | grep -Eo '[\.0-9]+' | tail -1)
RELEASE_VERSION=$((CURRENT_VERSION + 0.01))

RELEASE_TIMESTAMP=$(date +'%FT%T%z')
RELEASE_THANKS=$(git shortlog -s "$(git tag --list release-'*' | tail -1)"..HEAD | grep -v "$(git config user.name)" | perl -nE 'push@a,(split /[\t\n]/)[1]}{say join(", ",@a)')

echo '# $VERSION++'
echo '#' $CURRENT_VERSION '->' $RELEASE_VERSION

(
cat lib/App/perlbrew.pm | sed 's/our $VERSION = "0.'${CURRENT_VERSION}'";/our $VERSION = "'${RELEASE_VERSION}'";/'
cat lib/App/perlbrew.pm | sed 's/our $VERSION = "'${CURRENT_VERSION}'";/our $VERSION = "'${RELEASE_VERSION}'";/'
) > lib/App/perlbrew.pm.new
mv lib/App/perlbrew.pm.new lib/App/perlbrew.pm

Expand Down
2 changes: 1 addition & 1 deletion lib/App/Perlbrew/Sys.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sub os {
}

sub arch {
(split(/-/, $Config{archname}, 2))[0]
(split(/-/, $Config{myarchname}, 2))[0]
}

1;
5 changes: 3 additions & 2 deletions lib/App/Perlbrew/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ sub looks_like_url_of_skaji_relocatable_perl {
sub _arch_compat {
my ($arch) = @_;
my $compat = {
x86_64 => "amd64"
x86_64 => "amd64",
i386 => "amd64",
};
return $compat->{$arch} || $arch;
}
Expand All @@ -143,7 +144,7 @@ sub make_skaji_relocatable_perl_url {
my $version = $1;
my $os = $sys->os;
my $arch = $sys->arch;
$arch = "amd64" if $arch eq 'x86_64';
$arch = "amd64" if $arch eq 'x86_64' || $arch eq 'i386';

return "https://github.com/skaji/relocatable-perl/releases/download/$version/perl-$os-$arch.tar.gz";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/App/perlbrew.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package App::perlbrew;
use strict;
use warnings;
use 5.008;
our $VERSION = "1.00";
our $VERSION = "1.01";
use Config qw( %Config );

BEGIN {
Expand Down
9 changes: 5 additions & 4 deletions perlbrew
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ $fatpacked{"App/Perlbrew/Sys.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<
}
sub arch {
(split(/-/, $Config{archname}, 2))[0]
(split(/-/, $Config{myarchname}, 2))[0]
}
1;
Expand Down Expand Up @@ -540,7 +540,8 @@ $fatpacked{"App/Perlbrew/Util.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".
sub _arch_compat {
my ($arch) = @_;
my $compat = {
x86_64 => "amd64"
x86_64 => "amd64",
i386 => "amd64",
};
return $compat->{$arch} || $arch;
}
Expand All @@ -560,7 +561,7 @@ $fatpacked{"App/Perlbrew/Util.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".
my $version = $1;
my $os = $sys->os;
my $arch = $sys->arch;
$arch = "amd64" if $arch eq 'x86_64';
$arch = "amd64" if $arch eq 'x86_64' || $arch eq 'i386';
return "https://github.com/skaji/relocatable-perl/releases/download/$version/perl-$os-$arch.tar.gz";
}
Expand All @@ -575,7 +576,7 @@ $fatpacked{"App/perlbrew.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'AP
use strict;
use warnings;
use 5.008;
our $VERSION = "1.00";
our $VERSION = "1.01";
use Config qw( %Config );
BEGIN {
Expand Down
29 changes: 29 additions & 0 deletions test-e2e/lib-tests.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

test-perlbrew-self-install() {
echo 'TEST - perlbrew self-install'

assert-file-missing ~/perl5/perlbrew/bin/perlbrew

assert-ok ./perlbrew self-install

assert-file-exists ~/perl5/perlbrew/bin/perlbrew
}

test-perlbrew-install-skaji-relocatable-perl() {
echo 'TEST - perlbrew install skaji-relocatable-perl'

local PERLBREW=~/perl5/perlbrew/bin/perlbrew

assert-file-exists $PERLBREW

assert-dir-missing ~/perl5/perlbrew/perls/skaji-relocatable-perl-5.40.0.1

$PERLBREW install skaji-relocatable-perl-5.40.0.1

assert-dir-exists ~/perl5/perlbrew/perls/skaji-relocatable-perl-5.40.0.1
assert-file-exists ~/perl5/perlbrew/perls/skaji-relocatable-perl-5.40.0.1/bin/perl

assert-ok ~/perl5/perlbrew/perls/skaji-relocatable-perl-5.40.0.1/bin/perl -v

echo 'OK - perlbrew install skaji-relocatable-perl-5.40.0.1'
}
63 changes: 63 additions & 0 deletions test-e2e/lib.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

## assert_ok <CMD> [ARGS]...
assert-ok() {
local what="$*"

echo "RUN $what"
echo "--------8<--------"
$*
rc=$?
echo "-------->8--------"

if [[ $rc -ne 0 ]]; then
echo "FAIL - exit_status: $rc, command: $what"
echo
exit $rc
else
echo "OK - $what"
fi
}

assert-file-exists() {
local path=$1

if [[ -f $path ]]; then
echo "OK - file exists $path"
else
echo "FAIL - file do not exist: $path"
exit 1
fi
}

assert-file-missing() {
local path=$1

if [[ ! -f $path ]]; then
echo "OK - file missing $path"
else
echo "FAIL - file do exist: $path"
exit 1
fi
}

assert-dir-exists() {
local path=$1

if [[ -d $path ]]; then
echo "OK - dir exists $path"
else
echo "FAIL - dir do not exist: $path"
exit 1
fi
}

assert-dir-missing() {
local path=$1

if [[ ! -d $path ]]; then
echo "OK - dir missing $path"
else
echo "FAIL - dir do exist: $path"
exit 1
fi
}
18 changes: 18 additions & 0 deletions test-e2e/run.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/zsh

local e2eDir=$(dirname $0)
source $e2eDir/lib.zsh
source $e2eDir/lib-tests.zsh

echo "# uname -a"
uname -a

local testName=$1

if [[ ! -z $testName ]]; then
$testName
exit 0
fi

test-perlbrew-self-install
test-perlbrew-install-skaji-relocatable-perl

0 comments on commit e8f48c3

Please sign in to comment.