rnpgp / snap-rnp

Snap package for RNP
1 stars 0 forks source link

Add GitHub Actions for Snap build and push #3

Closed ronaldtse closed 4 years ago

ronaldtse commented 4 years ago

As title.

ronaldtse commented 4 years ago

@rrrooommmaaa are you handling this? We need:

  1. GitHub Actions to build snap to ensure it works
  2. If build passes, GitHub Actions should publish the snap

I can provide an SSH deployment key for the CI user in the ${{ secret.SNAP_DEPLOY_SSH_KEY }} variable.

Thanks!

ronaldtse commented 4 years ago

The SNAP_DEPLOY_SSH_KEY secret has been added. You can do something like this (on Travis, should be transformed into Github Actions syntax) : https://github.com/metanorma/latexml-snap/blob/master/.travis.yml

rrrooommmaaa commented 4 years ago

@ronaldtse Well, action-snapcraft plugin supports Snap Store login token. As per instruction: You will also need a Snap Store login token. To obtain one, run the following command on your machine: snapcraft export-login --snaps SNAP_NAME --channels edge -

Would it be simpler to use this format? It is suggested to be put to secrets.snapcraft_token variable

ronaldtse commented 4 years ago

@rrrooommmaaa it's now in secrets.SNAPCRAFT_RELEASE_LOGIN. You will need to do:

echo "${secrets.SNAPCRAFT_RELEASE_LOGIN}" > snap-exported-login
snapcraft login --with snap-exported-login

This macaroon has these properties:

snaps:       ['rnp']
channels:    ['beta', 'edge', 'stable']
permissions: ['package_push', 'package_release', 'package_access']
expires:     2020-12-01T18:36:35.339587
ronaldtse commented 4 years ago

@rrrooommmaaa please help enable auto-release in GitHub Actions for this repo. Thanks!

ronaldtse commented 4 years ago

Ping @rrrooommmaaa .

rrrooommmaaa commented 4 years ago

@ronaldtse The snap is built and pushed to edge channel as version 0+git.f0a3766 (that's what was extracted from rnp github repository, I think). Also, there might be unnecessary files in the snap, e.g. botan executable, .h, docs for botan, gzip, bzip2 and libjson-c. They were bundled automatically.

rrrooommmaaa commented 4 years ago

The f0a3766 is the latest commit from this rnp-snap repository. If you tag it, the tag will appear as version during the next build. Or we can simply put the version in snapcraft.yaml file and increment it.

ronaldtse commented 4 years ago

@rrrooommmaaa I think:

  1. We should use the version number from the latest release (0.12)
  2. Snap uses the concept of "alias" for commands, I don't think we are able to package executables like botan, etc. (We should however remove it from our package). This means we should also alias the rnpkeys executable. This is what we did here: https://forum.snapcraft.io/t/add-default-aliases-for-latexml-package/13562
rrrooommmaaa commented 4 years ago

@ronaldtse Yes, there are already rnp and rnpkeys aliases. The question was: should I try and remove unnecessary files from the snap.

ronaldtse commented 4 years ago

The question was: should I try and remove unnecessary files from the snap.

Yes please. Thanks!

ronaldtse commented 4 years ago

The snap is built and pushed to edge channel as version 0+git.f0a3766 (that's what was extracted from rnp github repository, I think).

Ping @ni4 @dewyatt . Should we maintain a Release (vx.y.z) and an Edge channel (dev/nightlies?) ?

rrrooommmaaa commented 4 years ago
  1. We should use the version number from the latest release (0.12)

@ronaldtse I'm testing the build. It turns out that 0.12 can't be built because of incorrect cmocka configuration. Can we tag the current head v0.12.1 and start from there? It is built ok.

ronaldtse commented 4 years ago

@rrrooommmaaa I'll defer the version definition to @dewyatt and @ni4 , but it seems reasonable to do so (or 0.13?).

dewyatt commented 4 years ago

@ronaldtse I'm testing the build. It turns out that 0.12 can't be built because of incorrect cmocka configuration. Can we tag the current head v0.12.1 and start from there? It is built ok.

@rrrooommmaaa I have no issues building 0.12.0, can you elaborate?

rrrooommmaaa commented 4 years ago

@dewyatt This is the Ubutnu 18.04 log from Github Action worker:

CMake Warning at cmake/Modules/Findcmocka.cmake:44 (find_package):
  By not providing "Findcmocka.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "cmocka", but
  CMake did not find one.

  Could not find a package configuration file provided by "cmocka" with any
  of the following names:

    cmockaConfig.cmake
    cmocka-config.cmake

  Add the installation prefix of "cmocka" to CMAKE_PREFIX_PATH or set
  "cmocka_DIR" to a directory containing one of the above files.  If "cmocka"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  src/tests/CMakeLists.txt:26 (find_package)

-- Found PythonInterp: /usr/bin/python2.7 (found suitable exact version "2.7.15") 
-- Found GnuPG: /usr/bin/gpg (found suitable version "2.2.4", minimum required is "2.2") found components:  gpg gpgconf 
-- Configuring done
CMake Error at src/tests/CMakeLists.txt:29 (add_executable):
  Target "rnp_tests" links to target "cmocka::cmocka" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

The agent takes the last tag with the following script:

      last_committed_tag="$(git tag -l --sort=-v:refname | head -1)"
      VERSION=${last_committed_tag}
      git fetch
      git checkout "${VERSION}"

There isn't such error with HEAD. I suggest to add another tag.

rrrooommmaaa commented 4 years ago

ping @dewyatt

dewyatt commented 4 years ago

@rrrooommmaaa Can you show how you are trying to build, and not just the output?

rrrooommmaaa commented 4 years ago

@dewyatt This is run on Ubuntu 18.04 system with snapcraft cmake plugin: https://github.com/snapcore/snapcraft/blob/master/snapcraft/plugins/cmake.py I don't pass any configuration parameters there. Perhaps, if I pass -DBUILD_TESTING=off it will work, but it's better just to create a new tag, as long as HEAD is built ok with testing.

rrrooommmaaa commented 4 years ago

@dewyatt I also have problems building v0.12.0 on MingGW. Error in librepgp/repgp.cpp -- strndup undefined. We desperately need a new version.

dewyatt commented 4 years ago

@rrrooommmaaa No worries, I'll work on cutting a new release.

dewyatt commented 4 years ago

@rrrooommmaaa 0.13.0 has been released

ronaldtse commented 4 years ago

Ping @rrrooommmaaa this is now actionable. Thanks!