generated from graasp/graasp-app-starter-ts-vite
-
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
0 parents
commit 220f492
Showing
70 changed files
with
17,486 additions
and
0 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,10 @@ | ||
build | ||
public | ||
coverage | ||
|
||
node_modules | ||
.yarn/.cache | ||
.husky | ||
.nyc_output | ||
.yarn | ||
commitlint.config.js |
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,112 @@ | ||
{ | ||
"extends": [ | ||
"airbnb", | ||
"airbnb-typescript", | ||
"plugin:import/typescript", // this is needed because airbnb uses eslint-plugin-import | ||
"prettier", | ||
"plugin:cypress/recommended", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"plugins": ["@typescript-eslint", "prettier", "react-hooks"], | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"mocha": true, | ||
"jest": true | ||
}, | ||
"globals": { | ||
"cy": true, | ||
"Cypress": true | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.eslint.json", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"react/prop-types": "off", | ||
"react/no-array-index-key": "off", | ||
"react/jsx-props-no-spreading": "off", | ||
"react/destructuring-assignment": "off", | ||
"react/require-default-props": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"import/no-import-module-exports": "off", | ||
"no-console": ["error", { "allow": ["error", "warn", "debug", "info"] }], | ||
"import/no-extraneous-dependencies": [ | ||
"error", | ||
{ | ||
"devDependencies": true | ||
} | ||
], | ||
"import/prefer-default-export": "off", | ||
"prettier/prettier": "error", | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"ts": "never", | ||
"js": "never", | ||
"tsx": "never" | ||
} | ||
], | ||
"@typescript-eslint/explicit-function-return-type": [ | ||
"error", | ||
{ | ||
"allowExpressions": true, | ||
"allowHigherOrderFunctions": true, | ||
"allowTypedFunctionExpressions": true | ||
} | ||
], | ||
"@typescript-eslint/no-var-requires": "off", | ||
"global-require": "off", | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "warn", | ||
"comma-dangle": "off", | ||
"@typescript-eslint/comma-dangle": "off", | ||
"react/jsx-one-expression-per-line": "off", | ||
"react/jsx-filename-extension": [ | ||
"warn", | ||
{ | ||
"extensions": [".tsx"] | ||
} | ||
], | ||
"react/function-component-definition": [ | ||
2, | ||
{ | ||
"namedComponents": "arrow-function" | ||
} | ||
], | ||
// eslint rule reports false error | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": ["error"], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
"argsIgnorePattern": "^_", | ||
"varsIgnorePattern": "^_", | ||
"caughtErrorsIgnorePattern": "^_" | ||
} | ||
] | ||
}, | ||
"settings": { | ||
"import/extensions": [".js", ".jsx", ".ts", ".tsx"], | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts", ".tsx"] | ||
}, | ||
"import/resolver": { | ||
"typescript": { | ||
"alwaysTryTypes": true | ||
}, | ||
"node": { | ||
"extensions": [".js", ".jsx", ".ts", ".tsx"] | ||
} | ||
} | ||
} | ||
} |
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: Auto Tag | ||
|
||
on: | ||
issues: | ||
types: | ||
- reopened | ||
- closed | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
auto-tag: | ||
name: Auto tag issues and PRs | ||
uses: graasp/graasp-deploy/.github/workflows/auto-tag.yml@v1 |
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,25 @@ | ||
name: Build and Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
merge_group: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
concurrency: build-${{ github.head_ref || github.ref }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Yarn Install and Cache | ||
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | ||
|
||
- name: Lint | ||
run: yarn check | ||
|
||
- name: Build | ||
run: yarn build |
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,73 @@ | ||
name: Cypress UI tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
merge_group: | ||
pull_request: | ||
|
||
jobs: | ||
cypress-run: | ||
concurrency: cypress-${{ github.head_ref || github.ref }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Yarn Install and Cache | ||
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | ||
with: | ||
cypress: true | ||
|
||
- name: Build App | ||
run: yarn build:test | ||
shell: bash | ||
env: | ||
VITE_PORT: 3000 | ||
VITE_API_HOST: http://localhost:3636 | ||
VITE_GRAASP_APP_KEY: id-1234567890 | ||
VITE_ENABLE_MOCK_API: true | ||
VITE_VERSION: cypress-tests | ||
|
||
- name: Cypress Run | ||
uses: cypress-io/github-action@v5 | ||
env: | ||
VITE_PORT: 3000 | ||
VITE_API_HOST: http://localhost:3636 | ||
VITE_GRAASP_APP_KEY: id-1234567890 | ||
VITE_ENABLE_MOCK_API: true | ||
VITE_VERSION: cypress-tests | ||
with: | ||
install: false | ||
config: baseUrl=http://localhost:3000 | ||
start: yarn preview:test | ||
browser: chrome | ||
quiet: true | ||
# point to new cypress@10 config file | ||
config-file: cypress.config.ts | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
|
||
- name: coverage report | ||
run: npx nyc report --reporter=text-summary | ||
|
||
- name: coverage commit status | ||
run: | | ||
total=$(cat coverage/coverage-summary.json | jq .total.lines.pct) | ||
echo Total coverage ${total} | ||
curl -S -s \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
https://api.github.com/repos/${REPO_PATH}/statuses/${COMMIT_SHA} \ | ||
-d "{\"state\":\"success\",\"target_url\":\"https://github.com/${REPO_PATH}/actions/runs/${RUN_ID}\",\"description\":\"${total}%\",\"context\":\"code-coverage\"}" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
REPO_PATH: ${{ github.repository }} | ||
COMMIT_SHA: ${{ github.sha }} | ||
RUN_ID: ${{ github.run_id }} |
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,48 @@ | ||
name: Deploy to development environment | ||
|
||
# Controls when the action will run | ||
on: | ||
# Triggers the workflow on push events only for the main branch | ||
push: | ||
branches: | ||
- main | ||
|
||
# Allows to run the workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy-app: | ||
name: Deploy to dev | ||
runs-on: ubuntu-latest | ||
environment: development | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Yarn install and Cache dependencies | ||
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | ||
|
||
- name: Yarn build | ||
# Set environment variables required to perform the build. These are only available to this step | ||
env: | ||
VITE_API_HOST: ${{ vars.VITE_API_HOST }} | ||
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }} | ||
VITE_SENTRY_ENV: development | ||
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | ||
VITE_VERSION: ${{ github.sha }} | ||
# add any env variable needed by your app here | ||
run: yarn build | ||
shell: bash | ||
|
||
- name: Deploy | ||
uses: graasp/graasp-deploy/.github/actions/deploy-s3-app@v1 | ||
with: | ||
# Replace input build-folder or version if needed | ||
build-folder: 'build' | ||
graasp-app-id: ${{ secrets.APP_ID }} | ||
version: 'latest' | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} | ||
aws-region: ${{ vars.APPS_AWS_REGION_DEV }} | ||
aws-s3-bucket-name: ${{ vars.AWS_S3_BUCKET_NAME_APPS_DEV }} | ||
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_DEV }} |
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,52 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
# Controls when the action will run | ||
on: | ||
# Triggers the workflow on repository-dispatch event | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: production | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Yarn install and Cache dependencies | ||
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | ||
|
||
- name: Yarn build | ||
# Set environment variables required to perform the build. These are only available to this step | ||
env: | ||
VITE_API_HOST: ${{ vars.VITE_API_HOST }} | ||
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }} | ||
VITE_SENTRY_ENV: production | ||
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | ||
VITE_VERSION: github-${{ github.sha }} | ||
# add any env variable needed by your app here | ||
run: yarn build | ||
shell: bash | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./build | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,46 @@ | ||
name: Deploy to production environment | ||
|
||
# Controls when the action will run | ||
on: | ||
# Triggers the workflow on repository-dispatch event | ||
repository_dispatch: | ||
types: [production-deployment] | ||
|
||
jobs: | ||
deploy-app: | ||
name: Deploy to production | ||
runs-on: ubuntu-latest | ||
environment: production | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.client_payload.tag }} | ||
|
||
- name: Yarn install and Cache dependencies | ||
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | ||
|
||
- name: Yarn build | ||
# Set environment variables required to perform the build. These are only available to this step | ||
env: | ||
VITE_API_HOST: ${{ vars.VITE_API_HOST }} | ||
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }} | ||
VITE_SENTRY_ENV: production | ||
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | ||
VITE_VERSION: ${{ github.event.client_payload.tag }} | ||
# add any env variable needed by your app here | ||
run: yarn build | ||
shell: bash | ||
|
||
- name: Deploy | ||
uses: graasp/graasp-deploy/.github/actions/deploy-s3-app@v1 | ||
with: | ||
# Replace input build-folder or version if needed | ||
build-folder: 'build' | ||
graasp-app-id: ${{ secrets.APP_ID }} | ||
version: 'latest' | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} | ||
aws-region: ${{ vars.APPS_AWS_REGION_PROD }} | ||
aws-s3-bucket-name: ${{ vars.AWS_S3_BUCKET_NAME_APPS_PROD }} | ||
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_PROD }} |
Oops, something went wrong.