Skip to content

Commit

Permalink
Merge pull request #139 from wasedatime/release/migrate_cdk_v2
Browse files Browse the repository at this point in the history
chore(release): 2.0.0
  • Loading branch information
AustinZhu authored Feb 23, 2022
2 parents 4a7d796 + b7644f8 commit 9eae7ed
Show file tree
Hide file tree
Showing 65 changed files with 6,011 additions and 5,574 deletions.
2 changes: 2 additions & 0 deletions .commitlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- "@commitlint/config-conventional"
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.cdk.staging
cdk.out
152 changes: 152 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
env:
jest: true
node: true
root: true
plugins:
- "@typescript-eslint"
- import
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: 2018
sourceType: module
project: "./tsconfig.json"
extends:
- "eslint:recommended"
- "plugin:@typescript-eslint/eslint-recommended"
- "plugin:@typescript-eslint/recommended"
- "plugin:import/typescript"
settings:
import/parsers:
"@typescript-eslint/parser":
- ".ts"
- ".tsx"
import/resolver:
node: { }
typescript:
project: "./tsconfig.json"
alwaysTryTypes: true
ignorePatterns:
- "*.js"
- "!.projenrc.js"
- "*.d.ts"
- node_modules/
- "*.generated.ts"
- coverage
rules:
indent:
- 'off'
"@typescript-eslint/indent":
- error
- 2
quotes:
- error
- single
- avoidEscape: true
comma-dangle:
- error
- always-multiline
comma-spacing:
- error
- before: false
after: true
no-multi-spaces:
- error
- ignoreEOLComments: false
array-bracket-spacing:
- error
- never
array-bracket-newline:
- error
- consistent
object-curly-spacing:
- error
- always
object-curly-newline:
- error
- multiline: true
consistent: true
object-property-newline:
- error
- allowAllPropertiesOnSameLine: true
keyword-spacing:
- error
brace-style:
- error
- 1tbs
- allowSingleLine: true
space-before-blocks:
- error
curly:
- error
- multi-line
- consistent
"@typescript-eslint/member-delimiter-style":
- error
semi:
- error
- always
max-len:
- error
- code: 150
ignoreUrls: true
ignoreStrings: true
ignoreTemplateLiterals: true
ignoreComments: true
ignoreRegExpLiterals: true
quote-props:
- error
- consistent-as-needed
"@typescript-eslint/no-require-imports":
- error
import/no-extraneous-dependencies:
- error
- devDependencies:
- "**/test/**"
- "**/build-tools/**"
optionalDependencies: false
peerDependencies: true
import/no-unresolved:
- error
import/order:
- warn
- groups:
- builtin
- external
alphabetize:
order: asc
caseInsensitive: true
no-duplicate-imports:
- error
no-shadow:
- 'off'
"@typescript-eslint/no-shadow":
- error
key-spacing:
- error
no-multiple-empty-lines:
- error
"@typescript-eslint/no-floating-promises":
- error
no-return-await:
- 'off'
"@typescript-eslint/return-await":
- error
no-trailing-spaces:
- error
dot-notation:
- error
no-bitwise:
- error
"@typescript-eslint/member-ordering":
- error
- default:
- public-static-field
- public-static-method
- protected-static-field
- protected-static-method
- private-static-field
- private-static-method
- field
- constructor
- method
21 changes: 21 additions & 0 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Install Dependencies'
description: 'Workflow for installing dependencies'
runs:
using: "composite"
steps:
- uses: pnpm/[email protected]
with:
version: latest
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'pnpm'
- name: Setup CDK
shell: bash
run: |
pnpm install -g aws-cdk
pnpm install
- name: Diagnose
shell: bash
run: cdk doctor
22 changes: 4 additions & 18 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/[email protected]
with:
node-version: 16.x

- name: Configure pnpm
run: npm install -g pnpm

- uses: Fooji/create-aws-profile-action@v2
- uses: ./.github/actions/install-deps
- name: Setup AWS
uses: Fooji/create-aws-profile-action@v2
with:
profile: default
region: ${{ env.AWS_REGION }}
key: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Setup CDK
run: |
pnpm install -g aws-cdk
pnpm install
- name: Deploy dev
if: github.event.release.prerelease == true
env:
Expand All @@ -69,21 +58,18 @@ jobs:
with:
repository: wasedatime/wasedatime.github.io
token: ${{ env.GITHUB_OAUTH_TOKEN }}

- name: Setup
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
- name: Export
run: |
cd ./openapi
aws apigateway get-export --rest-api-id 'anvonkl0fd' --stage-name 'dev' --export-type 'swagger' --accepts 'application/yaml' ./dev.yml
aws apigateway get-export --rest-api-id 'anvonkl0fd' --stage-name 'prod' --export-type 'swagger' --accepts 'application/yaml' ./prod.yml
- name: Push
uses: EndBug/add-and-commit@v8
uses: EndBug/add-and-commit@v7
with:
author_name: GitHub Actions
author_email: [email protected]
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PR Lint
on:
pull_request_target:
types:
- labeled
- opened
- synchronize
- reopened
- ready_for_review
- edited
jobs:
validate:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |-
feat
fix
chore
requireScope: false
82 changes: 46 additions & 36 deletions .github/workflows/cdk.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths:
- "**.ts"
- "src/**"
- ".github/workflows/cdk.yml"
- ".github/workflows/pr.yml"
- "**.json"
- "**.yaml"

Expand All @@ -32,64 +32,74 @@ env:
STAGE: dev

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-deps
- name: Lint
run: pnpm run lint

- uses: actions/[email protected]
with:
node-version: 16.x

- name: Configure pnpm
run: npm install -g pnpm

- name: Install
run: pnpm install
synth:
runs-on: ubuntu-latest
needs: [ lint ]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-deps
- name: Synth
run: cdk synth

test:
runs-on: ubuntu-latest
needs: [ synth ]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-deps
- name: Test
run: pnpm test

- name: Build
run: pnpm run build

verify:
validate:
runs-on: ubuntu-latest
needs: [ build ]
needs: [ test ]
steps:
- uses: actions/checkout@v2

- uses: actions/[email protected]
with:
node-version: 16.x

- name: Configure pnpm
run: npm install -g pnpm

- name: Setup CDK
run: |
pnpm install -g aws-cdk
pnpm install
- name: Diagnose
run: pnpm run cdk doctor

- uses: ./.github/actions/install-deps
- name: Diff
id: diff
run: |
echo "::add-mask::$DEPLOY_KEY"
echo "::add-mask::$BIT_TOKEN"
LOG="$(cdk diff --no-color 2>&1)"
cdk diff --no-color 2>&1 | tee /tmp/diff.log
LOG="$(cat /tmp/diff.log)"
LOG="${LOG//'%'/'%25'}"
LOG="${LOG//$'\n'/'%0A'}"
LOG="${LOG//$'\r'/'%0D'}"
echo "::set-output name=log::$LOG"
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: "### Diff Output:"
- name: Comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
### Diff Output:
```
${{ steps.diff.outputs.log }}
```
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update Comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
### Diff Output:
```
${{ steps.diff.outputs.log }}
```
token: ${{ env.GITHUB_OAUTH_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 9eae7ed

Please sign in to comment.