Skip to content

Commit

Permalink
test with upstream lzma
Browse files Browse the repository at this point in the history
  • Loading branch information
pmqs committed Aug 5, 2023
1 parent 7118bf5 commit 2c922d9
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 1 deletion.
75 changes: 75 additions & 0 deletions .github/workflows/linux-upstream-gh-xz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Linux + upstream github xz

on:
workflow_dispatch:
push:
pull_request:
# schedule:
# - cron: '02 02 * * 6' # Run every Saturday

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
perl:
- '5.38'
lzma-version:
- v5.4.4
# - v5.4.3
# - v5.4.2
# - v5.4.1
# - v5.4.0
# - v5.2.12
# - v5.2.11
# - v5.2.10
# - develop


name: Perl ${{ matrix.perl }} with lzma ${{matrix.lzma-version}}
steps:
- uses: actions/checkout@v3

- name: Set Env
run: |
echo "lzma-source=${GITHUB_WORKSPACE}/upstream-lzma-source-${{ matrix.lzma-version }}" >> $GITHUB_ENV
echo "lzma-install=${HOME}/upstream-lzma-install-${{ matrix.lzma-version }}" >> $GITHUB_ENV
echo "LIBLZMA_LIB=${HOME}/upstream-lzma-install-${{ matrix.lzma-version }}/lib" >> $GITHUB_ENV
echo "LIBLZMA_INCLUDE=${HOME}/upstream-lzma-install-${{ matrix.lzma-version }}/include" >> $GITHUB_ENV
echo "LZMA_VERSION=${{ matrix.lzma-version }}" >> $GITHUB_ENV
- name: Checkout upstream lzma ${{matrix.lzma-version}}
uses: actions/checkout@v3
with:
repository: tukaani-project/xz
ref: ${{ matrix.lzma-version }}
path: ${{ env.lzma-source }}

- name: Build lzma ${{matrix.lzma-version}}
run: |
./configure --prefix ${{ env.lzma-install }}
make
make check
make install
working-directory: ${{ env.lzma-source }}

- name: Setup perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}

- name: Perl version
run: perl -V

#- name: Install dependencies
# run: |
# cpanm --verbose --installdeps --notest .

- name: Build
run: |
perl Makefile.PL && make
- name: Test
run: make test
25 changes: 24 additions & 1 deletion t/001version.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BEGIN
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };

plan tests => 2 + $extra ;
plan tests => 5 + $extra ;

use_ok('Compress::Raw::Lzma') ;
}
Expand All @@ -28,11 +28,13 @@ BEGIN
SKIP: {
skip "TEST_SKIP_VERSION_CHECK is set", 1
if $ENV{TEST_SKIP_VERSION_CHECK};

my $lzma_h = LZMA_VERSION ;
my $liblzma = Compress::Raw::Lzma::lzma_version_number;
my $lzma_h_string = LZMA_VERSION_STRING ;
my $liblzma_string = Compress::Raw::Lzma::lzma_version_string;

is($lzma_h_string, $liblzma_string, "LZMA_VERSION_STRING ($lzma_h_string) matches Compress::Raw::Lzma::lzma_version_string");
is($lzma_h, $liblzma, "LZMA_VERSION ($lzma_h_string) matches Compress::Raw::Lzma::lzma_version")
or diag <<EOM;
Expand All @@ -45,3 +47,24 @@ You probably have two versions of lzma installed on your system.
Try removing the one you don't want to use and rebuild.
EOM
}


SKIP:
{
# If running a github workflow that tests upstream tukaani-project/xz, check we have the version requested

# Not github or not asking for explicit verson, so skip
skip "Not github", 2
if ! (defined $ENV{GITHUB_ACTION} && defined $ENV{LZMA_VERSION}) ;

my $expected_version = $ENV{LZMA_VERSION} ;
# tag prefixes with a "v", so remove
$expected_version =~ s/^v//i;

# skip "Skipping version tests for 'develop' branch", 7
# if ($expected_version eq 'develop') ;

is Compress::Raw::Lzma::lzma_version_string(), $expected_version, "lzma_version_string() should be $expected_version";
is LZMA_VERSION_STRING, $expected_version, "LZMA_VERSION_STRING should be $expected_version";

}

0 comments on commit 2c922d9

Please sign in to comment.