-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from graasp/29-30-refactor
Refactor: MUI5, Typescript
- Loading branch information
Showing
102 changed files
with
10,486 additions
and
9,971 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 |
---|---|---|
@@ -1,37 +1,91 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"airbnb", | ||
"plugin:cypress/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
"eslint:recommended", | ||
"plugin:react/recommended" | ||
], | ||
"plugins": [ | ||
"react" | ||
], | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"mocha": true, | ||
"jest": true | ||
}, | ||
"globals": { | ||
"cy": true, | ||
"Cypress": true | ||
}, | ||
"parser": "@babel/eslint-parser", | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"requireConfigFile": false, | ||
"babelOptions": { | ||
"presets": ["@babel/preset-react"] | ||
} | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["react", "react-hooks", "@typescript-eslint", "prettier"], | ||
"rules": { | ||
"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", | ||
"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 | ||
} | ||
], | ||
"@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": [ | ||
1, | ||
"warn", | ||
{ | ||
"extensions": [".js", ".jsx"] | ||
"extensions": [".tsx"] | ||
} | ||
], | ||
"react/function-component-definition": [2, { "namedComponents": "arrow-function" }], | ||
"import/no-named-as-default": 0 | ||
"react/function-component-definition": [ | ||
2, | ||
{ | ||
"namedComponents": "arrow-function" | ||
} | ||
], | ||
// eslint rule reports false error | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": ["error"] | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
}, | ||
"import/resolver": { | ||
"typescript": {} | ||
}, | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".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
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
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
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 |
---|---|---|
@@ -1,56 +1,89 @@ | ||
name: cypress tests | ||
on: [push] | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- 'release-please-**' | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: set up node | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '14' | ||
cache: 'yarn' | ||
node-version: '16' | ||
|
||
- name: install yarn | ||
# avoid checksum errors with github packages | ||
run: YARN_CHECKSUM_BEHAVIOR=update yarn | ||
- name: Yarn Install and Cache | ||
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1 | ||
with: | ||
cypress: true | ||
|
||
- name: cypress run | ||
uses: cypress-io/github-action@v2 | ||
uses: cypress-io/github-action@v4 | ||
env: | ||
REACT_APP_API_HOST: http://localhost:3636 | ||
REACT_APP_GRAASP_DOMAIN: localhost | ||
REACT_APP_GRAASP_APP_ID: id-1234567890 | ||
REACT_APP_MOCK_API: true | ||
NODE_ENV: test | ||
with: | ||
install: false | ||
build: yarn build | ||
config: baseUrl=http://localhost:3000 | ||
start: yarn start:ci | ||
wait-on: 'http://localhost:3000' | ||
wait-on-timeout: 180 | ||
browser: chrome | ||
headless: true | ||
quiet: true | ||
# point to new cypress@10 config file | ||
config-file: cypress.config.ts | ||
|
||
# component tests are not running ok in the CI | ||
# - name: Run Component tests 🧪 | ||
# uses: cypress-io/github-action@v4 | ||
# with: | ||
# # we have already installed everything | ||
# install: false | ||
# # to run component tests we need to use "component: true" | ||
# component: true | ||
|
||
# after the test run completes | ||
# store videos and any screenshots | ||
# NOTE: screenshots will be generated only if E2E test failed | ||
# thus we store screenshots only on failures | ||
# Alternative: create and commit an empty cypress/screenshots folder | ||
# to always have something to upload | ||
- uses: actions/upload-artifact@v2 | ||
- uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
# Test run video was always captured, so this action uses "always()" condition | ||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: cypress-videos | ||
path: cypress/videos | ||
|
||
- 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 @@ | ||
# Automate releases of new app versions | ||
name: release-please | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: node | ||
package-name: graasp-app-file-drop | ||
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"test","section":"Tests","hidden":false}]' | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
# creates minor and major tags that follow the latest release | ||
- name: Tag major and minor versions | ||
uses: jacobsvante/tag-major-minor-action@v0.1 | ||
if: ${{ steps.release.outputs.release_created }} | ||
with: | ||
major: ${{ steps.release.outputs.major }} | ||
minor: ${{ steps.release.outputs.minor }} | ||
|
||
# put created tag in an env variable to be sent to the dispatch | ||
- name: Set tag | ||
if: ${{ steps.release.outputs.release_created }} | ||
id: set-tag | ||
run: | | ||
REPOSITORY=$(echo '${{ github.repository }}') | ||
TAG=$(echo '${{ steps.release.outputs.tag_name }}') | ||
JSON=$(jq -c --null-input --arg repository "$REPOSITORY" --arg tag "$TAG" '{"repository": $repository, "tag": $tag}') | ||
echo "json=$JSON" >> $GITHUB_OUTPUT | ||
# Trigger an 'on: repository_dispatch' workflow to run in graasp-deploy repository | ||
- name: Push tag to Graasp Deploy (Staging) | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
repository: graasp/graasp-deploy | ||
event-type: update-staging-version | ||
client-payload: ${{ steps.set-tag.outputs.json }} |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit "$1" | ||
yarn commitlint --edit ${1} |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# skip hook when in CI | ||
[ -n "$CI" ] && exit 0 | ||
|
||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn install |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# skip hook when in CI | ||
[ -n "$CI" ] && exit 0 | ||
|
||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
git status |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# skip hook when in CI | ||
[ -n "$CI" ] && exit 0 | ||
|
||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn pre-commit | ||
yarn pretty-quick --staged && yarn lint && yarn test |
Oops, something went wrong.