-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate cdk and setup tools (#134)
* Update renovate.json * chore(deps): update deps (#117) * chore(deps): update dependency ts-jest to v27.1.2 (#115) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update dependency @types/node to v16.11.14 * chore(deps): update dependency typescript to v4.5.4 * chore(deps): update dependency jest to v27.4.5 (#112) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update dependency @types/node to v16.11.16 (#116) Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <[email protected]> * chore: update comment in ci * chore: update workflow Signed-off-by: AustinZhu <[email protected]> * chore: add eslint, husky and commitlint Signed-off-by: AustinZhu <[email protected]> * feat: refactor configs Signed-off-by: AustinZhu <[email protected]> * feat: migrate to cdk v2 Signed-off-by: AustinZhu <[email protected]> * feat: migrate to cdk v2 Signed-off-by: AustinZhu <[email protected]> * fix: add type def for pluralize Signed-off-by: AustinZhu <[email protected]> * fix: remove redundant definition Signed-off-by: AustinZhu <[email protected]> * chore(eslint): add ignored path Signed-off-by: AustinZhu <[email protected]> * chore(ci): use cdk action Signed-off-by: AustinZhu <[email protected]> * fix: enable debug log Signed-off-by: AustinZhu <[email protected]> * fix: debug diff Signed-off-by: AustinZhu <[email protected]> * chore: update workflow Signed-off-by: AustinZhu <[email protected]> * chore: add pr lint job Signed-off-by: AustinZhu <[email protected]> * fix(lint): reformat code Signed-off-by: AustinZhu <[email protected]> * fix(lint): reformat code Signed-off-by: AustinZhu <[email protected]> * fix: update tsconfig Signed-off-by: AustinZhu <[email protected]> * fix: update tsconfig Signed-off-by: AustinZhu <[email protected]> * fix: update jest config Signed-off-by: AustinZhu <[email protected]> * fix: update jest config Signed-off-by: AustinZhu <[email protected]> * chore(ci): fix workflow Signed-off-by: AustinZhu <[email protected]> * chore(coverage): setup codecov Signed-off-by: AustinZhu <[email protected]> * chore(release): 2.0.0-alpha.0 * chore(readme): add badges Signed-off-by: AustinZhu <[email protected]> * chore(ci): fix path Signed-off-by: AustinZhu <[email protected]> * feat(apigw): define types Signed-off-by: AustinZhu <[email protected]> * chore: bootstrap stack Signed-off-by: AustinZhu <[email protected]> * chore: bootstrap stack Signed-off-by: AustinZhu <[email protected]> * chore: set only allow pnpm Signed-off-by: AustinZhu <[email protected]> * chore(release): 2.0.0-alpha.1 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <[email protected]>
- Loading branch information
1 parent
d6c4753
commit 6072829
Showing
66 changed files
with
6,122 additions
and
5,710 deletions.
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,2 @@ | ||
extends: | ||
- "@commitlint/config-conventional" |
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,3 @@ | ||
node_modules | ||
.cdk.staging | ||
cdk.out |
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,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 |
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,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 |
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 |
---|---|---|
|
@@ -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: | ||
|
@@ -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] | ||
|
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,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 |
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
paths: | ||
- "**.ts" | ||
- "src/**" | ||
- ".github/workflows/cdk.yml" | ||
- ".github/workflows/pr.yml" | ||
- "**.json" | ||
- "**.yaml" | ||
|
||
|
@@ -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 }} |
Oops, something went wrong.