OSDC for Perl developers 2023.01


Chenhui Niu Darren Harwood Simon Windsor Steve Rogerson


Gabor Szabo



Session 1: Welcome, Version Control, Journal, Slack

Assignment 1

A couple of suggestions for the blog posts * Use a title that can sound interesting to others as well eg. How to contribute to an open source project or How to Send a pull request on GitHub. * Add osdc tag and other relevant tags. * Add the series: field to the Jekyll front matter (the header of each post on DEV.to) * Use Markdown in the post. * Include links to the relevant sites and pages such as the web site of the Open Source Development Course and the web site of our course: Open Source Development Course for Perl developers.

Session 2: Create GitHub Pages using the git CLI; GitHub Actions

git config --global --add user.name "Foo Bar" git config --global --add user.email foo@bar.com

These commands created the ~/.gitconfig file.

ssh-keygen Add public key to GitHub in User setting area

``` git clone

git status git diff git add git commit git show SHA git push git remote -v

git blame

git pull # both with merge and rebase ```

In ~/.gitconfig set the default action for pull:

[pull] rebase = true

We also saw:

gitk --all

Assignment 2

Once it is done add the following entry to your JSON file: "github_page": true,

See the mentors/szabgab.json for an example.

Session 3: GitHub Actions, CPAN Digger

Specifically we looked at * Bash * PostgreSQL * Perl with Makefile.PL * OSDC Site generator

Assignment 3

Session 4: Docker


We set out working on one of the Perl modules listed in the JSON files in the participants/ folder, but then ended up covering Docker.

We used many examples from the Docker slides to introduce Docker.

We saw the Docker image I use to deal with various open source projects.

We added Dist::Zilla to this image.

Assignment 4

Session 5: Docker HUB; Docker Compose

The configuration file of docker to map all the data (all the volumes, images, containers) to a disk which is not the default.

$ cat /etc/docker/daemon.json { "data-root": "/home/data/docker" }

Take one of the projects from the list of projects of the participants, run the tests locally using the Docker container (dr). Open issue when necessary. Set up GitHub Actions if needed. Create test coverage report.

Assignment 5

Session 6: GitHub Actions for Types::RENEEB

git clone git@github.com:reneeb/Types-RENEEB.git

git remote add fork git@github.com:yewtc/Types-RENEEB.git

git checkout -b BRANCH make changes git add . git commit -m "..." git push --set-upstream fork BRANCH

git checkout master git pull origin master

git branch -d BRANCH git push -d origin BRANCH

``` cpanm Dist::Zilla::App::Command::cover

dzil cover ```

Session 7: GitHub Action for DBIx-Class, ack

In this session we tried to add GitHub Actions (CI) to DBIx::Class.

It already had an extensive configuration of Travis-CI, but unfortunately Travis stopped its free service.

I briefly explained how my slides used to be generated using a Webhook.

We used the playground Docker image we covered in a previous session.

We still had to install Module::Install as it was a developer dependency.

cpanm --notest Module::Install

Then we could install all the other dependencies:

cpanm --installdeps --notest .

However when we ran perl Makefile.PL it still complained about a lot of missing modules. So we created a temporary file just to install those:

cpanm --notest Class::DBI::Plugin::DeepAbstractSearch cpanm --notest Class::MethodCache cpanm --notest Class::Unload cpanm --notest Date::Simple cpanm --notest DateTime::Format::MySQL cpanm --notest DateTime::Format::Pg cpanm --notest DateTime::Format::SQLite cpanm --notest DateTime::Format::Strptime cpanm --notest JSON cpanm --notest JSON::Any cpanm --notest JSON::DWIW cpanm --notest JSON::XS cpanm --notest Math::Base36 cpanm --notest MooseX::Types::JSON cpanm --notest MooseX::Types::LoadableClass cpanm --notest MooseX::Types::Path::Class cpanm --notest PadWalker cpanm --notest Pod::Coverage cpanm --notest SQL::Translator cpanm --notest Test::EOL cpanm --notest Test::NoTabs cpanm --notest Test::Pod cpanm --notest Test::Pod::Coverage cpanm --notest Test::Strict cpanm --notest Text::CSV cpanm --notest Time::Piece::MySQL

There must be a better way to install all of these, but we could not find the instructions. So one addition to the project could be an easy way to find insttruction on how to set up the local development environment.

After this we managed to run the tests though many were skipped for various reasons. For example some needed access to real databases.

Then we set up CI based on one of the GitHub Actions examples.

We pushed it out, but it did not start to work. Yesterday GitHub had a big outage, so we looked at the GitHub status and indeed, GitHub Actions was yellow. It did not work properly. Eventually it started our job, but it took several minutes to do so.

To our (or at least my) surprise, once GitHub Actions started to run the tests passed on the first attempt.

However we wanted to see how to run the tests with PostgreSQL as well.

For that we had to install DBD::Pg, another module that does not have a CI. (neither to DBD::mysql nor DBD::Oracle for that matter.

To install DBD::Pg locally we found in the readme of DBD::Pg which is linked from the DBD-Pg page. (I did not remember that during our session.)

apt-get install libpq-dev cpanm --notest DBD::Pg

Then we added another YAML file for the GitHub Action, this time running insied a Docker container, based on the PostgreSQL GitHub Action example.

It needed some parameters to pass the hostname of the Postgres server, the name of the database, the username and the password.

I briefly used and mentioned ack aka. beyondgrep an excellent grep-like tool in Perl.

To our surprise this too worked on the first try. I was so surprised I had to see a more detailed report and thus we split the GitHub Action job up and had a separate section where we used prove to run the tests in verbose mode.

At the end we sent a pull-request with what we accomplished.

Session 8: DBD::Pg, test coverage with Devel::Cover

Session 9: git stash, detached head

git add -i git stash -u git stash list git stash show git stash show -p

Session 10: git stash and bisect, adding test to RSRU

Date: 2023.04.25

git detached head merge / rebase reset stash bisect revert

Session 11: Git Flow; GitHub Actions for Test::Class

Date: 2023.05.02

Session 12: GitHub Actions; faster CI

Session 13: CVEs and lack of maintenance of CPAN modules

Date 2023.05.23