Skip to content

Commit

Permalink
Version 1.0 πŸ’œπŸš€
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipPyrek committed Dec 2, 2020
1 parent 150a95d commit cde16b0
Show file tree
Hide file tree
Showing 118 changed files with 75,467 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .circleci/aws_assume_role.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
unset AWS_SESSION_TOKEN

temp_role=$(aws sts assume-role --role-arn "ROLE_ARN_HERE" --role-session-name "purple-stack-deployment")

export AWS_ACCESS_KEY_ID=$(echo $temp_role | jq .Credentials.AccessKeyId | xargs)
export AWS_SECRET_ACCESS_KEY=$(echo $temp_role | jq .Credentials.SecretAccessKey | xargs)
export AWS_SESSION_TOKEN=$(echo $temp_role | jq .Credentials.SessionToken | xargs)
256 changes: 256 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
version: 2.1

orbs:
aws-cli: circleci/[email protected]

references:
general:
context: &context
pt-serverless
image: &image
circleci/node:12.16.1

commands:
assume_aws_role: &commands_assume_aws_role
name: Assume AWS Role
command: cat .circleci/aws_assume_role.sh >> $BASH_ENV
npm_auth: &commands_npm_auth
name: NPM Auth
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
install_dependencies: &install_dependencies
name: Install Dependencies
command: |
n=0
until [ "$n" -ge 3 ]
do
npm ci && exit 0
n=$((n+1))
npx lerna clean -y && rm -rf node_modules
done
exit 1
prod_branch_filter: &prod_branch_filter
branches:
only:
- master

staging_branch_filter: &staging_branch_filter
branches:
only:
- staging

test_branch_filter: &test_branch_filter
branches:
only:
- /dependabot\/.*/
- /feature\/.*/
- /hotfix\/.*/
- /fix\/.*/
- /h\/.*/
- /f\/.*/

feature_branch_filter: &feature_branch_filter
branches:
only:
- /feature\/.*/
- /hotfix\/.*/
- /fix\/.*/
- /h\/.*/
- /f\/.*/

jobs:
test:
docker:
- image: *image
steps:
- checkout
- run: *commands_npm_auth
- aws-cli/install
- run: *commands_assume_aws_role
- run: *install_dependencies
- run:
name: Run Linter
command: npm run lint
- run:
name: Graphql CodeGen check
command: npm run graphql-codegen && git diff --quiet && git diff-index --exit-code HEAD -- packages/graphql-types
- run:
name: Run Tests
command: npm run ci:test

compilation_check:
docker:
- image: *image
steps:
- checkout
- run: *commands_npm_auth
- run: *install_dependencies
- aws-cli/install
- run: *commands_assume_aws_role
- run:
name: Compilation Check
command: npm run ci:compilation-check

deploy:
docker:
- image: *image
steps:
- checkout
- run: *commands_npm_auth
- run: *install_dependencies
- aws-cli/install
- run: *commands_assume_aws_role
- run:
name: Package
command: npm run ci:package
- deploy:
name: Deploy
command: npm run ci:deploy
- deploy:
name: Invalidate Frontend Cache
command: "aws cloudfront create-invalidation --paths '/*' --distribution-id=$(npx lerna --scope='frontend' run ci:info | awk '/CloudFrontDistributionId: ([A-Z0-9]*)/{print $2}') || true"

smart_deploy:
docker:
- image: *image
steps:
- checkout
- run: *commands_npm_auth
- run: *install_dependencies
- aws-cli/install
- run: *commands_assume_aws_role
- run:
name: Smart Package
command: npm run smart:ci:package
- deploy:
name: Smart Deploy
command: npm run smart:ci:deploy
- deploy:
name: Invalidate Frontend Cache
command: "aws cloudfront create-invalidation --paths '/*' --distribution-id=$(npx lerna --scope='frontend' run ci:info | awk '/CloudFrontDistributionId: ([A-Z0-9]*)/{print $2}') || true"

remove:
docker:
- image: *image
steps:
- checkout
- run: *commands_npm_auth
- run: *install_dependencies
- aws-cli/install
- run: *commands_assume_aws_role
- deploy:
name: Remove
command: npm run ci:remove

smart_remove:
docker:
- image: *image
steps:
- checkout
- run: *commands_npm_auth
- run: *install_dependencies
- aws-cli/install
- run: *commands_assume_aws_role
- deploy:
name: Remove
command: npm run ci:remove && npm run delete-tag

workflows:
version: 2

test:
jobs:
- test:
context: *context
filters: *test_branch_filter
- compilation_check:
context: *context
filters: *test_branch_filter

deploy_prod:
jobs:
- approve_deploy:
type: approval
filters: *prod_branch_filter
- deploy:
requires:
- approve_deploy
context: *context
filters: *prod_branch_filter

deploy_staging:
jobs:
- approve_deploy:
type: approval
filters: *staging_branch_filter
- deploy:
requires:
- approve_deploy
context: *context
filters: *staging_branch_filter

deploy_feature:
jobs:
- approve_deploy:
type: approval
filters: *feature_branch_filter
- deploy:
requires:
- approve_deploy
context: *context
filters: *feature_branch_filter

smart_deploy_prod:
jobs:
- approve_smart_deploy:
type: approval
filters: *prod_branch_filter
- smart_deploy:
requires:
- approve_smart_deploy
context: *context
filters: *prod_branch_filter

smart_deploy_staging:
jobs:
- approve_smart_deploy:
type: approval
filters: *staging_branch_filter
- smart_deploy:
requires:
- approve_smart_deploy
context: *context
filters: *staging_branch_filter

smart_deploy_feature:
jobs:
- approve_smart_deploy:
type: approval
filters: *feature_branch_filter
- smart_deploy:
requires:
- approve_smart_deploy
context: *context
filters: *feature_branch_filter

remove_feature:
jobs:
- approve_remove:
type: approval
filters: *feature_branch_filter
- remove:
requires:
- approve_remove
context: *context
filters: *feature_branch_filter

smart_remove_feature:
jobs:
- approve_smart_remove:
type: approval
filters: *feature_branch_filter
- smart_remove:
requires:
- approve_smart_remove
context: *context
filters: *feature_branch_filter
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,jsx,json,ts,tsx,pug}]
charset = utf-8
indent_style = tab
indent_size=2
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
coverage
.serverless
.webpack
frontend/.next
frontend/.scripts
frontend/out

package-lock.json
*/**/locales/**/*.json
47 changes: 47 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier",
"simple-import-sort",
"react-hooks"
],
"rules": {
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": "allow-with-description",
"ts-ignore": "allow-with-description",
"ts-nocheck": true,
"ts-check": false
}
],
"@typescript-eslint/ban-types": ["off"],
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-explicit-any": ["warn"],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-use-before-define": ["warn"],
"@typescript-eslint/prefer-optional-chain": "error",
"prettier/prettier": "error",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
"react/prop-types": ["off"],
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error"
},
"settings": {
"react": {
"version": "detect"
}
}
}
23 changes: 23 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Description

< Some description of what changes are included in this PR >

## Tasks

### Major Changes
- :rocket: < Name of the task > [WT-XXX](link_to_the_task)

### Bug Fixes
- :ambulance: < Name of the task > [WT-XXX](link_to_the_task)

### Minor Tweaks
- :lipstick: < Name of the task > [WT-XXX](link_to_the_task)

## Pull request checklist

### For feature development:
- [ ] Have you tested your code?
- [ ] Did you commit only code related to your feature?
- [ ] Are you sure you did not break any other feature?
- [ ] Have you checked your PR before you assigned it to reviewer(s)?
- [ ] Are you sure your feature does not contain any hacks?
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
node_modules
.next
out/

# Coverage directory used by jest
coverage

# Serverless
.serverless

# environment configuration file
.env

# Webpack directories
.webpack

#Lerna debug info
lerna-debug.log

# appsync offline
.dynamodb

# VS code
.vscode/launch.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.16.1
1 change: 1 addition & 0 deletions .prettierignore
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"useTabs": true,
"trailingComma": "none"
}
Loading

0 comments on commit cde16b0

Please sign in to comment.