Skip to content

Commit 0cbb0d3

Browse files
authored
Add Makefile and use actions from github-actions (#47)
* Add Makefile and reuse shared actions Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Fix java matrix Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Add kind Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Add IT and fix Make targets Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Try to change event type to force trigger workflow Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Remove unused paramas for now Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Update to latest changes Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Minor fixes Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Skip container build in tests Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Remove push trigger for main branch as it is not needed Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> --------- Signed-off-by: Jakub Stejskal <xstejs24@gmail.com>
1 parent 0c79298 commit 0cbb0d3

File tree

10 files changed

+168
-209
lines changed

10 files changed

+168
-209
lines changed

.github/actions/build/build-binaries/action.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/actions/build/deploy-java/action.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/actions/build/release-artifacts/action.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,40 @@ jobs:
2424
name: Build Kafka Kubernetes Config Provider
2525
strategy:
2626
matrix:
27-
javaVersion:
28-
- "11"
29-
- "17"
27+
java:
28+
- version: "11"
29+
mainBuild: false
30+
- version: "17"
31+
mainBuild: true
3032
runs-on: ubuntu-latest
3133
steps:
3234
- uses: actions/checkout@v6
33-
- uses: ./.github/actions/build/build-binaries
35+
36+
- name: Setup Java and Maven
37+
uses: strimzi/github-actions/.github/actions/dependencies/setup-java@main
38+
with:
39+
javaVersion: ${{ matrix.java.version }}
40+
41+
- name: Setup Kind cluster
42+
uses: strimzi/github-actions/.github/actions/dependencies/setup-kind@main
43+
with:
44+
controlNodes: 1
45+
workerNodes: 1
46+
kindVersion: 0.31.0
3447
env:
35-
# The following env vars are set just to bypass current script config for all branches
36-
# We will remove it in near future with removing Azure and using standard build scheme for all repos
37-
BUILD_REASON: "PR"
38-
BRANCH: "PR"
48+
KIND_NODE_IMAGE: "latest"
49+
50+
# ITs requires to have set default namespace in kubeconfig which is not by default with Kind
51+
- name: Set default namespace
52+
shell: bash
53+
run: kubectl config set-context --current --namespace=default
54+
55+
- name: Build binaries using build-binaries action
56+
uses: strimzi/github-actions/.github/actions/build/build-binaries@main
3957
with:
40-
javaVersion: ${{ matrix.javaVersion }}
41-
runnerArch: "amd64"
58+
mainJavaBuild: ${{ matrix.java.mainBuild }}
59+
artifactSuffix: "kafka-kubernetes-config-provider"
60+
clusterOperatorBuild: "false"
4261

4362
deploy-java:
4463
name: Deploy Java artifacts
@@ -48,10 +67,16 @@ jobs:
4867
runs-on: ubuntu-latest
4968
steps:
5069
- uses: actions/checkout@v6
51-
- uses: ./.github/actions/build/deploy-java
70+
71+
- name: Setup Java and Maven
72+
uses: strimzi/github-actions/.github/actions/dependencies/setup-java@main
73+
with:
74+
javaVersion: "17"
75+
76+
- name: Deploy to Maven Central
77+
uses: strimzi/github-actions/.github/actions/build/deploy-java@main
5278
with:
53-
javaVersion: "11"
54-
runnerArch: "amd64"
79+
modules: "./"
5580
gpgPassphrase: ${{ secrets.GPG_PASSPHRASE }}
5681
gpgSigningKey: ${{ secrets.GPG_SIGNING_KEY }}
5782
centralUsername: ${{ secrets.CENTRAL_USERNAME }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: GitHub Actions Integration
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'pom.xml'
7+
- 'Makefile'
8+
- 'Makefile.maven'
9+
- 'Makefile.os'
10+
- '.github/workflows/github-actions-integration.yml'
11+
branches:
12+
- "*"
13+
14+
permissions:
15+
contents: read
16+
id-token: write
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
test-github-actions-integration:
24+
# TODO - change ref once we will have released version
25+
uses: strimzi/github-actions/.github/workflows/reusable-test-integrations.yml@main
26+
with:
27+
repo: ${{ github.repository }}
28+
ref: ${{ github.sha }}
29+
architecture: "amd64"
30+
artifactSuffix: "kafka-kubernetes-config-provider"
31+
buildContainers: false
32+
modules: "./"
33+
nexusCheck: "kafka-kubernetes-config-provider"
34+
javaVersion: "17"
35+
helmChartName: "none"
36+
releaseVersion: "6.6.6"
37+
imagesDir: "none"
38+
clusterOperatorBuild: false
39+
# TODO - change ref once we will have released version
40+
githubActionsRef: "main"
41+
secrets: inherit
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Unit & Integration tests of Actions
1+
name: Lint
22

33
on:
44
pull_request:

.github/workflows/release.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,22 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v6
22-
- uses: ./.github/actions/build/release-artifacts
22+
23+
- name: Setup Java and Maven
24+
uses: strimzi/github-actions/.github/actions/dependencies/setup-java@main
25+
with:
26+
javaVersion: "17"
27+
28+
- name: Prepare release artifacts
29+
uses: strimzi/github-actions/.github/actions/build/release-artifacts@main
2330
with:
2431
releaseVersion: ${{ inputs.releaseVersion }}
25-
runnerArch: "amd64"
32+
artifactSuffix: "kafka-kubernetes-config-provider"
33+
34+
- name: Deploy to Maven Central
35+
uses: strimzi/github-actions/.github/actions/build/deploy-java@main
36+
with:
37+
modules: "./"
2638
gpgPassphrase: ${{ secrets.GPG_PASSPHRASE }}
2739
gpgSigningKey: ${{ secrets.GPG_SIGNING_KEY }}
2840
centralUsername: ${{ secrets.CENTRAL_USERNAME }}

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
include ./Makefile.os
2+
include ./Makefile.maven
3+
4+
RELEASE_VERSION ?= latest
5+
PROJECT_NAME ?= kafka-kubernetes-config-provider
6+
7+
.PHONY: all
8+
all: java_install spotbugs
9+
10+
.PHONY: release
11+
release: release_maven release_package
12+
13+
.PHONY: release_maven
14+
release_maven:
15+
echo "Update pom versions to $(RELEASE_VERSION)"
16+
mvn $(MVN_ARGS) versions:set -DnewVersion=$(shell echo $(RELEASE_VERSION) | tr a-z A-Z)
17+
mvn $(MVN_ARGS) versions:commit
18+
19+
.PHONY: release_package
20+
release_package: java_package
21+
22+
.PHONY: clean
23+
clean: java_clean

Makefile.maven

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Makefile.maven contains the shared tasks for building Java applications. This file is
2+
# included into the Makefile files which contain some Java sources which should be build
3+
4+
.PHONY: java_compile
5+
java_compile:
6+
echo "Building JAR file ..."
7+
mvn $(MVN_ARGS) compile
8+
9+
.PHONY: java_verify
10+
java_verify:
11+
echo "Building JAR file ..."
12+
mvn $(MVN_ARGS) verify
13+
14+
.PHONY: java_package
15+
java_package:
16+
echo "Packaging project ..."
17+
mvn $(MVN_ARGS) package
18+
19+
.PHONY: java_install
20+
java_install:
21+
echo "Installing JAR files ..."
22+
mvn $(MVN_ARGS) install
23+
24+
.PHONY: java_clean
25+
java_clean:
26+
echo "Cleaning Maven build ..."
27+
mvn clean
28+
29+
.PHONY: spotbugs
30+
spotbugs:
31+
mvn $(MVN_ARGS) spotbugs:check

0 commit comments

Comments
 (0)