Skip to content

Leave only 1 IT test #14

Leave only 1 IT test

Leave only 1 IT test #14

Workflow file for this run

name: Tests
on:
push:
branches:
- '**'
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_and_test:
name: "Build & UTs: JDK ${{ matrix.Java }}"
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '17' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Build and run unit tests with Maven
run: mvn --batch-mode -Dspotbugs.skip=true test
integration_test:
name: "ITs: JDK ${{ matrix.Java }}"
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '17' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Checkout BlazingMQ
run: git clone https://github.com/bloomberg/blazingmq
- name: Get latest BlazingMQ commit SHA
id: get-sha
working-directory: blazingmq
run: echo "blazingmq_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get cached BlazingMQ docker image
id: cache-restore
uses: actions/cache/restore@v4
with:
path: blazingmq_image.tar.gz
key: ${{ steps.get-sha.outputs.blazingmq_sha }}
# Pull docker image instead
- name: Build base BlazingMQ docker image
if: steps.cache-restore.outputs.cache-hit != 'true'
working-directory: blazingmq
run: docker compose -f docker/single-node/docker-compose.yaml build
- name: Load base BlazingMQ docker image from cache
if: steps.cache-restore.outputs.cache-hit == 'true'
run: docker load < blazingmq_image.tar.gz
- name: Save built BlazingMQ docker image
if: steps.cache-restore.outputs.cache-hit != 'true'
run: docker save bmqbrkr:latest | gzip > blazingmq_image.tar.gz
- name: Cache built BlazingMQ docker image
id: cache-save
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: blazingmq_image.tar.gz
key: ${{ steps.get-sha.outputs.blazingmq_sha }}
- name: Build IT image
working-directory: bmq-sdk/src/test/docker
run: docker build --tag bmq-broker-java-it --build-arg "image=bmqbrkr:latest" .
- name: Setup Core Dumps config
run: |
sudo mkdir /tmp/cores
sudo chmod 777 /tmp/cores
echo "/tmp/cores/%e.%p.%s.%t" | sudo tee /proc/sys/kernel/core_pattern
- name: Build and run integration tests with Maven
timeout-minutes: 120
run: |
# Allow core dumps
ulimit -c unlimited
mvn --batch-mode -DskipUnitTests=true -Dspotbugs.skip=true -Dit.dockerImage=bmqbrkr:latest verify
- name: Upload broker core dump as artifacts
# if: failure()
if: always()
uses: actions/upload-artifact@v4
with:
name: core_dumps
path: /cores
retention-days: 5
- name: Compress collected broker logs
# if: failure()
if: always()
working-directory: /tmp/bmq-broker
run: tar -zcvf broker_logs.tar.gz /tmp/bmq-broker/bmq-broker-java-it*
- name: Upload broker logs as artifacts
# if: failure()
if: always()
uses: actions/upload-artifact@v3
with:
name: broker_logs_${{ matrix.java }}
path: /tmp/bmq-broker/broker_logs.tar.gz
retention-days: 5