Skip to content
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

Migrate ‘Build and Test’ Job to Containerized Test Environment with Redis Version Matrix #4093

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 87 additions & 10 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
name: Build and Test (Matrix)
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
Expand All @@ -34,30 +50,81 @@ 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:
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
- 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 }}
Expand All @@ -68,3 +135,13 @@ 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:
- uses: technote-space/workflow-conclusion-action@v2
- name: Report build summary
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1
137 changes: 0 additions & 137 deletions .github/workflows/test-on-docker.yml

This file was deleted.

Loading