---
# System prepended metadata

title: GitHub actions
tags: [' Tech', WIP]

---

---
tags: WIP, Tech
---

# GitHub actions

## Problem

- travis-ci.org [shutting down at the end of 2020](https://mailchi.mp/3d439eeb1098/travis-ciorg-is-moving-to-travis-cicom)
    - used across the OME/IDR GitHub organizations since 5-8 years
    - already impacts CI builds as Travis VM are getting migrated

# Solutions

- Migrate to [travis-ci.com](https://travis-ci.com)
    - Existing [migration guide](https://docs.travis-ci.com/user/migrate/open-source-repository-migration). Looks straightforward
    - Unclear whether this will fix build times and issues reported over the years
    - See also https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing re long-term OSS support
- Alternative: migrate to [GitHub actions](https://github.com/features/actions)
    - Builds on growing experience from last few weeks
    - Requires conversion work

## GitHub actions

- Based on the creation of workflows - see [workflow syntax reference](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions)
    - Workflow is made of jobs, parallel or sequential
    - Workflow is triggered based on event e.g. push or pull request
    - Job is a series of steps
    - A step is a task that can run a command or an actions e.g. checkout a repo, run a command.
    - Actions: smallest building block. Standalone command  that can be created, exchanged, reused
    - Support for various environments incl. Windows/Linux/Mac, various flavors of Java/Python
- omero-py: example of [monolithic workflow](https://github.com/ome/omero-py/blob/v5.8.3/.github/workflows/workflow.yml)
    - executed on every push or pull requrest
    - test job running on multiple Python versions and operating systems: calls tox
    - publish job executed on tags only: deploys the distribution to PyPI
    - Examples of execution
        - [Pull Request](https://github.com/ome/omero-py/actions/runs/319388544)
        - [Tag](https://github.com/ome/omero-py/actions/runs/283027113)
    - Pro: closest to the current Travis paradigm i.e. single multi-stage build
    - Con: potentially requires a per-repo conversion
- omero-web: example of [multiple workflows](https://github.com/ome/omero-web/pull/240/files)
    - three types of workflows: code review, build-n-test and build-n-publish
    - Pro: abstract core checks into a set of re-usable workflows (see below)
    - Con: no dependency between separate workflows

- [Organization workflow templates](https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/sharing-workflows-with-your-organization#creating-a-workflow-template)
    - Stored under [the OME .github repo](https://github.com/ome/.github/tree/master/workflow-templates)
    - Requires a YML file (workflow) + a JSON file (metadata)
    - Example template: [publish to PyPI  on tag](https://github.com/ome/.github/tree/master/workflow-templates)
    - Appears when creating a new workflow e.g. https://github.com/ome/omero-weberror/actions

## Open questions

- Other alternatives to consider?
- [> 200 public OME repos using Travis](https://github.com/search?q=org%3Aome+path%3A%60.travis.yml%60+archived%3Afalse+public%3Atrue&type=Repositories) - not including IDR
    - Burden of implementation (and maintenance) could be reduced by defining classes of workflows, turn them into templates and then applying them to all repos
        - build Java library with Gradle
            - for insight: we might have to review the strategy used to package app. javapackager has been removed from java 11 (oracle). Moving towards jpackage 
        - build Java library with  Maven
        - build Ansible role
          - I think we can make this easier with an action, I'll look into this (Simon)
          - Worth noting that we'll need to upgrade to Molecule 3 at some point
          - Seb: possible starting points - https://github.com/robertdebock/molecule-action and https://github.com/robertdebock/galaxy-action
        - build Docker image
        - build and test Python library with tox
        - build Sphinx documentation 
        - ...
    - Might require some audit
- Roll-out strategy:
    - can be started in the background as soon as the one vs multiple workflows is decided (e.g. https://github.com/ome/.github/pull/5)
    - use a single commit to master strategy to avoid noise
    - intermediate strategy might be to immediate migration to travis-ci.com while repositories are getting converted to GH actions


## Who's doing what

- https://github.com/ome/omero-plugins/ (Seb)
    - rOMERO-gateway, minimal-omero-client and supermodule left
- https://github.com/ome/ansible-roles (Simon)
- https://github.com/ome/omero-insight/ (J-M)
- https://github.com/ome/bioformats (J-M)
- https://github.com/ome/omero-python-superbuild (Seb)

