Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/Reference/Server.md
#	fastify.js
#	package.json
  • Loading branch information
climba03003 committed Apr 23, 2024
2 parents bc60c42 + f9f0c9f commit ccd16ac
Show file tree
Hide file tree
Showing 59 changed files with 518 additions and 172 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/benchmark-parser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Install
run: |
npm install --only=production --ignore-scripts
npm install --ignore-scripts
- name: Run benchmark
id: benchmark-pr
Expand All @@ -52,7 +52,7 @@ jobs:

- name: Install
run: |
npm install --only=production --ignore-scripts
npm install --ignore-scripts
- name: Run benchmark
id: benchmark-main
Expand All @@ -64,7 +64,8 @@ jobs:
echo 'EOF' >> $GITHUB_OUTPUT
output-benchmark:
needs: [benchmark]
needs:
- benchmark
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Install
run: |
npm install --only=production --ignore-scripts
npm install --ignore-scripts
- name: Run benchmark
id: benchmark-pr
Expand All @@ -52,7 +52,7 @@ jobs:

- name: Install
run: |
npm install --only=production --ignore-scripts
npm install --ignore-scripts
- name: Run benchmark
id: benchmark-main
Expand All @@ -64,7 +64,8 @@ jobs:
echo 'EOF' >> $GITHUB_OUTPUT
output-benchmark:
needs: [benchmark]
needs:
- benchmark
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand Down Expand Up @@ -96,13 +97,15 @@ jobs:
- benchmark
- output-benchmark
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Remove benchmark label
uses: octokit/request-action@v2.x
id: remove-label
with:
route: DELETE /repos/{repo}/issues/{issue_number}/labels/{name}
repo: ${{ github.event.pull_request.head.repo.full_name }}
repo: ${{ github.repository }}
issue_number: ${{ github.event.pull_request.number }}
name: benchmark
env:
Expand Down
127 changes: 127 additions & 0 deletions .github/workflows/ci-alternative-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: ci Alternative Runtimes

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

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

jobs:
test-unit:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
node-version: [18, 20]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- runtime: nsolid
node-version: 18
nsolid-version: 5
- runtime: nsolid
node-version: 20
nsolid-version: 5
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: nodesource/setup-nsolid@v1
if: ${{ matrix.runtime == 'nsolid' }}
with:
node-version: ${{ matrix.node-version }}
nsolid-version: ${{ matrix.nsolid-version }}

- name: Install
run: |
npm install --ignore-scripts
- name: Run tests
run: |
npm run unit
test-typescript:
runs-on: 'ubuntu-latest'
permissions:
contents: read

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: nodesource/setup-nsolid@v1
with:
node-version: 20
nsolid-version: 5

- name: Install
run: |
npm install --ignore-scripts
- name: Run typescript tests
run: |
npm run test:typescript
env:
NODE_OPTIONS: no-network-family-autoselection

package:
needs:
- test-typescript
- test-unit
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: nodesource/setup-nsolid@v1
with:
nsolid-version: 5
- name: install fastify
run: |
npm install --ignore-scripts
- name: install webpack stack
run: |
cd test/bundler/webpack && npm install
- name: Test webpack bundle
run: |
cd test/bundler/webpack && npm run test
- name: install esbuild stack
run: |
cd test/bundler/esbuild && npm install
- name: Test esbuild bundle
run: |
cd test/bundler/esbuild && npm run test
automerge:
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.user.login == 'dependabot[bot]'
needs:
- test-typescript
- test-unit
- package
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ jobs:
npm run lint
coverage-nix:
needs: lint
needs:
- lint
permissions:
contents: read
uses: ./.github/workflows/coverage-nix.yml

coverage-win:
needs: lint
needs:
- lint
permissions:
contents: read
uses: ./.github/workflows/coverage-win.yml
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/citgm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,20 @@ jobs:
node-version: ${{ matrix.node-version }}

remove-label:
if: always()
needs:
if: ${{ github.event.label.name == 'citgm-core-plugins' }}
needs:
- core-plugins
continue-on-error: true
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Remove citgm-core-plugins label
uses: octokit/request-action@v2.x
id: remove-label
with:
route: DELETE /repos/{repo}/issues/{issue_number}/labels/{name}
repo: ${{ github.event.pull_request.head.repo.full_name }}
repo: ${{ github.repository }}
issue_number: ${{ github.event.pull_request.number }}
name: citgm-core-plugins
env:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/integration-alternative-runtimes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: integration Alternative Runtimes

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

jobs:
install-production:
runs-on: ${{ matrix.os }}
permissions:
contents: read

strategy:
matrix:
os: [ubuntu-latest]
runtime: [nsolid]
node-version: [18, 20]
pnpm-version: [8]
include:
- nsolid-version: 5
node-version: 18
runtime: nsolid
- nsolid-version: 5
node-version: 20
runtime: nsolid
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: nodesource/setup-nsolid@v1
if: ${{ matrix.runtime == 'nsolid' }}
with:
node-version: ${{ matrix.node-version }}
nsolid-version: ${{ matrix.nsolid-version }}

- name: Install Pnpm
uses: pnpm/action-setup@v3
with:
version: ${{ matrix.pnpm-version }}

- name: Install Production
run: |
pnpm install --prod
- name: Run server
run: |
node integration/server.js &
- name: Test
if: ${{ success() }}
run: |
bash integration/test.sh
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install Pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: ${{ matrix.pnpm-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/links-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: lycheeverse/lychee-action@c053181aa0c3d17606addfe97a9075a32723548a
with:
fail: true
# As external links behaviour is not predictable, we check only internal links
# As external links behavior is not predictable, we check only internal links
# to ensure consistency.
# See: https://github.com/lycheeverse/lychee-action/issues/17#issuecomment-1162586751
args: --offline --verbose --no-progress './**/*.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/md-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: npm install --ignore-scripts

- name: Add Matcher
uses: xt0rted/markdownlint-problem-matcher@98d94724052d20ca2e06c091f202e4c66c3c59fb
uses: xt0rted/markdownlint-problem-matcher@1a5fabfb577370cfdf5af944d418e4be3ea06f27

- name: Run Linter
run: ./node_modules/.bin/markdownlint-cli2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package-manager-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install with pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
with:
version: ${{ matrix.pnpm-version }}

Expand Down
1 change: 1 addition & 0 deletions .taprc
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node-arg: --allow-natives-syntax

files:
- 'test/**/*.test.js'
- 'test/**/*.test.mjs'
2 changes: 1 addition & 1 deletion SPONSORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ _Be the first!_

## Tier 3

_Be the first!_
- [Mercedes-Benz Group](https://github.com/mercedes-benz)

## Tier 2

Expand Down
6 changes: 4 additions & 2 deletions docs/Guides/Database.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ development. Migrations provide a repeatable and testable way to modify a
database's schema and prevent data loss.

As stated at the beginning of the guide, Fastify is database agnostic and any
NodeJS database migration tool can be used with it. We will give an example of
Node.js database migration tool can be used with it. We will give an example of
using [Postgrator](https://www.npmjs.com/package/postgrator) which has support
for Postgres, MySQL, SQL Server and SQLite. For MongoDB migrations, please check
[migrate-mongo](https://www.npmjs.com/package/migrate-mongo).

#### [Postgrator](https://www.npmjs.com/package/postgrator)

Postgrator is NodeJS SQL migration tool that uses a directory of SQL scripts to
Postgrator is Node.js SQL migration tool that uses a directory of SQL scripts to
alter the database schema. Each file an migrations folder need to follow the
pattern: ` [version].[action].[optional-description].sql`.

Expand Down Expand Up @@ -287,6 +287,8 @@ async function migrate() {
});

try {
await client.connect();

const postgrator = new Postgrator({
migrationPattern: path.join(__dirname, '/migrations/*'),
driver: 'pg',
Expand Down
2 changes: 1 addition & 1 deletion docs/Guides/Delay-Accepting-Requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ That will be achieved by wrapping into a custom plugin two main features:

1. the mechanism for authenticating with the provider
[decorating](../Reference/Decorators.md) the `fastify` object with the
authentication key (`magicKey` from here onwards)
authentication key (`magicKey` from here onward)
1. the mechanism for denying requests that would, otherwise, fail

### Hands-on
Expand Down

0 comments on commit ccd16ac

Please sign in to comment.