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

**URL:** <https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656>\
**Category:** fpm\
**Created:** [November 4, 2022, 2:40pm UTC](https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656 "2022-11-04T14:40:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyrilgandon](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/cyrilgandon/32/2151_2.png) [@cyrilgandon](https://fortran-lang.discourse.group/u/cyrilgandon)\
**Post date:** [November 4, 2022, 2:40pm UTC](https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656/1 "2022-11-04T14:40:48Z")

</div>

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…

```auto
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

```

returns

`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](https://gitlab.com/everythingfunctional/veggies/-/blob/main/.gitlab-ci.yml))

---

<div class="post-metadata">

**Author:** ![plevold](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/plevold/32/754_2.png) [@plevold](https://fortran-lang.discourse.group/u/plevold)\
**Post date:** [November 4, 2022, 3:12pm UTC](https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656/2 "2022-11-04T15:12:46Z")

</div>

One solution:

```auto
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.

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [November 4, 2022, 3:27pm UTC](https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656/3 "2022-11-04T15:27:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![urbanjost](https://avatars.discourse-cdn.com/v4/letter/u/0ea827/32.png) [@urbanjost](https://fortran-lang.discourse.group/u/urbanjost)\
**Post date:** [November 5, 2022, 8:24am UTC](https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656/4 "2022-11-05T08:24:47Z")

</div>

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

> **[easy/.github/workflows at main · urbanjost/easy](https://github.com/urbanjost/easy/tree/main/.github/workflows)**
>
> main/.github/workflows

l  
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.

---

<div class="post-metadata">

**Author:** ![cyrilgandon](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/cyrilgandon/32/2151_2.png) [@cyrilgandon](https://fortran-lang.discourse.group/u/cyrilgandon)\
**Post date:** [November 7, 2022, 8:28am UTC](https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656/5 "2022-11-07T08:28:27Z")

</div>

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

In `.gitlab-ci.yml`

```auto
default:
  image: registry.gitlab.com/everythingfunctional/dockerfpm

```

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [November 7, 2022, 3:56pm UTC](https://fortran-lang.discourse.group/t/what-is-the-best-way-to-use-fpm-in-gitlab-pipeline-debian/4656/6 "2022-11-07T15:56:11Z")

</div>

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