Skip to content

Commit

Permalink
Merge pull request #3 from alenap93/add-CI
Browse files Browse the repository at this point in the history
Create ci.yml
  • Loading branch information
alenap93 authored May 28, 2024
2 parents 4bda262 + 0e7c518 commit 5a1bdf9
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 8 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI

on:
push:
branches:
- main
- master
- next
- 'v*'
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'

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@v4

linter:
name: Lint Code
if: >
!failure() &&
!cancelled()
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 --ignore-scripts

- name: Lint code
run: npm run lint

test:
name: Test
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
node-version: ["20", "22"]
os: [macos-latest, ubuntu-latest, windows-latest]
exclude:
- os: macos-latest
node-version: 14
- os: macos-latest
node-version: 16
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

- name: Run tests
run: npm test
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const fp = require('fastify-plugin')
function fastifyKysely (fastify, options, next) {
const { namespace, kysely } = options

const client = options.client || null

if (!namespace) {
return next(new Error('Namespace not defined'))
}
Expand Down
6 changes: 0 additions & 6 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ test('fastify.kysely should throw error if kysely instance not defined', (t) =>
t.plan(1)
const fastify = Fastify()

const sqliteDialectOne = new SqliteDialect({
database: new Database(':memory:')
})

const kyselyInstanceOne = new Kysely({ dialect: sqliteDialectOne })

fastify.register(fastifyKysely, {
namespace: 'one'
})
Expand Down

0 comments on commit 5a1bdf9

Please sign in to comment.