Make schemas configurable in adapters (close #791) #1195
Workflow file for this run
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: CI | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- master | |
- develop | |
- 'snapshot/**' | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: enricher | |
POSTGRES_PASSWORD: supersecret1 | |
POSTGRES_DB: sql_enrichment_test | |
POSTGRES_PORT: 5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: coursier/cache-action@v6 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Start HTTP server to test API enrichment in Common Enrich | |
run: python integration-tests/common/api-enrichment-test.py 8001 & | |
- name: Start HTTP server to test API enrichment in Common Fs2 | |
run: python integration-tests/common-fs2/api-enrichment-test.py 8000 & | |
- name: Prepare data in Postgres to test SQL enrichment in Common Enrich | |
run: psql -h localhost -p 5432 -U enricher -d sql_enrichment_test < integration-tests/common/sql-enrichment-test.sql | |
env: | |
PGPASSWORD: supersecret1 | |
- name: Prepare data in Postgres to test SQL enrichment in Common Fs2 | |
run: psql -h localhost -p 5432 -U enricher -d sql_enrichment_test < integration-tests/common-fs2/sql-enrichment-test.sql | |
env: | |
PGPASSWORD: supersecret1 | |
- name: Run tests | |
run: SBT_OPTS="-Xms1G -Xmx8G -Xss4M -XX:MaxMetaspaceSize=1024M" sbt coverage +test | |
env: | |
OER_KEY: ${{ secrets.OER_KEY }} | |
- name: Check Scala formatting | |
run: sbt scalafmtCheckAll | |
- name: Check assets can be published | |
run: sbt publishLocal | |
- name: Run integration tests for enrich-kinesis | |
run: sbt "project kinesisDistroless" IntegrationTest/test | |
env: | |
AWS_ACCESS_KEY_ID: foo | |
AWS_SECRET_ACCESS_KEY: bar | |
- name: Run integration tests for enrich-kafka | |
run: | | |
sbt "project kafka" "docker:publishLocal" | |
docker-compose -f integration-tests/enrich-kafka/docker-compose.yml up -d | |
sbt "project kafka" IntegrationTest/test | |
docker-compose -f integration-tests/enrich-kafka/docker-compose.yml down | |
- name: Run integration tests for enrich-nsq | |
run: sbt "project nsqDistroless" IntegrationTest/test | |
- name: Generate coverage report | |
run: sbt coverageReport | |
- name: Aggregate coverage data | |
run: sbt coverageAggregate | |
- name: Submit coveralls data | |
run: sbt coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
github_release: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: coursier/cache-action@v6 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Get current version | |
id: ver | |
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
- name: Assemble fat jars | |
run: | | |
sbt "project streamKinesis; set assembly / test := {}; assembly" \ | |
"project streamKafka; set assembly / test := {}; assembly" \ | |
"project streamNsq; set assembly / test := {}; assembly" \ | |
"project pubsub; set assembly / test := {}; assembly" \ | |
"project kinesis; set assembly / test := {}; assembly" \ | |
"project rabbitmq; set assembly / test := {}; assembly" \ | |
"project kafka; set assembly / test := {}; assembly" \ | |
"project nsq; set assembly / test := {}; assembly" | |
- name: Create GitHub release and attach artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
prerelease: ${{ contains(steps.ver.outputs.tag, 'rc') }} | |
name: ${{ steps.ver.outputs.tag }} | |
tag_name: ${{ steps.ver.outputs.tag }} | |
files: | | |
modules/stream/kinesis/target/scala-2.12/snowplow-stream-enrich-kinesis-${{ steps.ver.outputs.tag }}.jar | |
modules/stream/kafka/target/scala-2.12/snowplow-stream-enrich-kafka-${{ steps.ver.outputs.tag }}.jar | |
modules/stream/nsq/target/scala-2.12/snowplow-stream-enrich-nsq-${{ steps.ver.outputs.tag }}.jar | |
modules/pubsub/target/scala-2.12/snowplow-enrich-pubsub-${{ steps.ver.outputs.tag }}.jar | |
modules/kinesis/target/scala-2.12/snowplow-enrich-kinesis-${{ steps.ver.outputs.tag }}.jar | |
modules/rabbitmq/target/scala-2.12/snowplow-enrich-rabbitmq-${{ steps.ver.outputs.tag }}.jar | |
modules/kafka/target/scala-2.12/snowplow-enrich-kafka-${{ steps.ver.outputs.tag }}.jar | |
modules/nsq/target/scala-2.12/snowplow-enrich-nsq-${{ steps.ver.outputs.tag }}.jar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish_docker: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/snapshot') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: | |
- streamKinesis | |
- streamKafka | |
- streamNsq | |
- pubsub | |
- kinesis | |
- kafka | |
- nsq | |
- rabbitmq | |
include: | |
- suffix: "" | |
- suffix: -experimental | |
app: rabbitmq | |
- app: kinesis | |
run_snyk: ${{ !contains(github.ref, 'rc') }} | |
- app: pubsub | |
run_snyk: ${{ !contains(github.ref, 'rc') }} | |
steps: | |
- uses: actions/checkout@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Checkout with history for version info | |
uses: actions/checkout@v2 | |
if: startsWith(github.ref, 'refs/heads/snapshot') | |
with: | |
fetch-depth: 0 | |
- uses: coursier/cache-action@v6 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Docker login | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get current version | |
if: startsWith(github.ref, 'refs/tags/') | |
id: ver | |
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
- name: Get current version (snapshot) | |
if: startsWith(github.ref, 'refs/heads/snapshot') | |
id: ver-snapshot | |
run: | | |
export SNAPSHOT_VERSION=$(sbt common/version -Dsbt.log.noformat=true | grep 'SNAPSHOT' | awk '{ print $2 }') | |
echo "::set-output name=tag::$SNAPSHOT_VERSION" | |
- name: Get app package name | |
id: packageName | |
run: | | |
export PACKAGE_NAME=$(sbt "project ${{ matrix.app }}" dockerAlias -Dsbt.log.noformat=true | sed -n '/\[info\]/ s/\[info\] //p' | tail -1 | tr -d '\n' | cut -d":" -f1)${{ matrix.suffix }} | |
echo "::set-output name=package_name::$PACKAGE_NAME" | |
- name: Get app base directory | |
id: baseDirectory | |
run: | | |
export BASE_DIRECTORY=$(sbt "project ${{ matrix.app }}" baseDirectory -Dsbt.log.noformat=true | sed -n '/\[info\]/ s/\[info\] //p' | tail -1 | tr -d '\n') | |
echo "::set-output name=directory::$BASE_DIRECTORY" | |
- name: Get app base directory (distroless) | |
id: baseDirectoryDistroless | |
run: | | |
export BASE_DIRECTORY_DISTROLESS=$(sbt "project ${{ matrix.app }}Distroless" baseDirectory -Dsbt.log.noformat=true | sed -n '/\[info\]/ s/\[info\] //p' | tail -1 | tr -d '\n') | |
echo "::set-output name=directory::$BASE_DIRECTORY_DISTROLESS" | |
- name: Stage the Docker build | |
run: sbt "project ${{ matrix.app }}" docker:stage | |
- name: Stage the Docker distroless build | |
run: sbt "project ${{ matrix.app }}Distroless" docker:stage | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ steps.packageName.outputs.package_name }} | |
tags: | | |
type=raw,value=latest,enable=${{ !contains(steps.ver.outputs.tag, 'rc') && !contains(steps.ver-snapshot.outputs.tag, 'SNAPSHOT' )}} | |
type=raw,value=latest-focal,enable=${{ !contains(steps.ver.outputs.tag, 'rc') && !contains(steps.ver-snapshot.outputs.tag, 'SNAPSHOT' )}} | |
type=raw,value=${{ steps.ver.outputs.tag }},enable=${{ !contains(steps.ver.outputs.tag, 'SNAPSHOT') && steps.ver.outputs.tag != '' }} | |
type=raw,value=${{ steps.ver.outputs.tag }}-focal,enable=${{ !contains(steps.ver.outputs.tag, 'SNAPSHOT') && steps.ver.outputs.tag != '' }} | |
type=raw,value=${{ steps.ver-snapshot.outputs.tag }},enable=${{ contains(steps.ver-snapshot.outputs.tag, 'SNAPSHOT') }} | |
type=raw,value=${{ steps.ver-snapshot.outputs.tag }}-focal,enable=${{ contains(steps.ver-snapshot.outputs.tag, 'SNAPSHOT') }} | |
flavor: | | |
latest=false | |
- name: Docker metadata distroless | |
id: distroless-meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ steps.packageName.outputs.package_name }} | |
tags: | | |
type=raw,value=latest-distroless,enable=${{ !contains(steps.ver.outputs.tag, 'rc') && !contains(steps.ver-snapshot.outputs.tag, 'SNAPSHOT' )}} | |
type=raw,value=${{ steps.ver.outputs.tag }}-distroless,enable=${{ !contains(steps.ver.outputs.tag, 'SNAPSHOT') && steps.ver.outputs.tag != '' }} | |
type=raw,value=${{ steps.ver-snapshot.outputs.tag }}-distroless,enable=${{ contains(steps.ver-snapshot.outputs.tag, 'SNAPSHOT') }} | |
flavor: | | |
latest=false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Push image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ${{ steps.baseDirectory.outputs.directory }}/target/docker/stage | |
file: ${{ steps.baseDirectory.outputs.directory }}/target/docker/stage/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true | |
- name: Push distroless image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ${{ steps.baseDirectoryDistroless.outputs.directory }}/target/docker/stage | |
file: ${{ steps.baseDirectoryDistroless.outputs.directory }}/target/docker/stage/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
tags: ${{ steps.distroless-meta.outputs.tags }} | |
push: true | |
- name: Build local distroless image, which is needed to run Snyk | |
if: matrix.run_snyk | |
run: sbt "project ${{ matrix.app }}Distroless" docker:publishLocal | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/docker@master | |
if: matrix.run_snyk | |
with: | |
image: "${{ steps.packageName.outputs.package_name }}:${{ steps.ver.outputs.tag }}-distroless" | |
args: "--app-vulns --org=data-processing-new" | |
command: monitor | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
publish_sce: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: coursier/cache-action@v6 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Deploy SCE on Maven Central | |
run: sbt "project common" ci-release | |
env: | |
PGP_PASSPHRASE: ${{ secrets.SONA_PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.SONA_PGP_SECRET }} | |
SONATYPE_USERNAME: ${{ secrets.SONA_USER }} | |
SONATYPE_PASSWORD: ${{ secrets.SONA_PASS }} |