Skip to content

enabling tests of common modules for java connectors #1518

enabling tests of common modules for java connectors

enabling tests of common modules for java connectors #1518

Workflow file for this run

name: CI
on:
pull_request:
workflow_call:
inputs:
version:
required: true
type: string
outputs:
modules:
description: "Stream reactor collection of modules"
value: ${{ jobs.initiate.outputs.matrix }}
dep_check_modules:
description: "Modules for dependency checking"
value: ${{ jobs.initiate.outputs.dep_check_matrix }}
jobs:
initiate:
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.read-mods.outputs.matrix }}
it_matrix: ${{ steps.read-mods.outputs.it-matrix }}
fun_matrix: ${{ steps.read-mods.outputs.fun-matrix }}
dep_check_matrix: ${{ steps.read-mods.outputs.dep-check-matrix }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Generate modules lists
run: sbt generateModulesList generateItModulesList generateFunModulesList generateDepCheckModulesList
env:
JVM_OPTS: -Xmx3200m
- name: Read modules lists
id: read-mods
run: |
echo "matrix=$(cat ./target/scala-2.13/resource_managed/main/modules.txt)" >> $GITHUB_OUTPUT
echo "it-matrix=$(cat ./target/scala-2.13/resource_managed/main/it-modules.txt)" >> $GITHUB_OUTPUT
echo "fun-matrix=$(cat ./target/scala-2.13/resource_managed/main/fun-modules.txt)" >> $GITHUB_OUTPUT
echo "dep-check-matrix=$(cat ./target/scala-2.13/resource_managed/main/depcheck-modules.txt)" >> $GITHUB_OUTPUT
- name: Cleanup before cache
shell: bash
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
scalafmt:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Check the project
run: sbt scalafmtCheck
env:
JVM_OPTS: -Xmx3200m
- name: Check the sbt files
run: sbt scalafmtSbtCheck
env:
JVM_OPTS: -Xmx3200m
test:
needs:
- initiate
- scalafmt
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Run tests
run: sbt "project ${{ matrix.module }}" test
env:
JVM_OPTS: -Xmx3200m
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/target/**/test-reports/*.xml"
check_name: ${{ matrix.module }}-test-results
comment_mode: off
integration-test:
needs:
- initiate
- scalafmt
timeout-minutes: 30
continue-on-error: true
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.it_matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Run tests
run: sbt "project ${{ matrix.module }}" it:test
env:
JVM_OPTS: -Xmx3200m
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/target/**/it-reports/*.xml"
check_name: ${{ matrix.module }}-it-results
comment_mode: off
build-and-cache-assembly:
needs:
- initiate
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Get version
id: version
shell: bash
run: |
if [ "${{ inputs.version }}" != "" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
fi
- name: Build assembly
env:
JVM_OPTS: -Xmx3200m
VERSION: ${{ steps.version.outputs.version }}
run: sbt "project ${{ matrix.module }};set assembly / test := {}" assembly
- name: Cache assembly
uses: actions/cache/save@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
functional-test:
needs:
- initiate
- build-and-cache-assembly
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.fun_matrix)}}
connectImageVersion: [7.3.1, 6.2.2]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Restore assembly
uses: actions/cache/restore@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
fail-on-cache-miss: true
- name: Run tests
run: sbt "project ${{ matrix.module }}" fun:test
env:
JVM_OPTS: -Xmx3200m
CONNECT_IMAGE_VERSION: ${{matrix.connectImageVersion}}
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/target/**/test-reports/*.xml"
check_name: ${{ matrix.module }}-${{ matrix.connectImageVersion }}-fun-results
comment_mode: off
dependency-check:
needs:
- initiate
- build-and-cache-assembly
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.dep_check_matrix)}}
steps:
- name: Restore assembly
uses: actions/cache/restore@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
fail-on-cache-miss: true
- name: Get branch names.
id: branch_name
uses: tj-actions/branch-names@v8
- name: Dependency Check
uses: dependency-check/Dependency-Check_Action@main
with:
project: kafka-connect-${{matrix.module}}-deps
path: kafka-connect-${{matrix.module}}/target/libs/
format: 'HTML'
args: >-
--failOnCVSS 5
--suppression https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.owner.login || github.event.repository.owner.login }}/${{ github.event.repository.name }}/${{ steps.branch_name.outputs.tag }}${{ steps.branch_name.outputs.current_branch }}/suppression.xml
- name: Upload Test results
uses: actions/upload-artifact@master
with:
name: ${{matrix.module}}-depcheck-results
path: ${{github.workspace}}/reports
upload-assembly:
needs:
- initiate
- functional-test
- dependency-check
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Restore assembly
uses: actions/cache/restore@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
fail-on-cache-miss: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: assembly-${{ matrix.module }}-${{ github.run_id }}
path: ~/**/target/libs/*.jar