Skip to content

DP-1710 | Introduce timeout for EmsSinkTask#put (#48) #22

DP-1710 | Introduce timeout for EmsSinkTask#put (#48)

DP-1710 | Introduce timeout for EmsSinkTask#put (#48) #22

Workflow file for this run

name: Build/Scan Release Tag
on:
push:
tags:
- "*"
workflow_dispatch:
env:
CONNECTOR_FOLDER: 'celonis-kafka-connect-ems'
jobs:
prepare_env:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract BRANCH_OR_TAG, RELEASE_MODE and DRAFT_RELEASE,output to GITHUB_ENV
shell: bash
run: |
if [[ ${GITHUB_REF##*/} == "merge" ]];
then
output="PR$(echo "${GITHUB_REF}" | cut -d '/' -f3 )"
else
output=${GITHUB_REF##*/}
fi
echo "BRANCH_OR_TAG=${output}" >> $GITHUB_ENV
if [[ ${output} =~ ^v[0-9]\.[0-9]\.[0-9]$ ]];
then
echo "RELEASE_MODE=true" >> $GITHUB_ENV
echo "DRAFT_RELEASE=false" >> $GITHUB_ENV
echo "VERSION=${output:1}" >> $GITHUB_ENV
elif [[ ${output} =~ ^v[0-9]\.[0-9]\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?(\+[A-Za-z0-9.]+)?$ ]];
then
echo "RELEASE_MODE=true" >> $GITHUB_ENV
echo "DRAFT_RELEASE=true" >> $GITHUB_ENV
echo "VERSION=${output:1}" >> $GITHUB_ENV
else
echo "RELEASE_MODE=false" >> $GITHUB_ENV
echo "DRAFT_RELEASE=false" >> $GITHUB_ENV
tag_sha=$(git describe --tags --always --match='v[0-9]*')
echo "VERSION=$tag_sha" >> $GITHUB_ENV
fi
outputs:
version: ${{ env.VERSION }}
branch_or_tag: ${{ env.BRANCH_OR_TAG }}
release_mode: ${{ env.RELEASE_MODE }}
draft_release: ${{ env.DRAFT_RELEASE }}
scalafmt:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Check the project
run: sbt scalafmtCheck
env:
JVM_OPTS: -Xmx3200m
- name: Check the sbt files
run: sbt scalafmtSbtCheck
env:
JVM_OPTS: -Xmx3200m
licenses_report:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Create NOTICE File
run: |
cat <<EOT >> NOTICE
Copyright (c) $(date +%Y), Celonis SE.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Licenses for third-party software included in this release.
EOT
- name: Generate License Report
run: |
sbt dumpLicenseReport
cat target/license-reports/kafka-ems-connector-licenses.csv >> NOTICE
test:
runs-on: ubuntu-latest
needs:
- prepare_env
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
key: sbt-cache-${{ hashFiles('*.sbt') }}-${{ hashFiles('project/**') }}
- name: Run tests
run: |
sbt test
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: "**/target/**/test-reports/*.xml"
check_name: connector-test-results
comment_mode: off
integration_test:
runs-on: ubuntu-latest
needs:
- prepare_env
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
key: sbt-cache-${{ hashFiles('*.sbt') }}-${{ hashFiles('project/**') }}
- name: Run tests
run: |
sbt it:test
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: "**/target/**/it-reports/*.xml"
check_name: connector-it-results
comment_mode: off
build_and_cache_assembly:
runs-on: ubuntu-latest
needs:
- prepare_env
- test
- scalafmt
- integration_test
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
key: sbt-cache-${{ hashFiles('*.sbt') }}-${{ hashFiles('project/**') }}
- uses: actions/cache@v3
with:
path: |
~/**/target/**/*.jar
~/**/target/manifest.json
key: assembly-cache-${{ github.run_id }}
- name: Print Software Versions / Environment Variables
run: |
uname -a
git --version
java -version
sbt --version
printenv
- name: Build assembly
env:
JVM_OPTS: -Xmx3200m
VERSION: ${{ needs.prepare_env.outputs.version }}
run: |
rm -rf target/ project/project/ project/target/
pwd
sbt generateManifest
sbt "project connector;set assembly / test := {}" assembly
java -jar connector/target/scala-2.13/*.jar $VERSION
# Debug logs
echo "Files for 2.13"
ls -lsa connector/target/scala-2.13
e2e_test:
runs-on: ubuntu-latest
needs:
- build_and_cache_assembly
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
key: sbt-cache-${{ hashFiles('*.sbt') }}-${{ hashFiles('project/**') }}
- uses: actions/cache@v3
with:
path: |
~/**/target/**/*.jar
~/**/target/manifest.json
key: assembly-cache-${{ github.run_id }}
- name: Run tests
run: |
sbt e2e:test
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: "**/target/**/test-reports/*.xml"
check_name: connector-e2e-results
comment_mode: off
package:
runs-on: ubuntu-latest
needs:
- prepare_env
- e2e_test
env:
BRANCH_OR_TAG: '${{ needs.prepare_env.outputs.branch_or_tag }}'
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
key: sbt-cache-${{ hashFiles('*.sbt') }}-${{ hashFiles('project/**') }}
- uses: actions/cache@v3
with:
path: |
~/**/target/**/*.jar
~/**/target/manifest.json
key: assembly-cache-${{ github.run_id }}
- name: Create CONNECTOR_FOLDER
run: |
mkdir -p ${{ env.CONNECTOR_FOLDER }}
- name: Package artifact for 2.13
env:
SCALA_VER: '2.13'
run: |
.github/workflows/release.sh ${{ env.SCALA_VER }} ${{ env.BRANCH_OR_TAG }}
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: '${{ env.CONNECTOR_FOLDER }}-${{ env.BRANCH_OR_TAG }}'
path: |
${{ env.CONNECTOR_FOLDER }}
retention-days: 10
release_to_github:
runs-on: ubuntu-latest
if: |
always() &&
needs.prepare_env.outputs.release_mode == 'true' &&
needs.prepare_env.result == 'success' &&
needs.package.result == 'success'
needs:
- prepare_env
- package
env:
BRANCH_OR_TAG: '${{ needs.prepare_env.outputs.branch_or_tag }}'
RELEASE_MODE: '${{ needs.prepare_env.outputs.release_mode }}'
DRAFT_RELEASE: '${{ needs.prepare_env.outputs.draft_release }}'
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: '${{ env.DRAFT_RELEASE }}'
fail_on_unmatched_files: true
name: 'EMS Kafka Connector ${{ env.BRANCH_OR_TAG }}'
files: |
${{ env.CONNECTOR_FOLDER }}-${{ env.BRANCH_OR_TAG }}/${{ env.CONNECTOR_FOLDER }}-${{ env.BRANCH_OR_TAG }}.zip