Skip to content
Closed
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
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,60 @@ Cadet is the web application powering Source Academy.
4. PostgreSQL (>= 9.6)
5. git (>= 2.13.2)

### Git's `pre-push` hook
We are using following script as a `pre-push` hook.

```bash
#!/bin/sh

echo Running pre-push hooks...

echo mix format
if ! mix format --check-formatted; then
exit 1
fi

echo mix test
if ! mix test; then
exit 1
fi

echo mix credo
if ! mix credo; then
exit 1
fi

exit 0
```

An automated way to install the script is:

```bash
cat > .git/hooks/pre-push <<EOL
#!/bin/sh

echo Running pre-push hooks...

echo mix format
if ! mix format --check-formatted; then
exit 1
fi

echo mix test
if ! mix test; then
exit 1
fi

echo mix credo
if ! mix credo; then
exit 1
fi

exit 0
EOL
chmod +x .git/hooks/pre-push
```

### Setting Up Local Development Environment

Install Elixir dependencies
Expand Down