[ci] New optimized workflow for pull requests #5524
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the PR
The goal is
The jobs are:
./mvnw verify
with all code checks, etc. This is only run on linux. It reuses the already compiled artifacts from the first "compile" job.Since most jobs can be run in parallel and not sequentially, the results of the PR build should be available faster.
The concurrency control makes sure, that we cancel any in-progress jobs for the current pull request to avoid unnecessary builds. Only the latest build matters.
This new workflow "pull-requests.yml" now doesn't depend on the shell script in build-tools, so it is hopefully easier to maintain. The workflow only uses read permissions and doesn't require any extra secrets.
Right now, I reused Danger for running pmdtester. Midterm however, I'd like to migrate away from that, since it can't be used in a secure way: To upload the report to some hosting facility, we need a secret, but in the PR run, we don't have access to the secrets. Or in order to set the status of the pull request, we would need write access to the repo. That's why Danger says in the logs "Danger does not have write access to the PR to set a PR status."... Midterm, "pull-requests.yml" should only run pmdtester and create the report and maybe a status file with the messages and upload these as artifacts. Then it should trigger another workflow run that runs in the context of our repository and this one has write access and can then properly update the PR status. See https://stackoverflow.com/questions/69499645/how-to-securely-allow-github-actions-to-check-pr-and-post-results-in-comment/71366152#71366152 for more info on that topic.
These changes are out of scope for this PR however and can follow some time later.
If this pull-requests.yml workflow works, I'd like to rewrite the main build workflow in a similar way, so that we have the same benefits: faster feedback and better visibility which part of the build broke. The release workflow should also be separate.
Related issues
Ready?
./mvnw clean verify
passes (checked automatically by github actions)