Skip to content

Test

Test #1

name: Test
on:
workflow_run:
workflows: [Build]
types: [completed]
permissions:
contents: read
packages: read
# Needed to write commit status
statuses: write
concurrency:
# Cancel jobs same head_branch same repo, works
# both for pull_request and push
group: >
${{ github.workflow }}-${{ github.event.workflow_run.head_repository.full_name }}-
${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
get-info:
if: github.event.workflow_run.conclusion == 'success'
name: Get Origin Workflow Info
runs-on: ubuntu-latest
outputs:
source-head-sha: ${{ github.event.workflow_run.head_sha }}
pull-request-number: ${{ steps.workflow-run-info.outputs.pull-request-number }}
source-head-branch: ${{ steps.workflow-run-info.outputs.source-head-branch }}
source-event: ${{ github.event.workflow_run.event }}
steps:
- uses: actions/checkout@v4
- id: workflow-run-info
uses: ./.github/actions/get-origin-info
with:
head-sha: ${{ github.event.workflow_run.head_sha }}
head-branch: ${{ github.event.workflow_run.head_branch }}
event: ${{ github.event.workflow_run.event }}
ci-build-test-pr:
needs: get-info
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Maven Test
runs-on: ubuntu-latest
env:
MAVEN_OPTS: "-Xmx1500m -XX:+HeapDumpOnOutOfMemoryError"
GH_TOKEN: ${{ github.token }}
steps:
- name: set-commit-status-pending
uses: myrotvorets/[email protected]
with:
context: Test mvn verify
status: pending
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/checkout@v4
- name: Setup Java
uses: ./.github/actions/setup-java
- uses: graalvm/setup-graalvm@v1
with:
java-version: 21
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Maven Artifacts
uses: ./.github/actions/extract-maven-artifacts
with:
run-id: ${{ github.event.workflow_run.id }}
- name: Download Infinispan Server
id: dis
uses: ./.github/actions/download-infinispan
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Extract Infinispan Source
run: |
mkdir test_dir && cd test_dir
unzip ${GITHUB_WORKSPACE}/infinispan-${{ steps.dis.outputs.server-version }}-src.zip
mv infinispan-${{ steps.dis.outputs.server-version }}-src infinispan
- name: Maven Test
id: maven-test
shell: bash
run: >
cd test_dir/infinispan &&
./mvnw verify -V -B -e -DrerunFailingTestsCount=2
-Dmaven.test.failure.ignore=true -Dansi.strip=true -Pnative
- name: set-commit-status-conclusion
if: success()
uses: myrotvorets/[email protected]
with:
context: Test mvn verify
status: success
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: set-commit-status-conclusion
if: always() && failure()
uses: myrotvorets/[email protected]
with:
context: Test mvn verify
status: failure
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Archive commit sha PR
if: >
(success() || failure()) &&
needs.get-info.outputs.source-event == 'pull_request'
run: |
echo -n ${{ needs.get-info.outputs.source-head-sha }} > github-sha.txt
- name: Archive commit sha push
if: >
(success() || failure()) &&
needs.get-info.outputs.source-event == 'push'
run: |
echo -n ${{ needs.get-info.outputs.source-head-sha }} > github-sha.txt
- name: Archive surefire test report
if: (success() || failure())
uses: actions/upload-artifact@v4
with:
name: surefire-test-report
path: |
test_dir/infinispan/**/surefire-reports/TEST-*.xml
test_dir/infinispan/**/*.dump*
test_dir/infinispan/**/hs_err_*
github-sha.txt
!test_dir/infinispan/**/*-reports*/**/TEST-*FLAKY.xml
!test_dir/infinispan/**/*-reports*/TEST-*RocksDB*.xml
# Create artifact with branch name and surefile flaky test report
- name: Check flaky report existence
if: success() || failure()
id: check_flaky_report
uses: andstor/file-existence-action@v3
with:
files: "test_dir/infinispan/**/target/*-reports*/**/TEST-*FLAKY.xml"
- name: Archive base_ref
if: (success() || failure()) && steps.check_flaky_report.outputs.files_exists == 'true'
env:
TARGET_BRANCH: ${{ needs.get-info.outputs.source-head-sha }}
EVENT_NAME: ${{ needs.get-info.outputs.source-event }}
PR_NUMBER: ${{ needs.get-info.outputs.pull-request-number }}
EVENT_NUMBER: ${{ github.event.workflow_run.id }}
run: |
echo -n $TARGET_BRANCH > target-branch.txt
echo -n $EVENT_NAME > event-name.txt
echo -n $EVENT_NUMBER > event-number.txt
echo -n $PR_NUMBER > pr-number.txt
- name: Archive flaky test report
if: (success() || failure()) && steps.check_flaky_report.outputs.files_exists == 'true'
uses: actions/upload-artifact@v4
with:
name: flaky-test-report
path: |
test_dir/infinispan/**/target/*-reports*/**/TEST-*FLAKY.xml
target-branch.txt
event-name.txt
event-number.txt
pr-number.txt
db:
needs: get-info
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dbs:
- mssql
- oracle
steps:
- name: set-commit-status-pending
uses: myrotvorets/[email protected]
with:
context: Test DB ${{ matrix.dbs }}
status: pending
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/checkout@v4
- name: Setup Java
uses: ./.github/actions/setup-java
- name: Extract Maven Artifacts
uses: ./.github/actions/extract-maven-artifacts
with:
run-id: ${{ github.event.workflow_run.id }}
- name: Download Infinispan Server
id: dis
uses: ./.github/actions/download-infinispan
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Extract Infinispan Server
run: |
cd /tmp
unzip ${GITHUB_WORKSPACE}/infinispan-server-${{ steps.dis.outputs.server-version }}.zip
- name: Extract Infinispan Source
run: |
mkdir test_dir && cd test_dir
unzip ${GITHUB_WORKSPACE}/infinispan-${{ steps.dis.outputs.server-version }}-src.zip
mv infinispan-${{ steps.dis.outputs.server-version }}-src infinispan
- name: Test
run: |
cd test_dir/infinispan &&
./mvnw verify -B -e -pl server/tests -Dmaven.test.failure.ignore=true \
-Dansi.strip=true \
-DdefaultTestGroup=database \
-Dorg.infinispan.test.database.types=${{ matrix.dbs }} \
-Dorg.infinispan.test.server.dir=/tmp/infinispan-server-${{ steps.dis.outputs.server-version }}
- name: Archive surefire test report
if: (success() || failure())
uses: actions/upload-artifact@v4
with:
name: surefire-test-report-${{ matrix.dbs }}
path: |
test_dir/infinispan/**/failsafe-reports/TEST-*.xml
test_dir/infinispan/**/*.dump*
test_dir/infinispan/**/hs_err_*
test_dir/infinispan/**/failsafe-summary.xml
github-sha.txt
!test_dir/infinispan/**/target/*-reports*/**/TEST-*FLAKY.xml
- name: set-commit-status-conclusion
if: success()
uses: myrotvorets/[email protected]
with:
context: Test DB ${{ matrix.dbs }}
status: success
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: set-commit-status-conclusion
if: always() && failure()
uses: myrotvorets/[email protected]
with:
context: Test DB ${{ matrix.dbs }}
status: failure
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}