Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrconley committed May 2, 2023
1 parent d7418dc commit f5f1e58
Show file tree
Hide file tree
Showing 89 changed files with 13,591 additions and 23 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
bundle/
*
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* @nRFCloud/backend
/.github/ @nRFCloud/devops @nRFCloud/backend
/**/aws/ @nRFCloud/devops @nRFCloud/backend
10 changes: 10 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Script changes:
- packages/scripts/**/*

Infrastructure changes:
- packages/deployment/**/*
- packages/*/src/aws/**/*

Implementation changes:
- packages/*/src/**/*
- !packages/*/src/aws/**/*
41 changes: 41 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint Code

on:
pull_request:
branches: [main]
types: [opened, synchronize]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
name: Lint Back-end code
runs-on: ubuntu-latest
timeout-minutes: 15

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Prepare
run: pnpm i
- name: Lint Back-end
run: pnpm lint
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
branches:
- main
- release
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Prepare
run: pnpm i --frozen-lockfile
- name: Release
env:
GH_TOKEN: ${{ github.token }}
run: pnpm release
56 changes: 56 additions & 0 deletions .github/workflows/slacknotify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Slack notification

on:
pull_request:
branches: [main]
types: [opened, synchronize, ready_for_review]

env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

jobs:
slackNotification:
name: Send Slack notifications
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: New PR
if: github.event.action == 'opened' && github.event.pull_request.draft == false
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 #v2.2.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
SLACK_TITLE: PR Created
SLACK_LINK_NAMES: true
SLACK_FOOTER: ''
SLACK_MESSAGE: |
@here
nornir
${{ github.event.pull_request.title }}
https://github.com/nRFCloud/nornir/pull/${{ github.event.number }}
- name: PR Ready for Review
if: github.event.action == 'ready_for_review' && github.event.pull_request.draft == false
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 #v2.2.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
SLACK_TITLE: PR Ready for Review
SLACK_LINK_NAMES: true
SLACK_FOOTER: ''
SLACK_MESSAGE: |
@here
nornir
${{ github.event.pull_request.title }}
https://github.com/nRFCloud/nornir/pull/${{ github.event.number }}
- name: Updated PR
if: github.event.action == 'synchronize' && github.event.pull_request.draft == false
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 #v2.2.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
SLACK_TITLE: PR Updated
SLACK_FOOTER: ''
SLACK_MESSAGE: |
nornir
${{ github.event.pull_request.title }}
https://github.com/nRFCloud/nornir/pull/${{ github.event.number }}
17 changes: 17 additions & 0 deletions .github/workflows/stop-no-merge-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Block merging PRs with 'no-merge' label

on:
pull_request:
types: [synchronize, opened, reopened, labeled, unlabeled]

jobs:
no-merge:
if: ${{ contains(github.event.*.labels.*.name, 'no-merge') }}
name: Block merging PRs with no-merge label
runs-on: ubuntu-latest
steps:
- name: Fail due to existing label
run: |
echo "Pull request is labeled as 'no-merge'."
echo "This workflow fails so that the pull request cannot be merged."
exit 1
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Unit Tests
on:
pull_request:
branches: [main]
types: [opened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
unit-tests:
name: Run unit tests for this service
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- name: Prepare
run: pnpm i
- name: Build
run: pnpm build
- name: Run unit tests
run: pnpm test
- name: Publish coverage
if: always()
uses: ArtiomTr/jest-coverage-report-action@v2
with:
coverage-file: reports/report.json
base-coverage-file: reports/report.json
- name: Publish report
if: always()
uses: dorny/test-reporter@v1
with:
name: Unit Tests
path: reports/junit.xml
reporter: jest-junit
fail-on-error: false
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ node_modules
.idea
yarn-error.log
bundle
.turbo
reports
coverage
.eslintcache
report.json
.tsbuildinfo
cdk.out
.env
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint
32 changes: 32 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"branches": [
{
"name": "main",
"channel": "dev",
"prerelease": "dev"
},
"release"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
["@semantic-release/npm", {
"tarballDir": "zipped"
}],
[
"@semantic-release/github",
{
"successComment": false,
"addReleases": "bottom",
"failTitle": false,
"assets": [
{
"path": "zipped/*.tgz",
"label": "Download"
}
]
}
]
]
}
7 changes: 7 additions & 0 deletions .syncpackrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyTypes:
- dev
- overrides
- peer
- pnpmOverrides
- prod
- resolutions
Loading

0 comments on commit f5f1e58

Please sign in to comment.