Skip to content

GEOMESA-3396 CI - Split up unit tests into different workflows #1690

GEOMESA-3396 CI - Split up unit tests into different workflows

GEOMESA-3396 CI - Split up unit tests into different workflows #1690

name: build-and-test-2.12
on:
push:
pull_request:
permissions: # added using https://github.com/step-security/secure-repo
contents: read
env:
MAVEN_CLI_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dlicense.skip=true --batch-mode
MAVEN_TEST_OPTS: -Dtest.fork.count=1
jobs:
build-scala:
runs-on: ubuntu-latest
# avoid duplicate jobs on PRs from the main repo
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Build with Maven
run: ./build/mvn clean install $MAVEN_CLI_OPTS -DskipTests -T4
- name: Collect artifacts
run: |
mv ~/.m2/repository/org/locationtech/geomesa m2-geomesa
tar -czf classes.tgz $(find . -path '*/target/classes' -o -path '*/target/test-classes' -type d | tr '\n' ' ')
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: classes-and-jars
path: |
m2-geomesa
classes.tgz
- name: Remove geomesa artifacts
if: success() || failure()
run: rm -rf ~/.m2/repository/org/locationtech/geomesa
accumulo-unit-tests:
needs: build-scala
runs-on: ubuntu-latest
# avoid duplicate jobs on PRs from the main repo
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: classes-and-jars
- name: Unit tests
id: test
continue-on-error: true
run: |
set -o pipefail
mvn surefire:test $MAVEN_CLI_OPTS $MAVEN_TEST_OPTS -f geomesa-accumulo | tee -a test.log
- name: Unit tests (retry)
id: test-retry
if: steps.test.outcome=='failure'
continue-on-error: true
run: |
set -o pipefail
RESUME_FROM="$(grep --text 'mvn <args> -rf ' test.log | tail -n1 | sed 's/.*-rf/-rf/')"
mvn surefire:test $MAVEN_CLI_OPTS $MAVEN_TEST_OPTS $RESUME_FROM -f geomesa-accumulo | tee -a test.log
- name: Unit tests (retry)
id: test-retry-retry
if: steps.test-retry.outcome=='failure'
run: |
set -o pipefail
RESUME_FROM="$(grep --text 'mvn <args> -rf ' test.log | tail -n1 | sed 's/.*-rf/-rf/')"
mvn surefire:test $MAVEN_CLI_OPTS $MAVEN_TEST_OPTS $RESUME_FROM -f geomesa-accumulo | tee -a test.log
- name: Remove geomesa artifacts
if: success() || failure()
run: rm -rf ~/.m2/repository/org/locationtech/geomesa
kafka-unit-tests:
needs: build-scala
runs-on: ubuntu-latest
# avoid duplicate jobs on PRs from the main repo
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: classes-and-jars
- name: Unit tests
id: test
continue-on-error: true
run: |
set -o pipefail
mvn surefire:test $MAVEN_CLI_OPTS $MAVEN_TEST_OPTS -f geomesa-kafka | tee -a test.log
- name: Unit tests (retry)
id: test-retry
if: steps.test.outcome=='failure'
continue-on-error: true
run: |
set -o pipefail
RESUME_FROM="$(grep --text 'mvn <args> -rf ' test.log | tail -n1 | sed 's/.*-rf/-rf/')"
mvn surefire:test $MAVEN_CLI_OPTS $MAVEN_TEST_OPTS $RESUME_FROM -f geomesa-kafka | tee -a test.log
- name: Unit tests (retry)
id: test-retry-retry
if: steps.test-retry.outcome=='failure'
run: |
set -o pipefail
RESUME_FROM="$(grep --text 'mvn <args> -rf ' test.log | tail -n1 | sed 's/.*-rf/-rf/')"
mvn surefire:test $MAVEN_CLI_OPTS $MAVEN_TEST_OPTS $RESUME_FROM -f geomesa-kafka | tee -a test.log
- name: Remove geomesa artifacts
if: success() || failure()
run: rm -rf ~/.m2/repository/org/locationtech/geomesa