-
Notifications
You must be signed in to change notification settings - Fork 2
Split integration tests into patch and validate phases
#2318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+377
−185
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
719308c
Split integration tests into `patch` and `validate` phases
Stephan202 39ee4ef
TEMPORARY: run the integration tests on this branch
Stephan202 c162638
Revert "TEMPORARY: run the integration tests on this branch"
Stephan202 1feff53
Clarify integration test replay failures and `-T1C` caveat
Stephan202 d2d5698
Drop comment that will go stale
Stephan202 c8dd84e
Drop redundant comment
Stephan202 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,12 +97,12 @@ jobs: | |
| }); | ||
|
|
||
| core.setOutput('commentId', response.data.id); | ||
| test: | ||
| name: Integration test | ||
| # On push events the `acknowledge` job is skipped; `always()` ensures this | ||
| # job still runs in that case. | ||
| patch: | ||
| name: Apply patches | ||
| # On push events the `acknowledge` job is skipped; `!cancelled()` ensures | ||
| # this job still runs in that case. | ||
| needs: [ matrix, acknowledge ] | ||
| if: ${{ always() && needs.matrix.result == 'success' }} | ||
| if: ${{ !cancelled() && needs.matrix.result == 'success' }} | ||
| runs-on: ubuntu-24.04 | ||
| strategy: | ||
| fail-fast: false | ||
|
|
@@ -112,27 +112,82 @@ jobs: | |
| - name: Install Harden-Runner | ||
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | ||
| with: | ||
| # We can't use `disable-sudo-and-containers` here, as some | ||
| # integration test projects have unit tests that start Docker | ||
| # containers. | ||
| disable-sudo: true | ||
| # XXX: After updating the validation build flags in | ||
| # `integration-tests/prometheus-java-client.sh`, review whether the | ||
| # Docker domains specified here can be dropped. | ||
| disable-sudo-and-containers: true | ||
| allowed-endpoints: > | ||
| api.adoptium.net:443 | ||
| api.github.com:443 | ||
| github.com:443 | ||
| hosted-compute-watchdog-prod-*.githubapp.com:443 | ||
| objects.githubusercontent.com:443 | ||
| oss.sonatype.org:443 | ||
| release-assets.githubusercontent.com:443 | ||
| repo.maven.apache.org:443 | ||
| results-receiver.actions.githubusercontent.com:443 | ||
| - name: Check out code and set up JDK and Maven | ||
| uses: s4u/setup-maven-action@ba34de01b7f4ba2ab8e2860df8993a29f4477056 # v1.20.0 | ||
| with: | ||
| checkout-ref: ${{ env.CHECKOUT_REF }} | ||
| java-version: | | ||
| 21.0.12 | ||
| 25.0.4 | ||
| java-distribution: temurin | ||
| maven-version: 3.9.16 | ||
| - name: Install project to local Maven repository | ||
| run: mvn install -DskipTests -Dverification.skip | ||
| - name: Apply patches | ||
| run: | | ||
| "./integration-tests/${INTEGRATION_TEST}.sh" --phase=patch "${{ runner.temp }}/artifacts" | ||
| env: | ||
| INTEGRATION_TEST: ${{ matrix.integration-test }} | ||
| JAVA_HOME: ${{ env.JAVA_HOME_21_X64 }} | ||
| # The `validate` job replays the changes recorded here, so these | ||
| # artifacts are uploaded even if this job reported unexpected changes; in | ||
| # that case they are also the primary evidence of what went wrong. | ||
| - name: Upload patch phase artifacts | ||
| if: ${{ !cancelled() }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: "integration-test-patch-${{ matrix.integration-test }}" | ||
| path: "${{ runner.temp }}/artifacts" | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
| - name: Remove installed project artifacts | ||
| run: mvn dependency:purge-local-repository -DmanualInclude='${project.groupId}' -DresolutionFuzziness=groupId | ||
| validate: | ||
| name: Validate patched code | ||
| # Runs even if the `patch` job reported unexpected changes, so that the | ||
| # validation build's result is observed in the same run. | ||
| needs: [ matrix, patch ] | ||
| if: ${{ !cancelled() && needs.matrix.result == 'success' }} | ||
| runs-on: ubuntu-24.04 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| integration-test: ${{ fromJson(needs.matrix.outputs.matrix) }} | ||
| steps: | ||
| - name: Install Harden-Runner | ||
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | ||
| with: | ||
| disable-sudo-and-containers: true | ||
| allowed-endpoints: > | ||
| api.adoptium.net:443 | ||
| auth.docker.io:443 | ||
| api.github.com:443 | ||
| checkstyle.org:443 | ||
| github.com:443 | ||
| hosted-compute-watchdog-prod-*.githubapp.com:443 | ||
| objects.githubusercontent.com:443 | ||
| oss.sonatype.org:443 | ||
| production.cloudflare.docker.com:443 | ||
| raw.githubusercontent.com:443 | ||
| registry-1.docker.io:443 | ||
| release-assets.githubusercontent.com:443 | ||
| repo.maven.apache.org:443 | ||
| repository.sonatype.org:443 | ||
| results-receiver.actions.githubusercontent.com:443 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| # Download the `patch` job's output before the more expensive setup | ||
| # steps, so that a missing artifact is reported within seconds. | ||
| - name: Download patch phase artifacts | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: "integration-test-patch-${{ matrix.integration-test }}" | ||
| path: "${{ runner.temp }}/artifacts" | ||
| - name: Check out code and set up JDK and Maven | ||
| uses: s4u/setup-maven-action@ba34de01b7f4ba2ab8e2860df8993a29f4477056 # v1.20.0 | ||
| with: | ||
|
|
@@ -144,22 +199,23 @@ jobs: | |
| maven-version: 3.9.16 | ||
| - name: Install project to local Maven repository | ||
| run: mvn install -DskipTests -Dverification.skip | ||
| - name: Run integration test | ||
| run: xvfb-run "./integration-tests/${INTEGRATION_TEST}.sh" "${{ runner.temp }}/artifacts" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - name: Validate patched code | ||
| run: | | ||
| "./integration-tests/${INTEGRATION_TEST}.sh" --phase=validate "${{ runner.temp }}/artifacts" | ||
| env: | ||
| INTEGRATION_TEST: ${{ matrix.integration-test }} | ||
| JAVA_HOME: ${{ env.JAVA_HOME_21_X64 }} | ||
| - name: Upload artifacts on failure | ||
| if: ${{ failure() }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: "integration-test-${{ matrix.integration-test }}" | ||
| name: "integration-test-validate-${{ matrix.integration-test }}" | ||
| path: "${{ runner.temp }}/artifacts" | ||
| - name: Remove installed project artifacts | ||
| run: mvn dependency:purge-local-repository -DmanualInclude='${project.groupId}' -DresolutionFuzziness=groupId | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| report: | ||
| name: Report integration test result | ||
| needs: [ acknowledge, test ] | ||
| needs: [ acknowledge, patch, validate ] | ||
| # Using `always()` ensures that this job runs even if previous jobs failed | ||
| # or were cancelled. | ||
| if: ${{ always() && github.event.issue.pull_request && needs.acknowledge.outputs.comment_id }} | ||
|
|
@@ -177,11 +233,13 @@ jobs: | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| env: | ||
| COMMENT_ID: ${{ needs.acknowledge.outputs.comment_id }} | ||
| CONCLUSION: ${{ needs.test.result }} | ||
| CONCLUSION: ${{ (needs.patch.result == 'success' && needs.validate.result) || needs.patch.result }} | ||
| with: | ||
| script: | | ||
| const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`; | ||
| const conclusion = process.env.CONCLUSION; | ||
| // A phase that has not started by the time the workflow is | ||
| // cancelled is reported as skipped rather than cancelled. | ||
| const conclusion = process.env.CONCLUSION === 'skipped' ? 'cancelled' : process.env.CONCLUSION; | ||
|
|
||
| let [statusEmoji, message] = (() => { | ||
| switch (conclusion) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current versions we're building against, Docker isn't necessary anymore for
mvn clean package. This would change if we ranmvn clean verify, but as that again lengthens the build, let's not do that for now.