Skip to content

Commit

Permalink
Merge pull request #1 from perlrdf/ci
Browse files Browse the repository at this point in the history
Add CI and other fixes
  • Loading branch information
zmughal authored Nov 12, 2023
2 parents f2d2d26 + c927157 commit 8976714
Show file tree
Hide file tree
Showing 5 changed files with 360 additions and 35 deletions.
162 changes: 162 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Run Tests

on:
workflow_dispatch:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:
create:

env:
PKG_NAME: Sord
PKG_UBUNTU: libsord-dev
PKG_HOMEBREW: sord
PKG_MSYS2_MINGW64: mingw-w64-x86_64-sord
PKG_MSYS2_MINGW64_DEPS: >-
base-devel
unzip
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-perl
mingw-w64-x86_64-curl
mingw-w64-x86_64-meson
mingw-w64-x86_64-ninja
mingw-w64-x86_64-pkg-config
jobs:
notify:
runs-on: ubuntu-latest
continue-on-error: true
if: ${{ always() }}
steps:
- uses: perlrdf/devops/github-actions/irc-notifications@main
with:
target-notifications: true
dist:
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
name: Make distribution
runs-on: ubuntu-latest
outputs:
min-perl-version: ${{ steps.build-dist.outputs.min-perl-version }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- id: build-dist
uses: perlrdf/devops/github-actions/build-dist@main
with:
dist-perl-deps-develop: strict # Add modules
test:
needs: [ 'dist', 'notify' ]
runs-on: ${{ matrix.os }}
defaults:
run:
# bash on macos and linux
# powershell on windows + strawberry perl
# msys2 {0} on windows + msys2
shell: >-
${{ fromJSON( '["", "bash {0}"]' )[ startsWith(matrix.os, 'ubuntu-' ) || startsWith(matrix.os, 'macos-') ]
}}${{ fromJSON( '["", "powershell {0}"]' )[ startsWith(matrix.os, 'windows-') && matrix.dist == 'strawberry' ]
}}${{ fromJSON( '["", "msys2 {0}"]' )[ startsWith(matrix.os, 'windows-') && matrix.dist == 'msys2' ] }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
perl-version: ['5.14', '5.20', '5.30', '5.34']
alien-install-type: [ 'system', 'share' ]
include:
# Windows strawberry | share
- { perl-version: '5.34' , os: windows-latest , dist: strawberry , alien-install-type: 'share' }
# Windows msys2 | system, share
- { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'system' }
- { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'share' }
# macOS | system, share
- { perl-version: '5.34' , os: macos-11 , alien-install-type: 'system' }
- { perl-version: '5.34' , os: macos-11 , alien-install-type: 'share' }
name: Perl ${{ matrix.perl-version }} on ${{ matrix.os }} with install-type ${{ matrix.alien-install-type }}, dist ${{ matrix.dist }}

steps:
- name: Get dist artifact
uses: actions/download-artifact@v3
with:
name: dist

# Setup system package
- name: Setup system ${{ env.PKG_NAME }} (apt)
if: runner.os == 'Linux' && matrix.alien-install-type == 'system'
run: |
sudo apt-get -y update && sudo apt-get install -y ${{ env.PKG_UBUNTU }}
- name: Setup system ${{ env.PKG_NAME }} (homebrew)
if: runner.os == 'macOS' && matrix.alien-install-type == 'system'
run: |
brew install ${{ env.PKG_HOMEBREW }}
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
if: runner.os == 'Windows' && matrix.dist == 'msys2'
with:
update: true
install: ${{ env.PKG_MSYS2_MINGW64_DEPS }}
- name: Set up ${{ env.PKG_NAME }} (MSYS2/MinGW pacman)
if: runner.os == 'Windows' && matrix.dist == 'msys2' && matrix.alien-install-type == 'system'
shell: msys2 {0}
run: |
pacman -S --needed --noconfirm ${{ env.PKG_MSYS2_MINGW64 }}
# Setup Perl
- name: Set up perl
uses: shogo82148/actions-setup-perl@v1
if: runner.os != 'Windows'
with:
perl-version: ${{ matrix.perl-version }}
- name: Set up perl (Strawberry)
uses: shogo82148/actions-setup-perl@v1
if: runner.os == 'Windows' && matrix.dist == 'strawberry'
with:
distribution: 'strawberry'
- name: Set up pkg-config-lite (Strawberry)
if: runner.os == 'Windows' && matrix.dist == 'strawberry' && matrix.alien-install-type == 'share'
run: |
choco install -y --allow-empty-checksums pkgconfiglite
echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- run: perl -V
- name: Install cpanm
if: runner.os == 'Windows' && matrix.dist == 'msys2'
run:
yes | cpan -T App::cpanminus || true

- name: Install Perl deps
run: |
cpanm --notest --installdeps .
- name: Install share install deps before setting ALIEN_INSTALL_TYPE
if: matrix.alien-install-type == 'share'
run: |
cpanm --notest Alien::Meson Alien::Ninja Net::SSLeay IO::Socket::SSL Alien::zix Alien::Serd
- name: Set ALIEN_INSTALL_TYPE
shell: bash
run: |
echo "ALIEN_INSTALL_TYPE=${{ matrix.alien-install-type }}" >> $GITHUB_ENV
- name: Set ALIEN_BUILD_PKG_CONFIG
if: runner.os == 'Windows' && matrix.dist == 'msys2'
run: |
echo "ALIEN_BUILD_PKG_CONFIG=PkgConfig::CommandLine" >> $GITHUB_ENV
- name: Run tests
env:
ALIEN_BUILD_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cpanm --verbose --test-only .
build-status:
runs-on: ubuntu-latest
continue-on-error: true
if: ${{ always() }}
needs: test
steps:
- uses: perlrdf/devops/github-actions/irc-notifications@main
with:
target-build-status: true
needs: ${{ toJSON(needs) }}
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# NAME

Alien::Sord - Find or build Sord in-memory RDF store

# SYNOPSIS

From [ExtUtils::MakeMaker](https://metacpan.org/pod/ExtUtils%3A%3AMakeMaker):

use ExtUtils::MakeMaker;
use Alien::Base::Wrapper ();

WriteMakefile(
Alien::Base::Wrapper->new('Alien::Sord')->mm_args2(
NAME => 'FOO::XS',
...
),
);

From [Module::Build](https://metacpan.org/pod/Module%3A%3ABuild):

use Module::Build;
use Alien::Base::Wrapper qw( Alien::Sord !export );
use Alien::Sord;

my $build = Module::Build->new(
...
configure_requires => {
'Alien::Base::Wrapper' => '0',
'Alien::Sord' => '0',
...
},
Alien::Base::Wrapper->mb_args,
...
);

$build->create_build_script;

From [Inline::C](https://metacpan.org/pod/Inline%3A%3AC) / [Inline::CPP](https://metacpan.org/pod/Inline%3A%3ACPP) script:

use Inline 0.56 with => 'Alien::Sord';

From [Dist::Zilla](https://metacpan.org/pod/Dist%3A%3AZilla)

[@Filter]
-bundle = @Basic
-remove = MakeMaker

[Prereqs / ConfigureRequires]
Alien::Sord = 0

[MakeMaker::Awesome]
header = use Alien::Base::Wrapper qw( Alien::Sord !export );
WriteMakefile_arg = Alien::Base::Wrapper->mm_args

From [FFI::Platypus](https://metacpan.org/pod/FFI%3A%3APlatypus):

use FFI::Platypus;
use Alien::Sord;

my $ffi = FFI::Platypus->new(
lib => [ Alien::Sord->dynamic_libs ],
);

Command line tool:

use Alien::Sord;
use Env qw( @PATH );

unshift @PATH, Alien::Sord->bin_dir;

# DESCRIPTION

This distribution provides Sord so that it can be used by other
Perl distributions that are on CPAN. It does this by first trying to
detect an existing install of Sord on your system. If found it
will use that. If it cannot be found, the source code will be downloaded
from the internet and it will be installed in a private share location
for the use of other modules.

# SEE ALSO

- [Sord](https://drobilla.net/software/sord.html)

Sord homepage.

- [Alien](https://metacpan.org/pod/Alien)

Documentation on the Alien concept itself.

- [Alien::Base](https://metacpan.org/pod/Alien%3A%3ABase)

The base class for this Alien.

- [Alien::Build::Manual::AlienUser](https://metacpan.org/pod/Alien%3A%3ABuild%3A%3AManual%3A%3AAlienUser)

Detailed manual for users of Alien classes.
48 changes: 37 additions & 11 deletions alienfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
use alienfile;

use Env qw(@PKG_CONFIG_PATH);
requires 'Alien::zix';
requires 'Alien::Serd';

plugin PkgConfig => 'sord-0';

eval {
require Alien::Meson;
Alien::Meson->_apply_destdir_prefix_hack;
};

share {
requires 'Alien::Build::Plugin::Gather::Dino';
requires 'Alien::Build::Plugin::Download::GitLab';
requires 'Alien::Meson';
requires 'Alien::Meson' => '0.06';
requires 'Alien::Ninja';

# https://gitlab.com/drobilla/sord
plugin 'Download::GitLab' => (
gitlab_user => 'drobilla',
gitlab_project => 'sord',
);

plugin Extract => 'tar.gz';

eval {
require Alien::zix;
require Alien::Serd;
push @PKG_CONFIG_PATH, map { $_->pkg_config_path }
qw(Alien::zix Alien::Serd);
} or warn "Unable to add to \$PKG_CONFIG_PATH (@PKG_CONFIG_PATH): $@";

meta->prop->{destdir} = 1;
my $build_dir = '_build';
build [
[ '%{meson}', 'setup',
'--prefix=%{.install.prefix}',
'--libdir=lib',
'--buildtype=release',
'-Ddocs=disabled', # no docs
$build_dir ],
[ '%{ninja}', qw(-C), $build_dir, "test" ],
[ '%{ninja}', qw(-C), $build_dir, 'install' ],
map {
my $linkage = $_; (
sub {
my $build = shift;
Alien::Build::CommandSequence->new([
Alien::Meson->exe, 'setup',
"-Ddefault_library=$linkage",
'--prefix=%{.install.prefix}',
'--libdir=lib',
'--buildtype=release',
'-Ddocs=disabled', # no docs
"${build_dir}_$linkage",
])->execute($build);
},
[ '%{ninja}', qw(-C), "${build_dir}_$linkage", "test" ],
[ '%{ninja}', qw(-C), "${build_dir}_$linkage", 'install' ],
) } qw(shared static)
];

plugin 'Gather::Dino';
plugin 'Gather::IsolateDynamic';
}
22 changes: 20 additions & 2 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,25 @@ copyright_year = 2023

version = 0.01

[@Starter]
revision = 5
; has to come before Git::Commit
[NextRelease]
[PkgVersion]

[@Starter::Git]
revision = 5
[AutoPrereqs]
[AlienBuild]
; authordep Alien::Build::Plugin::Download::GitLab
[CheckChangesHasContent]
[GithubMeta]
issues = 1
[ReadmeAnyFromPod]
type = markdown
location = root
filename = README.md
phase = release
[Regenerate::AfterReleasers]
plugin = ReadmeAnyFromPod

[MetaResources]
x_IRC = irc://irc.perl.org/#perlrdf
Loading

0 comments on commit 8976714

Please sign in to comment.