#50 CI: use legacy oss link #197
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_and_test: | |
name: "Check if BlazingMQ Java SDK can build and pass unit tests with 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: "Check if BlazingMQ Java SDK pass integration tests with 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@v3 | |
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@v3 | |
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: Build and run integration tests with Maven | |
timeout-minutes: 120 | |
run: mvn --batch-mode -DskipUnitTests=true -Dspotbugs.skip=true -Dit.dockerImage=bmqbrkr:latest verify | |
- name: Compress collected broker logs | |
if: failure() | |
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() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: broker_logs | |
path: /tmp/bmq-broker/broker_logs.tar.gz | |
retention-days: 5 |