Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DBZ] Add GitHub workflows for build sanity and publishing #343

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/basic-test-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Sanity test with YugabyteDB build

on:
workflow_dispatch:
inputs:
yb_version:
description: "YugabyteDB version to run tests against (build should be present in internal Quay registry)"
required: false
type: string
push:
branches:
- main
pull_request:
branches:
- main

env:
YB_DOCKER_IMAGE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.yb_version != '' && github.event.inputs.yb_version || secrets.YB_DOCKER_IMAGE }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_BOT_USERNAME }}
password: ${{ secrets.QUAY_BOT_TOKEN }}
- name: Pull docker image
run: docker pull $YB_DOCKER_IMAGE
- name: YugabyteDBDatatypesTest
run: mvn clean test -Dtest=YugabyteDBDatatypesTest
- name: YugabyteDBTabletSplitTest
run: mvn clean test -Dtest=YugabyteDBTabletSplitTest
- name: YugabyteDBEnumValuesTest
run: mvn clean test -Dtest=YugabyteDBEnumValuesTest
- name: YugabyteDBSnapshotTest
run: mvn clean test -Dtest=YugabyteDBSnapshotTest
82 changes: 82 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Publish YugabyteDBgRPCConnector

on:
workflow_dispatch:
inputs:
version:
description: "Release version"
required: true
type: string
devVersion:
description: "Next development version"
required: true
type: string
isSnapshotBuild:
description: "Snapshot build?"
required: true
type: boolean
default: true

permissions: write-all

jobs:
build:
name: "Publish YugabyteDBgRPCConnector"
runs-on: ubuntu-latest
steps:
- name: Check version
run: |
if [[ "${{ inputs.isSnapshotBuild }}" == "true" ]]; then
if [[ "${{ inputs.version }}" != *"SNAPSHOT"* ]]; then
echo "Error: version does not contain SNAPSHOT for a snapshot build."
exit 1
fi
fi
shell: bash

- name: Checkout Action
uses: actions/checkout@v4

- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11

- name: Clean targets
run: mvn release:clean

- name: Prepare jar for release
run: mvn --batch-mode -Dtag=v${{ inputs.version }} release:prepare -DreleaseVersion=${{ inputs.version }} -DdevelopmentVersion=${{ inputs.devVersion }} -DignoreSnapshots=True -Darguments="-DskipTests -DskipITs -Dmaven.javadoc.skip=true

- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_BOT_USERNAME_DBZ_GRPC }}
password: ${{ secrets.QUAY_BOT_TOKEN_DBZ_GRPC }}

- name: Push image to Quay
run: docker push quay.io/yugabyte/debezium-connector:${{ inputs.version }}

- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.version }}
release_name: Release ${{ inputs.version }}
draft: true
prerelease: ${{ inputs.isSnapshotBuild }}

- name: Upload fat jar to GitHub release
id: upload-release-asset-fat-jar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/debezium-connector-yugabytedb-${{ inputs.version }}.jar
asset_name: debezium-connector-yugabytedb-${{ inputs.version }}.jar
asset_content_type: application/java-archive
24 changes: 24 additions & 0 deletions .github/workflows/build-sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Sanity test with YugabyteDB preview build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Verify code compilation
run: mvn clean verify -Dquick
40 changes: 0 additions & 40 deletions .github/workflows/sanity-workflow-preview.yml

This file was deleted.

Loading