Skip to content

[ci] Improve GH Actions scripts #2967

@adangel

Description

@adangel

This affects at least the following repos: pmd, pmd-designer, build-tools, pmd-regression-tester, pmd-eclipse-plugin
I migrated them in the last month from travis to gh actions and you can see some evolution over the time...
The goal is, that we have a common way for our build/deploy/release scripts, that are shared and reused by all our repos.
Additionally, I don't want to create the next vendor lock-in, so the scripts should be able to be used without github actions as well.

For sharing the scripts, I have something in mind, which I did for the pmd-eclipse-plugin: See function "fetch_ci_scripts" in https://github.com/pmd/pmd-eclipse-plugin/blob/master/.ci/build.sh
The scripts are downloaded from build-tools repo and then executed. We could even version the scripts by downloading the scripts using a specific tag. Alternatively instead of downloading, we could also use git submodules.

Sharing the scripts would allow us to automate the release for pmd-regression-tester as well (currently, the releases need to be created manually on github).

Integration with GH Actions should look always similar: one main build.yaml which calls our own build.sh. All workflows should also work on forked repos without breaking (they might do less, e.g. only build but not deploy)

Suggested task list:

  • Generalize and move all scripts to build-tools. There are a lot more script in pmd repo, that should be moved.
  • Use the same approach for sharing secrets. The (gpg) encrypted environment variables could be stored in build-tools as well, also the other secrets like ssh-key and gpg release signing key. For the encrypted files, "gpg --armor" would look nicer than the binary files.
  • There are still some references to travis, e.g. in the PR template
  • synchronization to sourceforge could be done in a separate job. This job would do the following:
    • ✔️ git repo sync -> from github to sourceforge, on push.
    • ❌ releases sync -> from pmd-code.org to sourceforge, on releases
    • ❌ baseline sync -> from pmd-code.org to sourceforge, on push
    • ❌ doc archive sync -> from pmd-code.org to sourceforge, on releases
    • ❌ snapshot doc sync? on push
    • These could be done later if needed
  • Have a correct and similar build badge on each repo (e.g. currently pmd repo uses the name "Pushes", which should be changed to "Build")
  • Log output should be reduced (e.g. while running maven_dependencies), see also [ci] Cleanup github action logs #3067 - obsolete, since maven_dependencies is not needed anymore
  • Maybe remove travis_wait script. This is probably not needed anymore.
  • Make sure, the we support forked workflows: https://github.community/t/stop-github-actions-running-on-a-fork/17965/2
    "if: github.owner == pmd" or "github.repository_owner == 'pmd'"
  • move the docker config to build-tools
    • this is basically the environment for testing the scripts and could be used to run the scripts somewhere else (e.g. not on github, if needed)
    • set the correct locale, e.g. en_US.UTF-8, see http://jaredmarkell.com/docker-and-locales/
  • And most important: create a documentation, that describes the solution
    • BUILDING.md, do-release.sh devdocs/development.md, releasing.md
    • describe the needed environment variables, see also below. Preliminary doc is at: https://github.com/pmd/build-tools#private-envasc
    • describe how to test the scripts or run them locally using docker
    • describe integration of danger
  • Figure out, whether we need the jobs for sonar and coveralls (both might have a different github integration anyway)

Metadata

Metadata

Assignees

Labels

an:enhancementAn improvement on existing features / rulesgithub_actionsPull requests that update Github_actions codein:documentationAffects the documentation [doc]in:pmd-internalsAffects PMD's internals

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions