-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
341 changed files
with
38,220 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# /node_modules/* in the project root is ignored by default | ||
# build artefacts | ||
dist/* | ||
coverage/* | ||
node_modules/* | ||
logs/* | ||
prod/* | ||
.husky/* | ||
.github/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint/eslint-plugin"], | ||
"extends": [ | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"root": true, | ||
"env": { | ||
"node": true, | ||
"jest": true | ||
}, | ||
"rules": { | ||
"@typescript-eslint/interface-name-prefix": "off", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-explicit-any": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
time: "01:00" | ||
open-pull-requests-limit: 10 | ||
commit-message: | ||
prefix: "npm" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
time: "01:00" | ||
open-pull-requests-limit: 5 | ||
commit-message: | ||
prefix: "github-action" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: CD | ||
|
||
on: | ||
# workflow_run: | ||
# workflows: ['CI'] | ||
# types: | ||
# - completed | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
APP_NAME: ack-nestjs-boilerplate-mongoose | ||
APP_PORT: 3000 | ||
APP_NETWORK: app-network | ||
|
||
steps: | ||
|
||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get commit | ||
id: git | ||
run: | | ||
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" | ||
- name: Get latest version | ||
id: version | ||
uses: martinbeentjes/npm-get-version-action@main | ||
|
||
- name: Git | ||
run: | | ||
echo Branch name is: ${{ github.ref_name }} | ||
echo Short sha: ${{ steps.git.outputs.short_sha}} | ||
echo Version is: ${{ steps.version.outputs.current-version}} | ||
- name: Environment | ||
run: | | ||
echo APP_NAME is: ${{ env.APP_NAME}} | ||
echo APP_PORT is: ${{ env.APP_PORT}} | ||
echo APP_NETWORK is: ${{ env.APP_NETWORK}} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Deploy | ||
uses: fifsky/ssh-action@master | ||
with: | ||
command: | | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME}}:${{ steps.git.outputs.short_sha }} | ||
docker stop ${{ env.APP_NAME}} && docker rm ${{ env.APP_NAME}} | ||
docker network create ${{ env.APP_NETWORK }} --driver=bridge | ||
docker run -itd \ | ||
--hostname ${{ env.APP_NAME}} \ | ||
--publish ${{ env.APP_PORT }}:${{ env.APP_PORT }} \ | ||
--network ${{ env.APP_NETWORK }} \ | ||
--volume /app/${{ env.APP_NAME}}/logs/:/app/logs/ \ | ||
--volume /app/${{ env.APP_NAME}}/.env:/app/.env \ | ||
--restart unless-stopped \ | ||
--name ${{ env.APP_NAME}} ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME}}:v${{ steps.version.outputs.current-version}} | ||
host: ${{ secrets.SSH_HOST }} | ||
port: ${{ secrets.SSH_PORT }} | ||
user: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY}} | ||
|
||
- name: Clean | ||
uses: fifsky/ssh-action@master | ||
continue-on-error: true | ||
with: | ||
command: | | ||
docker container prune --force | ||
docker image prune --force | ||
docker rmi $(docker images **/${{ secrets.APP_NAME }} -q) --force | ||
host: ${{ secrets.SSH_HOST }} | ||
port: ${{ secrets.SSH_PORT }} | ||
user: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
APP_NAME: ack-nestjs-boilerplate-mongoose | ||
DOCKERFILE: ./prod/dockerfile | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get commit | ||
id: git | ||
run: | | ||
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" | ||
- name: Get latest version | ||
id: version | ||
uses: martinbeentjes/npm-get-version-action@main | ||
|
||
- name: Git | ||
run: | | ||
echo Branch name is: ${{ github.ref_name }} | ||
echo Short sha: ${{ steps.git.outputs.short_sha}} | ||
echo Version is: ${{ steps.version.outputs.current-version}} | ||
- name: Environment | ||
run: | | ||
echo APP_NAME is: ${{ env.APP_NAME}} | ||
echo DOCKERFILE is: ${{ env.DOCKERFILE}} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- uses: docker/setup-buildx-action@v2 | ||
id: builder | ||
|
||
- uses: docker/setup-buildx-action@v2 | ||
id: main | ||
|
||
- name: Builder name | ||
run: echo ${{ steps.builder.outputs.name }} | ||
|
||
- name: Main builder name | ||
run: echo ${{ steps.main.outputs.name }} | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build against builder | ||
uses: docker/build-push-action@v3 | ||
with: | ||
builder: ${{ steps.builder.outputs.name }} | ||
file: ${{ env.DOCKERFILE }} | ||
target: builder | ||
|
||
- name: Build against main and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
builder: ${{ steps.main.outputs.name }} | ||
file: ${{ env.DOCKERFILE }} | ||
target: main | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}:latest | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}:v${{ steps.version.outputs.current-version}} | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}:v${{ steps.version.outputs.current-version}}_sha-${{ steps.git.outputs.short_sha }} | ||
push: true | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Greetings | ||
on: [pull_request, 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: 'Thank you for opening your first issue here! Please be patient until your request is processed 🚀' | ||
pr-message: 'Thank you for opening this pull request! Please be patient until your changes are reviewed 💌' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Linter | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
linter: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: ['17.x'] | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Git sort sha | ||
run: echo ${{ steps.vars.outputs.sha_short }} | ||
|
||
- name: Setup node version ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Linter | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_run: | ||
workflows: ['CI'] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get commit | ||
id: git | ||
run: | | ||
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" | ||
- name: Get latest version | ||
id: version | ||
uses: martinbeentjes/npm-get-version-action@main | ||
|
||
- name: Git | ||
run: | | ||
echo Branch name is: ${{ github.ref_name }} | ||
echo Short sha: ${{ steps.git.outputs.short_sha}} | ||
echo Version is: ${{ steps.version.outputs.current-version}} | ||
- name: Release | ||
uses: softprops/action-gh-release@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.version.outputs.current-version}} | ||
name: v${{ steps.version.outputs.current-version}} | ||
generate_release_notes: true | ||
draft: false | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Close inactive issues | ||
on: | ||
schedule: | ||
- cron: '30 1 * * *' | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/stale@v5 | ||
with: | ||
days-before-issue-stale: 14 | ||
days-before-issue-close: 7 | ||
stale-issue-label: "stale" | ||
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." | ||
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." | ||
days-before-pr-stale: -1 | ||
days-before-pr-close: -1 | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Test | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
environment: baibay | ||
|
||
strategy: | ||
matrix: | ||
node-version: ['17.x'] | ||
|
||
services: | ||
mongodb: | ||
image: mongo:latest | ||
options: >- | ||
--health-cmd mongo | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 27017:27017 | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node version ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Migration | ||
run: yarn migrate | ||
|
||
- name: Create env file | ||
run: | | ||
touch .env | ||
echo AWS_CREDENTIAL_KEY="$AWS_CREDENTIAL_KEY" >> .env | ||
echo AWS_CREDENTIAL_SECRET="$AWS_CREDENTIAL_SECRET" >> .env | ||
echo AWS_S3_BUCKET="$AWS_S3_BUCKET" >> .env | ||
echo AWS_S3_REGION="$AWS_S3_REGION" >> .env | ||
env: | ||
AWS_CREDENTIAL_KEY: ${{ secrets.AWS_CREDENTIAL_KEY }} | ||
AWS_CREDENTIAL_SECRET: ${{ secrets.AWS_CREDENTIAL_SECRET }} | ||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | ||
AWS_S3_REGION: ${{ secrets.AWS_S3_REGION }} | ||
|
||
- name: Unit Test | ||
run: yarn test:unit | ||
|
||
- name: Unit Integration | ||
run: yarn test:integration | ||
|
||
- name: E2E Test | ||
run: yarn test:e2e |
Oops, something went wrong.