rnpgp / rnp

RNP: high performance C++ OpenPGP library used by Mozilla Thunderbird
https://www.rnpgp.org
Other
192 stars 54 forks source link

CI: add Gentoo runner #1913

Open ni4 opened 1 year ago

ni4 commented 1 year ago

Description

...checking both Botan and OpenSSL backends.

antonsviridenko commented 1 year ago

Who is going to add it?

ni4 commented 1 year ago

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

antonsviridenko commented 1 year ago

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?

ni4 commented 1 year ago

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.

antonsviridenko commented 1 year ago
  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.

ni4 commented 1 year ago
  • 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
antonsviridenko commented 1 year ago

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 commented 1 year ago

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.

ni4 commented 1 year ago

@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:

Does this sound good, or do I miss something?

antonsviridenko commented 1 year ago

ok, sounds reasonable