Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add elasticsearch ci #114

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions .github/workflows/plugins-ci-elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: Plugin CI - Elasticsearch

on:
workflow_call:
inputs:
auto-merge-exclude:
description: 'A semicolon seperated list of packages that you do not want to be auto-merged.'
required: false
default: 'fastify'
type: string
license-check:
description: 'Check licenses'
required: false
type: boolean
default: false
license-check-allowed-additional:
description: 'A semicolon seperated list of additional licenses to allow.'
required: false
type: string
default: ''
lint:
description: 'Set to true to run linting scripts.'
required: false
default: false
type: boolean

jobs:
dependency-review:
name: Dependency Review
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Dependency review
uses: actions/dependency-review-action@v3

license-check:
if: >
!failure() &&
!cancelled() &&
inputs.license-check == true
name: Check Licenses
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install dependencies
run: npm i --ignore-scripts

- name: Check Licenses
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) }}

linter:
name: Lint Code
if: >
!failure() &&
!cancelled() &&
inputs.lint == true
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install dependencies
run: npm i

- name: Lint code
run: npm run lint

test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 21]
db: ['elasticsearch:8.3.2']
services:
elasticsearch:
image: ${{ matrix.db }}
ports:
- '9200:9200'
- '9300:9300'
env:
xpack.security.enabled: false
discovery.type: single-node
options: >-
--health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10

steps:
- name: Check out repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm i --ignore-scripts

- name: Run tests
run: npm test

automerge:
name: Automerge Dependabot PRs
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.user.login == 'dependabot[bot]'
needs: test
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
exclude: ${{ inputs.auto-merge-exclude }}
github-token: ${{ secrets.GITHUB_TOKEN }}
target: major
Loading