Skip to content

Commit 6f1829b

Browse files
authored
Merge pull request #2 from getindata/ci-cd
Add GitHub CI workflow
2 parents 69db0b5 + 6d71f6f commit 6f1829b

File tree

6 files changed

+355
-4
lines changed

6 files changed

+355
-4
lines changed

.github/pull_request_template.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#### Description
2+
3+
`describe the purpose of the change here`
4+
5+
Resolves `<issue nr here>`
6+
7+
##### PR Checklist
8+
- [ ] Tests added
9+
- [ ] [Changelog](CHANGELOG.md) updated

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'release/**'
8+
pull_request:
9+
10+
env:
11+
MAVEN_CLI_OPTS: "--batch-mode"
12+
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
13+
JAVA_ADDITIONAL_OPTS: "-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS"
14+
FF_USE_FASTZIP: "true"
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Set up JDK 11
23+
uses: actions/setup-java@v3
24+
with:
25+
java-version: '11'
26+
distribution: 'adopt'
27+
cache: maven
28+
29+
- name: Build
30+
run: mvn $MAVEN_CLI_OPTS $JAVA_ADDITIONAL_OPTS compile
31+
32+
- name: Tests
33+
run: |
34+
mvn $MAVEN_CLI_OPTS $JAVA_ADDITIONAL_OPTS test integration-test
35+
cat target/site/jacoco/index.html | grep -o 'Total[^%]*%'
36+
37+
- name: Add coverage to PR
38+
id: jacoco
39+
uses: madrapps/jacoco-report@v1.2
40+
if: github.event_name == 'pull_request'
41+
with:
42+
paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
min-coverage-overall: 40
45+
min-coverage-changed-files: 60
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Prepare release branch
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_part:
7+
description: The part of the version to update (patch, minor or major)
8+
required: true
9+
options:
10+
- Patch
11+
- Minor
12+
- Major
13+
default: 'Minor'
14+
15+
jobs:
16+
prepare-branch:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Set up JDK 11
22+
uses: actions/setup-java@v3
23+
with:
24+
java-version: '11'
25+
distribution: 'adopt'
26+
cache: maven
27+
28+
- name: Validate inputs
29+
run: |
30+
echo "INPUT_VERSION_PART: ${{ github.event.inputs.version_part }}"
31+
python -c "if '${{ github.event.inputs.version_part }}' not in ['Patch', 'Minor', 'Major']: raise ValueError(\"'${{ github.event.inputs.version_part }}' must be one of ['Patch', 'Minor', 'Major'])\")"
32+
33+
- name: Save current version
34+
id: save_current_version
35+
run: |
36+
mvn versions:set -DremoveSnapshot -DgenerateBackupPoms=false
37+
echo "::set-output name=current_version::$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)"
38+
39+
- name: Update the CHANGELOG according to 'Keep a Changelog' guidelines
40+
uses: thomaseizinger/keep-a-changelog-new-release@v1
41+
with:
42+
version: ${{ steps.save_current_version.outputs.current_version }}
43+
44+
- name: Create a new release branch
45+
run: |
46+
git config user.name github-actions
47+
git config user.email github-actions@github.com
48+
git commit -am "Bump CHANGELOG for release ${{ steps.save_current_version.outputs.current_version }}"
49+
git checkout -b release/${{ steps.save_current_version.outputs.current_version }}
50+
git push -u origin release/${{ steps.save_current_version.outputs.current_version }}
51+
52+
- name: Bump development version
53+
run: |
54+
git checkout main
55+
mvn validate -D 'bump${{ github.event.inputs.version_part }}' -DgenerateBackupPoms=false
56+
git commit -m "Bump development version to $(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)"
57+
git push origin main

.github/workflows/publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
MAVEN_CLI_OPTS: "--batch-mode"
9+
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
10+
JAVA_ADDITIONAL_OPTS: "-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS"
11+
FF_USE_FASTZIP: "true"
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Check release tag match # ... and fail fast if they do not
20+
run: diff <(echo "${{ github.ref_name }}") <(echo "$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)")
21+
22+
- name: Set up JDK 11
23+
uses: actions/setup-java@v3
24+
with:
25+
java-version: '11'
26+
distribution: 'adopt'
27+
cache: maven
28+
29+
- name: Build
30+
run: mvn $MAVEN_CLI_OPTS $JAVA_ADDITIONAL_OPTS compile
31+
32+
- name: Tests
33+
run: |
34+
mvn $MAVEN_CLI_OPTS $JAVA_ADDITIONAL_OPTS test integration-test
35+
36+
- name: Set up Apache Maven Central
37+
uses: actions/setup-java@v3
38+
with:
39+
java-version: '11'
40+
distribution: 'adopt'
41+
server-id: ossrh
42+
server-username: SONATYPE_USERNAME
43+
server-password: SONATYPE_PASSWORD
44+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
45+
gpg-passphrase: GPG_PRIVATE_KEY_PASSWORD
46+
47+
- name: Publish to Apache Maven Central
48+
if: github.event.release
49+
run: mvn deploy -P release
50+
env:
51+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
52+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
53+
GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}

LICENCE renamed to LICENSE

File renamed without changes.

pom.xml

Lines changed: 191 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,43 @@ under the License.
2323

2424
<groupId>com.getindata</groupId>
2525
<artifactId>flink-http-connector</artifactId>
26-
<version>1.0-SNAPSHOT</version>
26+
<version>0.1.0-SNAPSHOT</version>
2727
<packaging>jar</packaging>
2828

2929
<name>flink-http-connector</name>
30+
<description>The HTTP TableLookup connector that allows for pulling data from external system via HTTP GET method. The goal for this connector was to use it in Flink SQL statement as a standard table that can be later joined with other stream using pure SQL Flink.</description>
31+
<url>https://github.com/getindata/flink-http-connector</url>
32+
33+
<licenses>
34+
<license>
35+
<name>The Apache License, Version 2.0</name>
36+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
37+
</license>
38+
</licenses>
39+
40+
<developers>
41+
<developer>
42+
<name>GetInData</name>
43+
<email>office@getindata.com</email>
44+
<organization>GetInData</organization>
45+
<organizationUrl>https://getindata.com</organizationUrl>
46+
</developer>
47+
</developers>
48+
49+
<scm>
50+
<connection>scm:git:git://github.com/getindata/flink-http-connector</connection>
51+
<developerConnection>scm:git:ssh://github.com/getindata/flink-http-connector</developerConnection>
52+
<url>https://github.com/getindata/flink-http-connector/tree/main</url>
53+
</scm>
3054

3155
<distributionManagement>
56+
<snapshotRepository>
57+
<id>ossrh</id>
58+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
59+
</snapshotRepository>
3260
<repository>
33-
<id>gitlab</id>
34-
<name>gitlab</name>
35-
<url>${env.MAVEN_REPO_URL}</url>
61+
<id>ossrh</id>
62+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
3663
</repository>
3764
</distributionManagement>
3865

@@ -338,6 +365,20 @@ under the License.
338365
</execution>
339366
</executions>
340367
</plugin>
368+
369+
<plugin>
370+
<groupId>org.codehaus.mojo</groupId>
371+
<artifactId>build-helper-maven-plugin</artifactId>
372+
<version>3.3.0</version>
373+
<executions>
374+
<execution>
375+
<id>parse-version</id>
376+
<goals>
377+
<goal>parse-version</goal>
378+
</goals>
379+
</execution>
380+
</executions>
381+
</plugin>
341382
</plugins>
342383

343384
<pluginManagement>
@@ -385,4 +426,150 @@ under the License.
385426
</plugins>
386427
</pluginManagement>
387428
</build>
429+
430+
<profiles>
431+
<profile>
432+
<id>release</id>
433+
<build>
434+
<plugins>
435+
<plugin>
436+
<groupId>org.apache.maven.plugins</groupId>
437+
<artifactId>maven-javadoc-plugin</artifactId>
438+
<version>3.1.1</version>
439+
<executions>
440+
<execution>
441+
<id>attach-javadocs</id>
442+
<goals>
443+
<goal>jar</goal>
444+
</goals>
445+
</execution>
446+
</executions>
447+
</plugin>
448+
449+
<plugin>
450+
<groupId>org.apache.maven.plugins</groupId>
451+
<artifactId>maven-source-plugin</artifactId>
452+
</plugin>
453+
454+
<plugin>
455+
<groupId>org.sonatype.plugins</groupId>
456+
<artifactId>nexus-staging-maven-plugin</artifactId>
457+
<version>1.6.13</version>
458+
<extensions>true</extensions>
459+
<configuration>
460+
<serverId>ossrh</serverId>
461+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
462+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
463+
</configuration>
464+
</plugin>
465+
466+
<plugin>
467+
<groupId>org.apache.maven.plugins</groupId>
468+
<artifactId>maven-gpg-plugin</artifactId>
469+
<version>3.0.1</version>
470+
<configuration>
471+
<gpgArguments>
472+
<arg>--pinentry-mode</arg>
473+
<arg>loopback</arg>
474+
</gpgArguments>
475+
</configuration>
476+
<executions>
477+
<execution>
478+
<id>sign-artifacts</id>
479+
<phase>verify</phase>
480+
<goals>
481+
<goal>sign</goal>
482+
</goals>
483+
</execution>
484+
</executions>
485+
</plugin>
486+
</plugins>
487+
</build>
488+
</profile>
489+
490+
<profile>
491+
<id>bump-patch</id>
492+
<activation>
493+
<property>
494+
<name>bumpPatch</name>
495+
</property>
496+
</activation>
497+
<build>
498+
<plugins>
499+
<plugin>
500+
<groupId>org.codehaus.mojo</groupId>
501+
<artifactId>versions-maven-plugin</artifactId>
502+
503+
<executions>
504+
<execution>
505+
<goals>
506+
<goal>set</goal>
507+
</goals>
508+
<phase>validate</phase>
509+
<configuration>
510+
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}-SNAPSHOT</newVersion>
511+
</configuration>
512+
</execution>
513+
</executions>
514+
</plugin>
515+
</plugins>
516+
</build>
517+
</profile>
518+
<profile>
519+
<id>bump-minor</id>
520+
<activation>
521+
<property>
522+
<name>bumpMinor</name>
523+
</property>
524+
</activation>
525+
<build>
526+
<plugins>
527+
<plugin>
528+
<groupId>org.codehaus.mojo</groupId>
529+
<artifactId>versions-maven-plugin</artifactId>
530+
531+
<executions>
532+
<execution>
533+
<goals>
534+
<goal>set</goal>
535+
</goals>
536+
<phase>validate</phase>
537+
<configuration>
538+
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0-SNAPSHOT</newVersion>
539+
</configuration>
540+
</execution>
541+
</executions>
542+
</plugin>
543+
</plugins>
544+
</build>
545+
</profile>
546+
<profile>
547+
<id>bump-major</id>
548+
<activation>
549+
<property>
550+
<name>bumpMajor</name>
551+
</property>
552+
</activation>
553+
<build>
554+
<plugins>
555+
<plugin>
556+
<groupId>org.codehaus.mojo</groupId>
557+
<artifactId>versions-maven-plugin</artifactId>
558+
559+
<executions>
560+
<execution>
561+
<goals>
562+
<goal>set</goal>
563+
</goals>
564+
<phase>validate</phase>
565+
<configuration>
566+
<newVersion>${parsedVersion.nextMajorVersion}.0.0-SNAPSHOT</newVersion>
567+
</configuration>
568+
</execution>
569+
</executions>
570+
</plugin>
571+
</plugins>
572+
</build>
573+
</profile>
574+
</profiles>
388575
</project>

0 commit comments

Comments
 (0)