-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial GitHub Actions workflow #374
Conversation
To make the most out of the Coveralls service for code coverage, enabling the Status API would be helpful as discussed at #224 (comment). |
c61ca82
to
893eb70
Compare
92cf0f0
to
1c00d90
Compare
As an aside, if a workflow must be created for the rest of the repos, it might be worth creating a shared set of GitHub Actions as done at https://github.com/PDLPorters/devops/tree/master/github-actions and https://github.com/Perl-GPU/devops/tree/main/github-actions. |
This uses Coveralls for coverage reporting.
@cjfields, @carandraug, reaching out for review of this. Also, thoughts on standardising the CI across the organisation? |
Awesome work, thanks! If we can come up with a standard, yes it makes sense to standardize for all repos under the bioperl org. Let's give it a week, if @carandraug or others don't have any objections or comments I'll merge. |
- { os: 'ubuntu-latest', perl: "5.20" } | ||
- { os: 'ubuntu-latest', perl: "5.30" } | ||
- { os: 'ubuntu-latest', perl: "5.32" } | ||
- { os: 'ubuntu-latest', perl: "5.36" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you say what motivates the selection of these versions, and needing to have 5 explicitly specified ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I was looking at CPAN Testers to find a minimum version that had no failures and then added a couple more versions spaced apart to get a sample (this could be changed to test against every stable version). While Perl is very backwards compatible, sometimes getting an idea of when something like a warning appears can help narrow down where it is coming from.
It should probably add Perl 5.6 as well since that is what the dist explicitly has as the minimum version, but this looks wrong after I scanned the code to find if it used newer features:
$ perlver lib/ > output.log
$ grep -vP 'v5\.[56]\.' output.log | grep 'v5' | cut -d'|' -f2 | head -n -2 | tr -d ' ' | xargs -n1 perlver --blame
------------------------------------------------------------
File : lib/BioPerl.pm
Line : 3
Char : 1
Rule : _pragma_utf8
Version : 5.008
------------------------------------------------------------
use utf8;
------------------------------------------------------------
------------------------------------------------------------
File : lib/Bio/PullParserI.pm
Line : 296
Char : 21
Rule : _open_scalar
Version : 5.008
------------------------------------------------------------
open my $fake_fh, "+<", \$thing or $self->throw("Could not open file '$thing': $!");
------------------------------------------------------------
------------------------------------------------------------
File : lib/Bio/Root/IO.pm
Line : 288
Char : 13
Rule : _binmode_2_arg
Version : 5.008
------------------------------------------------------------
binmode
------------------------------------------------------------
------------------------------------------------------------
File : lib/Bio/Tree/Tree.pm
Line : 393
Char : 5
Rule : _open_scalar
Version : 5.008
------------------------------------------------------------
open my $fh, '>', \$string or $self->throw("Could not write '$string' as file: $!");
------------------------------------------------------------
------------------------------------------------------------
File : lib/Bio/Tools/GuessSeqFormat.pm
Line : 465
Char : 9
Rule : _open_scalar
Version : 5.008
------------------------------------------------------------
open $fh, '<', \$text or $self->throw("Could not read from string: $!");
------------------------------------------------------------
So the minimum needs to be bumped to Perl v5.8. I'll open an issue for that.
Having the minimum version would help with finding issues where a change actually requires a newer Perl version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue at #375.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool, thanks so much @zmughal 🎉 |
If we create a |
I'm not familiar with github actions. However, why are we using |
That can be fixed pretty easily :) |
I agree, though maybe we need to test both paths somewhat? I'd think |
This GitHub Actions workflow is similar to the previous Travis CI set up and that also used
Installing via a CPAN client is the typical scenario for libraries that will go on CPAN as there isn't a way to pin to a specific version for library code (using a It wouldn't be too much work to test that as well to establish a baseline of dependency versions, but it would be a separate workflow (and it would have to use the system Perl so could only test against that Perl version). This would either explicitly list the packages or use $ cpanm -q --showdeps ./BioPerl-1.7.8.tar.gz | perl -lpe 's,::,/,g; $_ = qq{/usr/share/perl5/$_.pm}' | apt-file search -lFf -
libdata-stag-perl
liberror-perl
libgraph-perl
[...]
libwww-perl
[...]
libyaml-perl I suppose adding this would help Debian users and possibly catch things for the Debian Med and Debian Perl packaging team. I'm thinking it should be done in a container (stable: |
Personally I'd say go with the path that is easiest to maintain and build upon. If it works for bioperl-live (which is by far the most complicated), it should work for any other repos under the bioperl org. |
@carandraug, I have a branch that tests using Debian containers as well. It's quite small and should be reusable across the organisation: zmughal-contrib@6751bb8. commit 6751bb8c2d818af41a8cf56b12ba47e2dd6cb4b2
Add test using Debian container
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 05b8185da..762b2f04f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,6 +9,8 @@ on:
env:
PKG_DEPS_UBUNTU: >-
libdb-dev
+ PKG_DEPS_DEBIAN: >-
+ libdb-dev
jobs:
dist:
@@ -122,3 +124,29 @@ jobs:
run: |
cpanm --verbose --test-only .
cover -report Coveralls
+
+ containers:
+ needs: dist
+ runs-on: ubuntu-latest
+ container: ${{ matrix.container }}
+ strategy:
+ fail-fast: false
+ matrix:
+ container: ['debian:bullseye', 'debian:bookworm']
+ steps:
+ - name: Get dist artifact
+ uses: actions/download-artifact@v3
+ with:
+ name: dist
+ - name: Setup system deps (apt)
+ if: ${{ startsWith(matrix.container, 'debian:') }}
+ run: |
+ apt-get -y update && apt-get install -y --no-install-recommends perl cpanminus make apt-file
+ apt-file update
+ apt-get install -y --no-install-recommends \
+ ${{ env.PKG_DEPS_DEBIAN }} \
+ $( cpanm -q --showdeps . | perl -MConfig -MCwd=abs_path '-M5;@prefixes = map abs_path($_), @Config{qw(vendorlibexp vendorarchexp)}' -lpe 's,~.*$,,; s,::,/,g; $mod = $_; $_ = join qq{\n}, map { qq{$_/${mod}.pm} } @prefixes' | apt-file search -lFf - )
+
+ - name: Run tests
+ run: |
+ cpanm --verbose --test-only . Also, this revealed a failing test! I'll open an issue for that. |
Any other specific changes I should make here? This is just the first step and when consolidated into a shared reusable workflow, it can be modified in a single place for the whole organisation. |
I don't think there are any objections to this apart from maybe simple tweaks which can be accomplished later. Thanks for taking this on @zmughal ! |
This is per discussion at: - <bioperl#374 (comment)>, - <bioperl#375>.
This tests against specific Debian releases using all Perl module dependencies that can be installed via `apt-get`. This is per discussion at <bioperl#374 (comment)>.
Great! Another thing that would be useful to have is to go to https://coveralls.io/github/bioperl/bioperl-live/settings and enable the Status API so that the coverage can be displayed as part of the pull request. A screenshot of an example setting: |
@zmughal done! |
This is per discussion at: - <#374 (comment)>, - <#375>.
This tests against specific Debian releases using all Perl module dependencies that can be installed via `apt-get`. This is per discussion at <bioperl#374 (comment)>.
This tests against specific Debian releases using all Perl module dependencies that can be installed via `apt-get`. This is per discussion at <#374 (comment)>.
Since Travis CI is changed its terms, many FOSS projects on GitHub have started
using GitHub Actions instead. This was previously discussed at
#224 (comment).
This PR is an initial working CI workflow to get started with GitHub Actions.
Ibelieve that further work can be done to enable Coveralls code coverage.
I can either add that in this PR or in subsequent PRs.I have added Coveralls support to this PR