Skip to content

Commit 821ceac

Browse files
Uzlopakgurgunday
andauthored
add kafka workflow (#113)
* add kafka workflow * add blueoak --------- Co-authored-by: Gürgün Dayıoğlu <[email protected]>
1 parent 1fd2356 commit 821ceac

File tree

1 file changed

+153
-0
lines changed

1 file changed

+153
-0
lines changed

Diff for: .github/workflows/plugins-ci-kafka.yml

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Plugin CI - Kafka
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
auto-merge-exclude:
7+
description: 'A semicolon seperated list of packages that you do not want to be auto-merged.'
8+
required: false
9+
default: 'fastify'
10+
type: string
11+
license-check:
12+
description: 'Check licenses'
13+
required: false
14+
type: boolean
15+
default: false
16+
license-check-allowed-additional:
17+
description: 'A semicolon seperated list of additional licenses to allow.'
18+
required: false
19+
type: string
20+
default: ''
21+
lint:
22+
description: 'Set to true to run linting scripts.'
23+
required: false
24+
default: false
25+
type: boolean
26+
27+
jobs:
28+
dependency-review:
29+
name: Dependency Review
30+
if: github.event_name == 'pull_request'
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
steps:
35+
- name: Check out repo
36+
uses: actions/checkout@v4
37+
with:
38+
persist-credentials: false
39+
40+
- name: Dependency review
41+
uses: actions/dependency-review-action@v3
42+
43+
license-check:
44+
if: >
45+
!failure() &&
46+
!cancelled() &&
47+
inputs.license-check == true
48+
name: Check Licenses
49+
runs-on: ubuntu-latest
50+
permissions:
51+
contents: read
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
persist-credentials: false
56+
57+
- name: Setup Node
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: lts/*
61+
62+
- name: Install dependencies
63+
run: npm i --ignore-scripts
64+
65+
- name: Check Licenses
66+
run: ${{ format('npx license-checker --production --summary --onlyAllow="0BSD;Apache-2.0;BlueOak-1.0.0;BSD-2-Clause;BSD-3-Clause;ISC;MIT;{0}"', inputs.license-check-allowed-additional) }}
67+
68+
linter:
69+
name: Lint Code
70+
if: >
71+
!failure() &&
72+
!cancelled() &&
73+
inputs.lint == true
74+
runs-on: ubuntu-latest
75+
permissions:
76+
contents: read
77+
steps:
78+
- name: Check out repo
79+
uses: actions/checkout@v4
80+
with:
81+
persist-credentials: false
82+
83+
- name: Setup Node
84+
uses: actions/setup-node@v4
85+
with:
86+
node-version: lts/*
87+
88+
- name: Install dependencies
89+
run: npm i
90+
91+
- name: Lint code
92+
run: npm run lint
93+
94+
test:
95+
name: Node.js ${{ matrix.node-version }}
96+
runs-on: ubuntu-latest
97+
strategy:
98+
matrix:
99+
node-version: [18, 20, 21]
100+
services:
101+
zookeeper:
102+
image: 'confluentinc/cp-zookeeper:7.4.3'
103+
env:
104+
ZOOKEEPER_CLIENT_PORT: 2181
105+
ZOOKEEPER_TICK_TIME: 2000
106+
ports:
107+
- '2181:2181'
108+
kafka:
109+
image: 'confluentinc/cp-kafka:7.4.3'
110+
env:
111+
KAFKA_BROKER_ID: 1
112+
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
113+
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://localhost:9092'
114+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
115+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
116+
ports:
117+
- '9092:9092'
118+
options: >-
119+
--link zookeeper
120+
121+
steps:
122+
- name: Check out repo
123+
uses: actions/checkout@v4
124+
with:
125+
persist-credentials: false
126+
127+
- name: Setup Node ${{ matrix.node-version }}
128+
uses: actions/setup-node@v4
129+
with:
130+
node-version: ${{ matrix.node-version }}
131+
132+
- name: Install dependencies
133+
run: npm i --ignore-scripts
134+
135+
- name: Run tests
136+
run: npm test
137+
138+
automerge:
139+
name: Automerge Dependabot PRs
140+
if: >
141+
github.event_name == 'pull_request' &&
142+
github.event.pull_request.user.login == 'dependabot[bot]'
143+
needs: test
144+
permissions:
145+
pull-requests: write
146+
contents: write
147+
runs-on: ubuntu-latest
148+
steps:
149+
- uses: fastify/github-action-merge-dependabot@v3
150+
with:
151+
exclude: ${{ inputs.auto-merge-exclude }}
152+
github-token: ${{ secrets.GITHUB_TOKEN }}
153+
target: major

0 commit comments

Comments
 (0)