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

Adding frontend checks to build and CI #127

Merged
merged 2 commits into from
Aug 11, 2020
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
18 changes: 15 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2.1
jobs:
build:
build_python:
docker:
- image: circleci/python:3.7.3
steps:
Expand All @@ -14,7 +14,18 @@ jobs:
. venv/bin/activate
pip install --requirement requirements.txt
pip install --requirement dev_requirements.txt
./run_build
./dev-scripts/build-python
format_frontend:
docker:
- image: circleci/node:13.2.0-stretch
steps:
- checkout
- run:
name: Install prettier globally
command: npm install prettier@2.0.5
- run:
name: Check frontend formatting
command: ./dev-scripts/check-frontend-format
e2e:
machine:
# A Debian image would be better, as it matches Raspberry Pi OS more
Expand All @@ -33,5 +44,6 @@ jobs:
workflows:
test:
jobs:
- build
- build_python
- format_frontend
- e2e
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ venv/
*~
*.sw?

# Node
node_modules
package-lock.json

# Mac OS
*.DS_Store
*.xcworkspace
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app/static/third-party
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,21 @@ After running these commands, you should be able to access TinyPilot through a w

## Developer installation

If you're interesting in contributing to TinyPilot, follow these instructions to install the required developer packages in your development environment:
If you're interested in contributing to TinyPilot, follow these instructions to install the required developer packages in your development environment:

```bash
python3.7 -m venv venv
. venv/bin/activate
pip install --requirement requirements.txt
pip install --requirement dev_requirements.txt
hooks/enable_hooks

npm install prettier@2.0.5
```

To run TinyPilot's build scripts, run:

```bash
./run_build
./dev-scripts/build
```

To enable TinyPilot's Git hooks, run:
Expand Down
13 changes: 13 additions & 0 deletions dev-scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Exit build script on first failure.
set -e

# Echo commands to stdout.
set -x

# Exit on unset variable.
set -u

./dev-scripts/build-python
./dev-scripts/check-frontend-format
File renamed without changes.
12 changes: 12 additions & 0 deletions dev-scripts/check-frontend-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Exit build script on first failure.
set -e

# Echo commands to stdout.
set -x

# Exit on unset variable.
set -u

./node_modules/.bin/prettier --check app/static
11 changes: 9 additions & 2 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

set -xue
# Exit build script on first failure.
set -e

./run_build
# Echo commands to stdout.
set -x

# Exit on unset variable.
set -u

./dev-scripts/build