Skip to content

Commit

Permalink
chore: initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Frazer Smith committed Apr 28, 2021
1 parent 00d799a commit 1be3232
Show file tree
Hide file tree
Showing 29 changed files with 1,161 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
env: {
es2021: true,
node: true,
},
extends: [
"airbnb-base",
"plugin:promise/recommended",
"plugin:jest/recommended",
"plugin:jsdoc/recommended",
"plugin:security/recommended",
"prettier",
],
parserOptions: {
sourceType: "module",
ecmaFeatures: {
impliedStrict: true,
},
},
plugins: ["import", "jest", "jsdoc", "promise", "security"],
root: true,
rules: {
"import/no-extraneous-dependencies": "error",
"no-console": "off",
"no-multiple-empty-lines": [
"error",
{
max: 1,
},
],
"prefer-destructuring": "off",
"promise/prefer-await-to-callbacks": "warn",
"promise/prefer-await-to-then": "warn",
},
};
20 changes: 20 additions & 0 deletions .github/.typo-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
dictionaries:
- en
- en_GB

# Any files/folders we should ignore?
excluded_files:
- ".github/.typo-ci.yml"
- "node_modules/**/*"
- "package-lock.json"

# Any typos we should ignore?
excluded_words:
- fastify
- fhir
- hl7
- nhs
- ydh

# Would you like filenames to also be spellchecked?
spellcheck_filenames: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
Thank you for your pull request. Please provide a description above and review
the requirements below.
Bug fixes and new features should include tests.
Contributors guide: https://github.com/Fdawgs/fastify-floc-off/blob/master/CONTRIBUTING.md
-->

#### Checklist

- [ ] Run `npm test`
- [ ] Documentation has been updated and adheres to the style described in [CONTRIBUTING.md](https://github.com/Fdawgs/fastify-floc-off/blob/master/CONTRIBUTING.md#documentation-style)
- [ ] Commit message adheres to the [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) style, following the `@commitlint/config-conventional` config
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: ""
---

### Describe the bug

A clear and concise description of what the bug is.

### To Reproduce

Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

### Expected behavior

A clear and concise description of what you expected to happen.

### Screenshots

If applicable, add screenshots to help explain your problem.

### Desktop (please complete the following information)

- OS: [e.g. Windows]
- Version [e.g. Windows 10]
- Node.js Version [e.g. NodeJS v14.8.0]

### Additional context

Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: enhancement
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: github-actions
commit-message:
include: scope
prefix: build
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 25

- package-ecosystem: npm
commit-message:
include: scope
prefix: build
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 25
53 changes: 53 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Automerge Dependabot PRs

on:
workflow_run:
workflows: ["CI"]
types: [completed]

jobs:
on-success:
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/github-script@v3.1.1
with:
script: |
const fs = require('fs');
const artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == 'pr';
})[0];
const download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip
- name: Comment on PR
uses: actions/github-script@v3.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const pull_number = Number(fs.readFileSync('./NR'));
await github.pulls.merge({
merge_method: "merge",
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull_number,
});
36 changes: 36 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CD

on:
push:
branches:
- master
# Allows this workflow to be run manually from the Actions tab
workflow_dispatch:

jobs:
release:
name: Create/Update Release Pull Request
runs-on: ubuntu-latest
steps:
- name: Release Please
id: release
uses: GoogleCloudPlatform/release-please-action@v2.24.1
with:
changelog-types: '[ { "type": "feat", "section": "Features", "hidden": false }, { "type": "fix", "section": "Bug Fixes", "hidden": false }, { "type": "build", "section": "Dependencies", "hidden": false }, { "type": "chore", "section": "Miscellaneous", "hidden": false }, { "type": "ci", "section": "Continuous Integration", "hidden": false }, { "type": "perf", "section": "Performance Improvements", "hidden": false }, { "type": "refactor", "section": "Miscellaneous", "hidden": false }, { "type": "style", "section": "Miscellaneous", "hidden": false }, { "type": "docs", "section": "Documentation", "hidden": false }]'
release-type: node
package-name: fastify-floc-off

- uses: actions/checkout@v2.3.4
if: steps.release.outputs.release_created

- uses: actions/setup-node@v2.1.5
with:
node-version: 16
registry-url: https://registry.npmjs.org/
if: steps.release.outputs.release_created

- name: Publish to NPM
if: steps.release.outputs.release_created
run: npm publish --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
115 changes: 115 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: CI

on:
push:
branches:
- master
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
branches:
- master
paths-ignore:
- "docs/**"
- "*.md"

jobs:
cleanup-runs:
name: Clean-Up Running Instances
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

lint:
name: Lint Code
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v2.1.5
with:
node-version: 16
- name: Install
run: npm install --ignore-scripts
- name: Run ESLint
run: npm run lint
- name: Run Prettier
run: npm run lint:prettier:ci
- name: Run License Checker
run: npm run lint:licenses

commit-lint:
name: Lint Commit Messages
if: >
github.event.pull_request.draft == false &&
github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v3.0.6
with:
configFile: ./package.json

unit-tests:
name: Unit Tests
if: github.event.pull_request.draft == false
strategy:
matrix:
node-version: [12, 14, 16]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.3.4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.5
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install --ignore-scripts
- name: Run Tests
run: npm run jest:coverage
- name: Coveralls Parallel
if: github.repository == 'Fdawgs/fastify-floc-off'
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: run-${{ matrix.node-version }}-${{ matrix.os }}

coverage:
name: Aggregate Coverage Calculations
needs: unit-tests
if: >
github.event.pull_request.draft == false &&
github.repository == 'Fdawgs/fastify-floc-off'
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

# This job is used to save the PR number in an artifact, for use in the automerge.yml workflow
save-pr-number:
name: Save PR Number
if: >
github.event.pull_request.draft == false &&
github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Save PR Number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@v2.2.2
with:
name: pr
path: pr/
33 changes: 33 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CodeQL Analysis

on:
push:
branches:
- master
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
branches:
- master
paths-ignore:
- "docs/**"
- "*.md"

jobs:
CodeQL-Build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2.3.4
# Initialises the CodeQL tools for scanning
- name: Initialise CodeQL
uses: github/codeql-action/init@v1
with:
languages: javascript
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Loading

0 comments on commit 1be3232

Please sign in to comment.