Skip to content

Commit

Permalink
Issue 1018 extract blindly (#1)
Browse files Browse the repository at this point in the history
* copy over code for microservice

fixes #1018

* add relevant .github files

fixes #1018
  • Loading branch information
Idrinth authored May 7, 2024
1 parent ba8dd9f commit 75f763a
Show file tree
Hide file tree
Showing 68 changed files with 6,189 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FASTIFY_PORT=3003
FASTIFY_HOST=127.0.0.1
FASTIFY_MYSQL_CONNECTION=mysql://root@localhost/idrinth-api-bench
FASTIFY_ORIGIN=*
FASTIFY_COMPRESS_MIN_SIZE=1024
JWT_SECRET=SOMEsecretTObeReplaced
FASTIFY_RATE_LIMIT=120
16 changes: 16 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
env: {
node: true,
es2020: true
},
ignorePatterns: [
'.eslintrc.cjs',
'node_modules',
],
plugins: [
"fastify-security-rules",
],
rules: {
"fastify-security-rules/detect-bind-on-all-ifaces": 2,
},
};
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github:
- idrinth
ko_fi: idrinth
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 100
9 changes: 9 additions & 0 deletions .github/prace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 1
body:
patterns:
- '#\d+'
error: The body has to include an issue reference like `#0`
branch:
patterns:
- 'issue-\d{1,}-[a-z0-9-]+'
error: Branch must be called `issue-{id}-{short description}`
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# The Pull Request is ready

- [ ] fixes #<!-- YOUR ISSUE ID HERE -->
- [ ] all actions are passing
- [ ] only fixes a single issue

## Overview

<!-- Provide a brief description of the changes introduced by this
Pull Request. -->

## Review points

<!-- List the points to be reviewed in detail
and the points you are not confident about. -->
<!-- Delete this section if not needed -->

## History-Microservice

- [ ] no breaking changes have been added to the api
- [ ] changes have been documented in the open-api.yml
- [ ] tests have been written(if necessary)
- [ ] shared code has been extracted in a different file

## Notes

<!-- Write any note or comment. You can share your thoughts or ideas. -->
<!-- Delete this section if not needed -->
5 changes: 5 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
exclude:
authors:
- dependabot
- renovate
29 changes: 29 additions & 0 deletions .github/workflows/global.commit-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Commit Message Lint
on:
push:
branches:
- the-one
pull_request:
branches:
- the-one
env:
CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.CURRENT_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.CURRENT_NODE_VERSION }}
cache: 'npm'
cache-dependency-path: |
framework/package-lock.json
documentation-website/package-lock.json
history-microservice/package-lock.json
history-website/package-lock.json
cli/package-lock.json
package-lock.json
- run: npm ci
- run: npm run commitlint-ci
17 changes: 17 additions & 0 deletions .github/workflows/global.conflibot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: conflibot
on:
pull_request:
branches:
- the-one

jobs:
conflibot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Warn potential conflicts
uses: idrinth/conflibot@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
exclude: |
**/package-lock.json
52 changes: 52 additions & 0 deletions .github/workflows/global.docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Docker
on:
push:
branches:
- the-one
paths:
- 'containers/*/Dockerfile'
- '.github/workflows/docker.yml'
pull_request:
branches:
- the-one
paths:
- 'containers/*/Dockerfile'
- '.github/workflows/docker.yml'
jobs:
builder:
name: Builder
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: git fetch --tags
- name: Cache Docker images.
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('containers/api-bench-build/Dockerfile') }}
- run: docker build --build-arg="BUILD_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)" -t "idrinth/api-bench-build:$(git describe --tags `git rev-list --tags --max-count=1`)" --build-arg="BUILD_TIME=now" containers/api-bench-build
build:
needs:
- builder
strategy:
matrix:
folder:
- 'api-bench-gitlab-runner'
- 'api-bench'
- 'api-bench-gitea-action'
- 'api-bench-history-website'
- 'api-bench-history-microservice'
name: Build ${{ matrix.folder }}
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: git fetch --tags
- name: Cache Docker images.
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('containers/api-bench-build/Dockerfile') }}
read-only: true
- run: docker build --build-arg="BUILD_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)" --build-arg="BUILD_TIME=now" containers/${{ matrix.folder }}
18 changes: 18 additions & 0 deletions .github/workflows/global.editorconfiglint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Editor Config Lint
on:
push:
branches:
- the-one
pull_request:
branches:
- the-one
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-go@v5
- run: go install github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker@latest
- run: ~/go/bin/editorconfig-checker
18 changes: 18 additions & 0 deletions .github/workflows/global.greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Greetings

on:
- pull_request_target
- issues

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Welcome in and thank you for your contribution.\nUsually issues are responded to within 48 hours, but depending on the current workload that may be slightly longer.\n\nYou can also find us on slack at [idrinth-api-bench](https://join.slack.com/t/idrinth-api-bench/shared_invite/zt-2f4zmw2sz-c3etHzCFq3LtZpkR15xXMA)."
pr-message: "Thank you for contributing!\nPlease make sure the actions pass. Once your pull request has been merged, you will automatically be added to the contributor's list on the website.\nIf you want to be shouted out on Linkedin, have a look for the [shoutout issue](https://github.com/Idrinth/api-bench/labels/shoutout) of the specific version.\n\nYou can also find us on slack at [idrinth-api-bench](https://join.slack.com/t/idrinth-api-bench/shared_invite/zt-2f4zmw2sz-c3etHzCFq3LtZpkR15xXMA)."
13 changes: 13 additions & 0 deletions .github/workflows/global.label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Labeler
on:
- pull_request_target
jobs:
label:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
15 changes: 15 additions & 0 deletions .github/workflows/global.milestone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Update Milestone
on:
pull_request_target:
types:
- closed
jobs:
update:
runs-on: ubuntu-latest
name: update-milestone
if: ${{github.event.pull_request.merged == true}}
steps:
- uses: idrinth/milestone-set-action@patch-1
name: milestone set
with:
github-token: ${{secrets.GITHUB_TOKEN}}
19 changes: 19 additions & 0 deletions .github/workflows/global.prace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Prace.js
on:
pull_request:
branches:
- the-one
types:
- opened
- edited
- reopened

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: innerspacetrainings/Prace.js@master
with:
configuration-path: .github/prace.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/global.pull-request-size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: pull request size
on:
pull_request:
branches:
- the-one
env:
CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.CURRENT_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.CURRENT_NODE_VERSION }}
cache: 'npm'
cache-dependency-path: |
framework/package-lock.json
documentation-website/package-lock.json
history-microservice/package-lock.json
history-website/package-lock.json
cli/package-lock.json
package-lock.json
- run: npm install -g "https://github.com/Idrinth/check-pr-length.git#patch-1"
- run: git remote add base https://github.com/idrinth/api-bench.git
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "PRS"
- run: git fetch base the-one
- run: git switch the-one
- run: git remote add pullrequest "https://github.com/${{github.event.pull_request.head.repo.full_name}}"
- run: git fetch pullrequest "${GITHUB_HEAD_REF}"
- run: git switch $GITHUB_HEAD_REF
- run: check-pr-length --max=350 --total=500 --base=the-one --silent=false --exclude="package-lock.json;*/package-lock.json"
27 changes: 27 additions & 0 deletions .github/workflows/global.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
on:
milestone:
types:
- closed
env:
CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.CURRENT_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.CURRENT_NODE_VERSION }}
cache: 'npm'
cache-dependency-path: |
framework/package-lock.json
documentation-website/package-lock.json
history-microservice/package-lock.json
history-website/package-lock.json
cli/package-lock.json
package-lock.json
- run: echo "VERSION_TO_PUBLISH=$(jq --raw-output .milestone.title $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
- run: npm run setup
- run: npm run publish
41 changes: 41 additions & 0 deletions .github/workflows/global.spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Spellcheck
on:
push:
branches:
- the-one
paths:
- '**.md'
- 'package-lock.json'
- '.github/workflows/spellcheck.yml'
pull_request:
branches:
- the-one
paths:
- '**.md'
- 'package-lock.json'
- '.github/workflows/spellcheck.yml'
env:
CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }}
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js environment ${{ env.CURRENT_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.CURRENT_NODE_VERSION }}
cache: 'npm'
cache-dependency-path: |
framework/package-lock.json
documentation-website/package-lock.json
history-microservice/package-lock.json
history-website/package-lock.json
cli/package-lock.json
package-lock.json
- name: Build root
run: npm ci
- name: spellcheck
run: npm run spellcheck
Loading

0 comments on commit 75f763a

Please sign in to comment.