Skip to content

Commit 9aa894e

Browse files
committed
initializing project structure and ci (gh action integration)
1 parent 0eb77fa commit 9aa894e

File tree

29 files changed

+1619
-1
lines changed

29 files changed

+1619
-1
lines changed

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: 🔄 CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 0 * * 0' # Run weekly on Sundays at midnight UTC
10+
workflow_dispatch: # Allows manual triggering
11+
12+
jobs:
13+
lint:
14+
name: 🧹 Code Quality Checks
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: 📥 Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: ☕ Set up JDK 21
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '21'
24+
distribution: 'temurin'
25+
cache: 'gradle'
26+
27+
- name: 🛠️ Setup Gradle
28+
uses: gradle/gradle-build-action@v3
29+
with:
30+
gradle-version: wrapper
31+
32+
- name: 🔍 Check code style
33+
run: ./gradlew checkstyleMain checkstyleTest --no-daemon
34+
35+
- name: 🔍 Check for deprecated API usage
36+
run: ./gradlew spotbugsMain spotbugsTest --no-daemon
37+
38+
build:
39+
name: 🚀 Build and Test
40+
needs: lint
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
matrix:
44+
os: [ubuntu-latest, macos-latest]
45+
java-version: [21]
46+
47+
steps:
48+
- name: 📥 Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: ☕ Set up JDK ${{ matrix.java-version }}
52+
uses: actions/setup-java@v4
53+
with:
54+
java-version: ${{ matrix.java-version }}
55+
distribution: 'temurin'
56+
cache: 'gradle'
57+
58+
- name: 🛠️ Setup Gradle
59+
uses: gradle/gradle-build-action@v3
60+
with:
61+
gradle-version: wrapper
62+
63+
- name: 📦 Install dependencies (macOS)
64+
if: runner.os == 'macOS'
65+
run: |
66+
brew update
67+
brew tap confluentinc/tap
68+
brew bundle
69+
70+
- name: 📦 Install dependencies (Ubuntu)
71+
if: runner.os == 'Linux'
72+
run: |
73+
sudo apt-get update
74+
sudo apt-get install -y jq
75+
76+
- name: 🏗️ Build with Gradle
77+
run: ./gradlew build --no-daemon
78+
79+
- name: 🧪 Run tests
80+
run: ./gradlew test --no-daemon
81+
82+
- name: 📦 Build shadow JARs
83+
run: ./gradlew shadowJar --no-daemon
84+
85+
- name: 📤 Upload build artifacts
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: build-artifacts-${{ matrix.os }}
89+
path: |
90+
flink-streaming/build/libs/*.jar
91+
flink-sql/build/libs/*.jar
92+
retention-days: 5
93+
94+
docker:
95+
name: 🐳 Docker Build Test
96+
needs: build
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: 📥 Checkout code
100+
uses: actions/checkout@v4
101+
102+
- name: 🐳 Set up Docker Buildx
103+
uses: docker/setup-buildx-action@v3
104+
105+
- name: 🏗️ Build Docker image
106+
uses: docker/build-push-action@v5
107+
with:
108+
context: .
109+
push: false
110+
tags: flink-for-java-workshop:test
111+
cache-from: type=gha
112+
cache-to: type=gha,mode=max

.github/workflows/smoke-test.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: 🔍 Smoke Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch: # Allows manual triggering
9+
10+
jobs:
11+
build:
12+
name: 🚀 Build and Test
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest]
17+
java-version: [21]
18+
19+
steps:
20+
- name: 📥 Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: ☕ Set up JDK ${{ matrix.java-version }}
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: ${{ matrix.java-version }}
27+
distribution: 'temurin'
28+
cache: 'gradle'
29+
30+
- name: 🛠️ Setup Gradle
31+
uses: gradle/gradle-build-action@v3
32+
with:
33+
gradle-version: wrapper
34+
35+
- name: ✅ Validate Gradle wrapper
36+
uses: gradle/wrapper-validation-action@v2
37+
38+
- name: 📦 Install dependencies (macOS)
39+
if: runner.os == 'macOS'
40+
run: |
41+
brew update
42+
brew tap confluentinc/tap
43+
brew bundle
44+
45+
- name: 📦 Install dependencies (Ubuntu)
46+
if: runner.os == 'Linux'
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y jq
50+
51+
- name: 🏗️ Build with Gradle
52+
run: ./gradlew build --no-daemon
53+
54+
- name: 🧪 Run tests
55+
run: ./gradlew test --no-daemon
56+
57+
- name: 📦 Build shadow JARs
58+
run: ./gradlew shadowJar --no-daemon
59+
60+
- name: 📤 Upload build artifacts
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: build-artifacts-${{ matrix.os }}
64+
path: |
65+
flink-streaming/build/libs/*.jar
66+
flink-sql/build/libs/*.jar
67+
retention-days: 5

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ gradle-app.setting
5959
.project
6060
.classpath
6161

62-
cloud.properties
62+
cloud.properties
63+
.vscode
64+
bin

.windsurfrules

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# project rules
2+
3+
## Makefile
4+
5+
- use make files when need to execute more than one command
6+
- for Makefiles use emoji and ascii colors for better readability
7+
8+
## Java
9+
10+
- use java 21 for building the project
11+
- use gradle with Kotlin for build scripts
12+
- prefer multimodule project structure
13+
- common modules (that will be shared between projects) should be in the `common` directory
14+
- use sdkman for managing SDKs
15+
16+
## Dockerfile and Docker Compose
17+
18+
- prefer to use https://orbstack.dev/ for managing docker containers (instead of docker desktop)
19+
- for managing docker containers use docker compose and don't add version attribute for docker-compose.yaml file
20+
- for kafka in docker use apache/kafka:3.8.0 image in Kraft more withour zookeeper
21+
22+
## Documentation
23+
24+
- use asciidoc (*.adoc) for documentation and use emoji for better readability
25+
- use one sentence per line in asciidoc
26+
27+
## Git and Github
28+
29+
- use git for version control
30+
- when working on a new feature create a new branch (feature/feature-name)
31+
- use github cli to interact with github
32+
33+
## brew (for mac)
34+
35+
- use brew for installing dependencies
36+
- prefer to use Brewfile for managing dependencies

Brewfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Brewfile for Flink Java Workshop
2+
# Core dependencies
3+
#brew "openjdk@21"
4+
#brew "gradle"
5+
#brew "maven"
6+
7+
# Docker and related tools
8+
brew "docker"
9+
brew "docker-compose"
10+
cask "orbstack"
11+
12+
# Development tools
13+
brew "gh" # GitHub CLI
14+
brew "jq" # JSON processor
15+
brew "httpie" # HTTP client
16+
brew "bat" # Better cat
17+
brew "fd" # Better find
18+
brew "ripgrep" # Better grep
19+
20+
# Terraform for infrastructure
21+
brew "terraform"
22+
23+
# Kafka tools
24+
brew "kcat" # Kafka cat utility
25+
tap "confluentinc/tap"
26+
brew "confluentinc/tap/cli" # Confluent Platform CLI
27+
28+
# Shell utilities
29+
brew "zsh"
30+
brew "zsh-completions"

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM eclipse-temurin:21-jre-alpine
2+
3+
# Set working directory
4+
WORKDIR /app
5+
6+
# Copy the shadow JARs
7+
COPY flink-streaming/build/libs/*-all.jar /app/flink-streaming.jar
8+
COPY flink-sql/build/libs/*-all.jar /app/flink-sql.jar
9+
10+
# Copy configuration files
11+
COPY cloud.properties* /app/
12+
13+
# Set environment variables
14+
ENV JAVA_OPTS="-Xms512m -Xmx1024m"
15+
16+
# Default command to run the streaming application
17+
CMD ["java", "-jar", "/app/flink-streaming.jar"]

0 commit comments

Comments
 (0)