From 8046d229c02723a358411e9f92039a42e5c64c95 Mon Sep 17 00:00:00 2001 From: ggivo Date: Tue, 18 Feb 2025 13:09:35 +0200 Subject: [PATCH 1/6] Switch required Integration to test workflow to containerised test env --- .github/workflows/integration.yml | 85 +++++++++++++++-- .github/workflows/test-on-docker.yml | 137 --------------------------- 2 files changed, 76 insertions(+), 146 deletions(-) delete mode 100644 .github/workflows/test-on-docker.yml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 977137e8ff..8f47e7cda8 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -18,12 +18,28 @@ on: schedule: - cron: '0 1 * * *' # nightly build workflow_dispatch: - + inputs: + specific_test: + description: 'Run specific test(s) (optional)' + required: false + default: '' jobs: build: name: Build and Test runs-on: ubuntu-latest + env: + REDIS_ENV_WORK_DIR: ${{ github.workspace }}/redis-env-work + REDIS_ENV_CONF_DIR: ${{ github.workspace }}/src/test/resources/env + CLIENT_LIBS_IMAGE_PREFIX: "redislabs/client-libs-test" + strategy: + fail-fast: false + matrix: + redis_version: + - "8.0-M04-pre" + - "7.4.1" + - "7.2.6" + # - "6.2.16" steps: - uses: actions/checkout@v4 - name: Set up publishing to maven central @@ -34,8 +50,8 @@ jobs: - name: System setup run: | sudo apt update - sudo apt install -y stunnel make - make system-setup + sudo apt install -y make + make compile-module - name: Cache dependencies uses: actions/cache@v4 with: @@ -43,21 +59,72 @@ jobs: ~/.m2/repository /var/cache/apt key: jedis-${{hashFiles('**/pom.xml')}} + # Set up Docker Compose environment + - name: Set up Docker Compose environment + run: | + mkdir -m 777 $REDIS_ENV_WORK_DIR + export REDIS_VERSION="${{ matrix.redis_version }}" + make start-test-env version=$REDIS_VERSION - name: Maven offline run: | mvn -q dependency:go-offline - name: Build docs run: | mvn javadoc:jar - - name: Run tests + # Run Tests + - name: Run Maven tests run: | - export TEST_ENV_PROVIDER=local - make test + export TEST_ENV_PROVIDER=docker + export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR + echo $TEST_WORK_FOLDER + if [ -z "$TESTS" ]; then + mvn clean compile test + else + mvn -Dtest=$TESTS clean compile test + fi env: - JVM_OPTS: -Xmx3200m - TERM: dumb + JVM_OPTS: "-XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof" + TESTS: ${{ github.event.inputs.specific_test || '' }} + - name: Upload Heap Dumps + if: failure() + uses: actions/upload-artifact@v4 + with: + name: heap-dumps-${{ matrix.redis_version }} + path: ${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof + retention-days: 5 + - name: Upload Surefire Dump File + uses: actions/upload-artifact@v4 + with: + name: surefire-dumpstream + path: target/surefire-reports/*.dumpstream + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: | + target/surefire-reports/**/*.xml + # Collect logs on failure + - name: Collect logs on failure + if: failure() # This runs only if the previous steps failed + run: | + echo "Collecting logs from $WORK_DIR..." + ls -la $REDIS_ENV_WORK_DIR + # Upload logs as artifacts + - name: Upload logs on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: redis-env-work-logs-${{ matrix.redis_version }} + path: ${{ env.REDIS_ENV_WORK_DIR }} + # Bring down the Docker Compose test environment + - name: Tear down Docker Compose environment + if: always() + run: | + docker compose $COMPOSE_ENV_FILES -f src/test/resources/env/docker-compose.yml down + continue-on-error: true + # Upload code coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test-on-docker.yml b/.github/workflows/test-on-docker.yml deleted file mode 100644 index e2a12e25be..0000000000 --- a/.github/workflows/test-on-docker.yml +++ /dev/null @@ -1,137 +0,0 @@ ---- - -name: Build and Test using containerized environment - -on: - push: - paths-ignore: - - 'docs/**' - - '**/*.md' - - '**/*.rst' - branches: - - master - - '[0-9].*' - pull_request: - branches: - - master - - '[0-9].*' - schedule: - - cron: '0 1 * * *' # nightly build - workflow_dispatch: - inputs: - specific_test: - description: 'Run specific test(s) (optional)' - required: false - default: '' -jobs: - - build: - name: Build and Test - runs-on: ubuntu-latest - env: - REDIS_ENV_WORK_DIR: ${{ github.workspace }}/redis-env-work - REDIS_ENV_CONF_DIR: ${{ github.workspace }}/src/test/resources/env - CLIENT_LIBS_IMAGE_PREFIX: "redislabs/client-libs-test" - strategy: - fail-fast: false - matrix: - redis_version: - - "8.0-M04-pre" - - "7.4.1" - - "7.2.6" - # - "6.2.16" - steps: - - uses: actions/checkout@v4 - - name: Set up publishing to maven central - uses: actions/setup-java@v4 - with: - java-version: '8' - distribution: 'temurin' - - name: System setup - run: | - sudo apt update - sudo apt install -y make - make compile-module - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: | - ~/.m2/repository - /var/cache/apt - key: jedis-${{hashFiles('**/pom.xml')}} - # Set up Docker Compose environment - - name: Set up Docker Compose environment - run: | - mkdir -m 777 $REDIS_ENV_WORK_DIR - export REDIS_VERSION="${{ matrix.redis_version }}" - make start-test-env version=$REDIS_VERSION - - name: Maven offline - run: | - mvn -q dependency:go-offline - - name: Build docs - run: | - mvn javadoc:jar - # Run Tests - - name: Run Maven tests - run: | - export TEST_ENV_PROVIDER=docker - export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR - echo $TEST_WORK_FOLDER - if [ -z "$TESTS" ]; then - mvn clean compile test - else - mvn -Dtest=$TESTS clean compile test - fi - env: - JVM_OPTS: "-XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof" - TESTS: ${{ github.event.inputs.specific_test || '' }} - - name: Upload Heap Dumps - if: failure() - uses: actions/upload-artifact@v4 - with: - name: heap-dumps-${{ matrix.redis_version }} - path: ${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof - retention-days: 5 - - name: Upload Surefire Dump File - uses: actions/upload-artifact@v4 - with: - name: surefire-dumpstream - path: target/surefire-reports/*.dumpstream - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - files: | - target/surefire-reports/**/*.xml - # Collect logs on failure - - name: Collect logs on failure - if: failure() # This runs only if the previous steps failed - run: | - echo "Collecting logs from $WORK_DIR..." - ls -la $REDIS_ENV_WORK_DIR - # Upload logs as artifacts - - name: Upload logs on failure - if: failure() - uses: actions/upload-artifact@v4 - with: - name: redis-env-work-logs-${{ matrix.redis_version }} - path: ${{ env.REDIS_ENV_WORK_DIR }} - # Bring down the Docker Compose test environment - - name: Tear down Docker Compose environment - if: always() - run: | - docker compose $COMPOSE_ENV_FILES -f src/test/resources/env/docker-compose.yml down - continue-on-error: true - # Upload code coverage - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - with: - fail_ci_if_error: false - token: ${{ secrets.CODECOV_TOKEN }} - - name: Upload test results to Codecov - if: ${{ github.event_name == 'schedule' || (github.event_name == 'push') || github.event_name == 'workflow_dispatch'}} - uses: codecov/test-results-action@v1 - with: - fail_ci_if_error: false - files: ./target/surefire-reports/TEST* - token: ${{ secrets.CODECOV_TOKEN }} From 5f495c77ec32b45f6140daf630f0dcdf48a9ab61 Mon Sep 17 00:00:00 2001 From: ggivo Date: Tue, 18 Feb 2025 15:44:45 +0200 Subject: [PATCH 2/6] Add build summary job to be marked as required --- .github/workflows/integration.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8f47e7cda8..dbffc6457f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -26,7 +26,7 @@ on: jobs: build: - name: Build and Test + name: Build and Test (Matrix) runs-on: ubuntu-latest env: REDIS_ENV_WORK_DIR: ${{ github.workspace }}/redis-env-work @@ -135,3 +135,11 @@ jobs: fail_ci_if_error: false files: ./target/surefire-reports/TEST* token: ${{ secrets.CODECOV_TOKEN }} +build-summary: + name: Build and Test + runs-on: ubuntu-latest + needs: build + if: always() + steps: + - name: Report build summary + run: echo "All build and test jobs have completed." \ No newline at end of file From 116b531f5cf2de8f9c431aad31b214e489354a89 Mon Sep 17 00:00:00 2001 From: ggivo Date: Tue, 18 Feb 2025 16:18:19 +0200 Subject: [PATCH 3/6] Add build summary job to be marked as required --- .github/workflows/integration.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index dbffc6457f..b0b3c9bbee 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -135,11 +135,11 @@ jobs: fail_ci_if_error: false files: ./target/surefire-reports/TEST* token: ${{ secrets.CODECOV_TOKEN }} -build-summary: - name: Build and Test - runs-on: ubuntu-latest - needs: build - if: always() - steps: - - name: Report build summary - run: echo "All build and test jobs have completed." \ No newline at end of file + build-summary: + name: Build and Test + runs-on: ubuntu-latest + needs: build + if: always() + steps: + - name: Report build summary + run: echo "All build and test jobs have completed." \ No newline at end of file From 5b1fa7cd0156c5bb10e6c97ced0eaa28d5eef069 Mon Sep 17 00:00:00 2001 From: ggivo Date: Tue, 18 Feb 2025 18:56:25 +0200 Subject: [PATCH 4/6] try to summarise build status --- .github/workflows/integration.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b0b3c9bbee..771f3831b4 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -77,11 +77,14 @@ jobs: export TEST_ENV_PROVIDER=docker export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR echo $TEST_WORK_FOLDER - if [ -z "$TESTS" ]; then - mvn clean compile test - else - mvn -Dtest=$TESTS clean compile test + if [[ "${{ matrix.redis_version }}" == "7.4.1" ]]; then + exit 1; fi + #if [ -z "$TESTS" ]; then + # mvn clean compile test + #else + # mvn -Dtest=$TESTS clean compile test + #fi env: JVM_OPTS: "-XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof" TESTS: ${{ github.event.inputs.specific_test || '' }} @@ -141,5 +144,7 @@ jobs: needs: build if: always() steps: + - uses: technote-space/workflow-conclusion-action@v2 - name: Report build summary - run: echo "All build and test jobs have completed." \ No newline at end of file + if: env.WORKFLOW_CONCLUSION == 'failure' + run: exit 1 \ No newline at end of file From 0e84e374abdaca138acbc60ae9176ec89f037a66 Mon Sep 17 00:00:00 2001 From: ggivo Date: Tue, 18 Feb 2025 19:00:12 +0200 Subject: [PATCH 5/6] try to summarise build status --- .github/workflows/integration.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 771f3831b4..70f0e76d9f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -77,9 +77,6 @@ jobs: export TEST_ENV_PROVIDER=docker export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR echo $TEST_WORK_FOLDER - if [[ "${{ matrix.redis_version }}" == "7.4.1" ]]; then - exit 1; - fi #if [ -z "$TESTS" ]; then # mvn clean compile test #else From f908b630e45412a486564863d25cab590f6a65dd Mon Sep 17 00:00:00 2001 From: ggivo Date: Tue, 18 Feb 2025 19:05:01 +0200 Subject: [PATCH 6/6] try to summarise build status --- .github/workflows/integration.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 70f0e76d9f..2ed445b3d6 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -77,11 +77,11 @@ jobs: export TEST_ENV_PROVIDER=docker export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR echo $TEST_WORK_FOLDER - #if [ -z "$TESTS" ]; then - # mvn clean compile test - #else - # mvn -Dtest=$TESTS clean compile test - #fi + if [ -z "$TESTS" ]; then + mvn clean compile test + else + mvn -Dtest=$TESTS clean compile test + fi env: JVM_OPTS: "-XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof" TESTS: ${{ github.event.inputs.specific_test || '' }}