DEV Community

Gabor Szabo
Gabor Szabo

Posted on • Originally published at


Day 5: CI for Win32-Wlan Perl module

I found Win32-Wlan on CPAN Digger as a Perl package that does not have CI configured in its GitHub repository.

While the indicates that this is a Windows-related thing, there are a number of packages on CPAN that are in the Win32 namespace, but also work on Linux. This one, it seems does not. It seems at least one of its dependencies, the Win32-API does not work on anything else besides Windows.

In the Makefile.PL of Win32-API I saw this code:

my $running_on_windows = $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys';
die qq(OS unsupported\n)
    unless $running_on_windows
    or $ENV{WIN32_API_BUILD}     # So I can build it on Linux too
Enter fullscreen mode Exit fullscreen mode

So it can also work on cygwin and msys and it can be packaged on Linux as well.

We might be able to setup a Linux machine to build the distribution of the module and then we can run the tests on various versions of Perl on Windows. However I did not want to invest that much time before I even see that it would be interesting to the maintainer of the package.

The setup was quite simple as you can see from the GitHub Action config file below.

I had to remove the two most recent versions of Perl as it seems they are not available in the GitHub Action I used. That could be improved.

The Pull-Request

GitHub Actions

name: CI

    - cron: '42 5 * * *'

      fail-fast: false
        runner: [windows-latest]
        perl: [ '5.30', '5.32' ] # It seems that perl 5.34 and 5.36 are not available

    runs-on: ${{matrix.runner}}
    name: OS ${{matrix.runner}} Perl ${{matrix.perl}}

    - uses: actions/checkout@v3

    - name: Set up perl
      uses: shogo82148/actions-setup-perl@v1
          perl-version: ${{ matrix.perl }}
          distribution: ${{ ( startsWith( matrix.runner, 'windows-' ) && 'strawberry' ) || 'default' }}

    - name: Show Perl Version
      run: |
        perl -v

    - name: Install Modules
      run: |
        cpanm -v
        cpanm --installdeps --notest .

    - name: Show Errors on Windows
      if:  ${{ failure() && startsWith( matrix.runner, 'windows-')}}
      run: |
         ls -l C:/Users/
         ls -l C:/Users/RUNNER~1/
         cat C:/Users/runneradmin/.cpanm/work/*/build.log

    - name: Run tests
      run: |
        perl Makefile.PL
        make test
Enter fullscreen mode Exit fullscreen mode


Sometimes you need Windows.

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git