What is the best way to use fpm in gitlab pipeline ? (debian)

I intend to use fpm to build and unit test my project.
I’d like to also use gitlab pipeline for my CI.
Unfortunataely, fpm is not available in debian packages…

Running with gitlab-runner 15.4.0
Preparing the "docker" executor
Using Docker executor with image debian:latest ...
Pulling docker image debian:latest ...


apt-get install fpm


Unable to locate package fpm

I was wondering whay should be the best way to install it? Download it in my repo and build it by hand? Download it from a static url?

Is there someone that have already use Gitlab pipeline with fpm and can share his experience? I guess it is the same question with Github actions.

Edit: I will add another option, using an image already existing like image: registry.gitlab.com/everythingfunctional/dockerfpm
Of course I have seen a lot of good examples coming from @everythingfunctional (.gitlab-ci.yml · main · Brad Richardson / veggies · GitLab)


One solution:

mkdir -p $HOME/bin \
    && curl --location https://github.com/fortran-lang/fpm/releases/download/v0.7.0/fpm-0.7.0-linux-x86_64 -o $HOME/bin/fpm \
    && chmod +x $HOME/bin/fpm

This will download fpm version 0.7.0 for Linux from GitHub. Then make sure that $HOME/bin/ is in the PATH environment variable.

I’ve been slowly working on a complete example for GitHub Actions for Fortran and meaning to put together a YouTube video demonstrating it. Expect that in the coming weeks. I can possibly add GitLab CI to that video, or make a separate one if there’s interest.


Lately everything I compile on vanilla MSWindows with github CD/CI seems to fail with no output or visible error. Quite a while ago I was starting an example of how to set up a github repository for use with fpm
including the simplest CD/CI scripts I could (intentionally making one for each system type). The idea was that it would run ‘fpm test’ on each platform and could simply be copied into a new project unchanged.

Never got the time to go back and flesh it out, but the .github directory I started with has worked for a lot of basic repositories until the MSwindows one started failing. Tried a couple of things to see what was wrong so it is currently a bit uglier than it was; does anyone have a minimal example of compiling and running with at least gfortran 10 (preferably newer) ? The MSYS2 and MINGW and other ones still work; but the one in

under test_gfortran_wndows.yml looks at first to compile with no problem, but then anything compiled with it generates no obvious output and returns error status 1. Not a powershell/MSWIndows user so I could be missing something really obvious to someone who is, but something very much like this was running fine until recently.

I found starting off with github/gitlab CD/CI was a rather unpleasant experience myself, and think something better than mine but along the same idea (canned scripts that run “fpm test” that you can just copy into your .github directory) would be useful for fpm(1) users; @everythingfunctional if you could add that to what sounds like a more general Fortran CD/CI setup I would find that particularly interesting.

Ideally from my perspective, I was hoping for an fpm plugin that you could simply run with something like “fpm ci” that might prompt you for a few things and then set up a basic CD/CI for gitlab/github/…that would run “fpm test --profile debug” and “fpm test --profile release” that would be at least a good starting point for an fpm repository and maybe all you need.

For the time being, I will use the docker image of everythingfunctional, it’s working great.

In .gitlab-ci.yml

  image: registry.gitlab.com/everythingfunctional/dockerfpm
1 Like

All of my Fortran libraries are officially hosted on GitLab, and using the docker image for CI. Glad you found it useful.

1 Like