Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out static checks for TypeScript/Next.js portion of the app #23

Merged
merged 15 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules/**
**/.next/**
tsconfig.json
*.min.js
9 changes: 9 additions & 0 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ jobs:
source $(poetry env info --path)/bin/activate
poetry install --with docs,test
coverage run -m pytest florist/tests/integration && coverage xml && coverage report -m

# TODO enable this once we have intergation tests for the UI
# - name: Setup yarn
# uses: mskelton/setup-yarn@v1
# - name: Install nextjs dependencies and check code
# run: |
# yarn
# yarn integration-test

# - name: Upload coverage to Codecov
# uses: Wandalen/[email protected]
# with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/static_code_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ jobs:
with:
python-version: '3.9'
cache: 'poetry'
- name: Setup yarn
uses: mskelton/setup-yarn@v1
- name: Install dependencies and check code
run: |
yarn
poetry env use '3.9'
source .venv/bin/activate
poetry install --with test --all-extras
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@ jobs:
- uses: actions/[email protected]
with:
python-version: '3.9'
- name: Install dependencies and check code
cache: 'poetry'
- name: Install python dependencies and check code
run: |
poetry env use '3.9'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test
coverage run -m pytest florist/tests/unit && coverage xml && coverage report -m
- name: Setup yarn
uses: mskelton/setup-yarn@v1
- name: Install nextjs dependencies and check code
run: |
yarn
yarn unit-test
# - name: Upload coverage to Codecov
# uses: Wandalen/[email protected]
# with:
Expand Down
45 changes: 45 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,55 @@ repos:
- id: nbqa-ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: local
hooks:
- id: nextjs-lint
name: nextjs-lint
entry: yarn lint-gh-action florist
files: "florist/app"
language: system

- repo: local
hooks:
- id: prettier-js-format
name: prettier-js-format
entry: yarn prettier
files: "florist/app"
language: system

- repo: local
hooks:
- id: doctest
name: doctest
entry: python3 -m doctest -o NORMALIZE_WHITESPACE
files: "(^florist/api/|florist/tests/api/)"
language: system

- repo: local
hooks:
- id: pytest-unit
name: pytest-unit
entry: python -m pytest florist/tests/unit
language: system
pass_filenames: false
always_run: true

- repo: local
hooks:
- id: nextjs-unit
name: nextjs-unit
entry: yarn unit-test
language: system
pass_filenames: false
always_run: true

ci:
autofix_commit_msg: |
[pre-commit.ci] Add auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: [pytest-unit,nextjs-unit,doctest,mypy,nextjs-lint]
submodules: false
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
florist/app/assets/css/material-dashboard.css
*.min.js
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tabWidth": 4
}
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ using [Homebrew](https://brew.sh/):
brew install yarn
```

Then install the project dependencies:
Then install the project dependencies in development mode:
```shell
yarn
```
Expand All @@ -55,11 +55,16 @@ yarn dev

## Running the tests

To run the unit tests, simply execute:
To run the python unit tests, simply execute:
```shell
pytest florist/tests/unit
```

To run the nextjs unit tests, simply execute:
```shell
yarn unit-test
```

To run the integration tests, first make sure you:
- Have a Redis server running on your local machine on port 6379 by following [these instructions](README.md#start-servers-redis-instance).
- Have a MongoDB server running on your local machine on port 27017 by following [these instructions](README.md#start-mongodbs-instance).
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ using [Homebrew](https://brew.sh/):
brew install yarn
```

Then install the project dependencies:
Then install the project dependencies in production mode:
```shell
yarn
yarn --prod
```

### Pulling Redis' Docker
Expand Down
Loading
Loading