rnp icon indicating copy to clipboard operation
rnp copied to clipboard

CI: add Gentoo runner

Open ni4 opened this issue 3 years ago • 10 comments

Description

...checking both Botan and OpenSSL backends.

ni4 avatar Sep 20 '22 12:09 ni4

Who is going to add it?

antonsviridenko avatar Oct 05 '22 17:10 antonsviridenko

@antonsviridenko Anybody interested in :) Feel free to go ahead.

ni4 avatar Oct 05 '22 17:10 ni4

I see you are more experienced in CI related things :) I can help with Gentoo-specific questions.

Btw, how git branch from the PR is passed to the runner? So the upcoming changes can be built from sources, ones that are not merged yet to the master branch?

antonsviridenko avatar Oct 05 '22 18:10 antonsviridenko

Ah, okay then ) I am not familiar with Gentoo's package manager, so postponed this. Branch is checked via actions/checkout@v2, and this one most likely uses GITHUB_REF_NAME env variable. Please see https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables for the details.

ni4 avatar Oct 05 '22 18:10 ni4

  1. Docs say GitHub provides only Ubuntu, Windows & macos VMs. Are other OSes that we use (Centos, Fedora) self-hosted?

  2. Gentoo does not have GitHub "runner" application in a repository, and "runner" repo does not list Gentoo in supported distros. Most likely it is possible to build & run it on Gentoo, but it will take some efforts.

antonsviridenko avatar Oct 05 '22 21:10 antonsviridenko

  • Docs say GitHub provides only Ubuntu, Windows & macos VMs. Are other OSes that we use (Centos, Fedora) self-hosted?

Ubuntu runner may use Docker image, that's how centos workflows work, see the following in .yml file:

container:
      image: tgagor/centos:stream9
  • Gentoo does not have GitHub "runner" application in a repository, and "runner" repo does not list Gentoo in supported distros. Most likely it is possible to build & run it on Gentoo, but it will take some efforts.

Latest Gentoo Docker images are available here: https://hub.docker.com/u/gentoo/

I've got Gentoo setup working locally via the following Dockerfile snippet:

FROM gentoo/portage:latest as portage
FROM gentoo/stage3:latest
COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo

RUN emerge dev-utils/cmake
RUN emerge dev-libs/json-c
#RUN emerge dev-libs/openssl
RUN emerge dev-cpp/gtest

ni4 avatar Oct 06 '22 08:10 ni4

It is better to install all dependencies in a single run of "emerge" command, it is bit slow and takes long time to calculate dependencies each time. Also app-arch/bzip2 and sys-libs/zlib should be installed too. So it should be like

RUN emerge dev-utils/cmake dev-libs/json-c dev-cpp/gtest dev-libs/botan app-arch/bzip2 sys-libs/zlib virtual/pkgconfig dev-ruby/asciidoctor

antonsviridenko avatar Oct 09 '22 02:10 antonsviridenko

I propose to use our RNP gentoo overlay & install emerge =app-crypt/rnp-9999 instead of building sources manually. This way ebuild scripts will be tested too.

Version 9999 in Gentoo means "live ebuild", i.e. package built from the latest development version, last commit from the repo.

https://github.com/rnpgp/gentoo-rnp/blob/master/app-crypt/rnp/rnp-9999.ebuild#L11

Remaining issue is to tell package manager which git branch to pull instead of default one.

Branch is checked via actions/checkout@v2, and this one most likely uses GITHUB_REF_NAME env variable.

https://devmanual.gentoo.org/eclass-reference/git-r3.eclass/index.html

git branch can be specified by setting ebuild variable EGIT_BRANCH, but these variables are not supposed to be set on the command line or through environment variables. That means we need to overwrite rnp-9999.ebuild file each time and put new value for EGIT_BRANCH inside.

antonsviridenko avatar Oct 09 '22 03:10 antonsviridenko

@antonsviridenko This approach could bring more complications, as CI should also work with forks, and so on. Also from the architectural point of view Gentoo stuff is something which of higher layer then RNP library, so we should not call it from lower layer. I'd suggest to separate this in two solutions:

  • build and run RNP tests on Gentoo image like we do that for centos and so on
  • add CI to the gentoo-rnp repository which would run tests/check build scripts there on the latest release + latest master.
  • btw, it should be the time to add rnp-0.16.2.ebuild to that repository.

Does this sound good, or do I miss something?

ni4 avatar Oct 11 '22 13:10 ni4

ok, sounds reasonable

antonsviridenko avatar Oct 12 '22 00:10 antonsviridenko