I created a GHA workflow for community.docker that builds the collection and runs Galaxy importer on it: https://github.com/ansible-collections/community.docker/pull/754
It’s inspired from an earlier version I’ve been using in some of my collections which was more rudimentary (you had to specify the collection’s name, instead of extracting it from galaxy.yml, and it didn’t install collection requirements, so you had to modify to workflow to install them if you had any).
Instead of copying it over to other collections (which I currently did), I think it would be better to have this as a shared workflow somewhere that can be simply reused. For collection documentation building on GHA we have a repository with workflows: GitHub - ansible-community/github-docs-build: GitHub actions and workflows for building Ansible collection documentation. (discussion for that: Documentation build process · Issue #59 · ansible-community/community-topics · GitHub).
Do you also think this makes sense to have this as a shared workflow? And if yes, do you think there should be a specific repository for this shared workflow, or should we have a more generic repository which could have this as a shared workflow, and also some other collection CI related workflows?
@gotmax23 suggested in the community meeting to bettre use composite actions, and have one action per repository. I’m tending to that now as well, and will also add a shared workflow to the repo to make re-use even easier (if you don’t have special needs).
In fact my workflow should be two distinct actions, building collections and importing them, so I’ll end up with two repos.
The action repositories:
Both contain a shared workflow (see
.github/workflows/) that makes reuse easier in certain scenarios.
Use shared workflow for Galaxy import test by felixfontein · Pull Request #95 · ansible-collections/community.hrobot · GitHub shows how to use the shared workflow of
github-action-test-galaxy-import (which uses the shared workflow of
github-action-build-collection to build the collection). One workflow run can be seen here: Use shared workflow for Galaxy import test · ansible-collections/community.hrobot@b7c5c1d · GitHub
The workflow in the collection is pretty simple due to reusing a shared workflow (I stripped some boilderplate):
# Run CI against all pushes (direct commits, also merged PRs) to main, and all Pull Requests
name: Test to import built collection artifact with Galaxy importer