Skip to content

Commit 1fd2356

Browse files
Uzlopakgurgunday
andauthored
add elasticsearch ci (#114)
* add elasticsearch ci * add blueoak --------- Co-authored-by: Gürgün Dayıoğlu <[email protected]>
1 parent 39d0984 commit 1fd2356

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Plugin CI - Elasticsearch
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+
db: ['elasticsearch:8.3.2']
101+
services:
102+
elasticsearch:
103+
image: ${{ matrix.db }}
104+
ports:
105+
- '9200:9200'
106+
- '9300:9300'
107+
env:
108+
xpack.security.enabled: false
109+
discovery.type: single-node
110+
options: >-
111+
--health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
112+
113+
steps:
114+
- name: Check out repo
115+
uses: actions/checkout@v4
116+
with:
117+
persist-credentials: false
118+
119+
- name: Setup Node ${{ matrix.node-version }}
120+
uses: actions/setup-node@v4
121+
with:
122+
node-version: ${{ matrix.node-version }}
123+
124+
- name: Install dependencies
125+
run: npm i --ignore-scripts
126+
127+
- name: Run tests
128+
run: npm test
129+
130+
automerge:
131+
name: Automerge Dependabot PRs
132+
if: >
133+
github.event_name == 'pull_request' &&
134+
github.event.pull_request.user.login == 'dependabot[bot]'
135+
needs: test
136+
permissions:
137+
pull-requests: write
138+
contents: write
139+
runs-on: ubuntu-latest
140+
steps:
141+
- uses: fastify/github-action-merge-dependabot@v3
142+
with:
143+
exclude: ${{ inputs.auto-merge-exclude }}
144+
github-token: ${{ secrets.GITHUB_TOKEN }}
145+
target: major

0 commit comments

Comments
 (0)