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

Add pre-commit GitHub workflow, add "Getting started" docs #8

Merged
merged 7 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ USER $USER
ENV PATH "$PATH:/home/$USER/.local/bin"

RUN python -m pip install --upgrade pip && \
pip install pre-commit
pip install black flake8 pre-commit

# enter src directory
WORKDIR /home/$USER/src
Expand Down
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 127
15 changes: 15 additions & 0 deletions .github/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Pre-commit checks

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ repos:
args: ["--unsafe"]
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
types:
- python

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
types:
- python

- repo: https://github.com/pycqa/bandit
rev: 1.7.0
hooks:
- id: bandit
args: ["-ll"]
files: .py$

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.27.1
hooks:
Expand Down
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.languageServer": "Pylance",
"editor.formatOnSave": true,
"files.encoding": "utf8",
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"python.formatting.provider": "black",
}
thekaveman marked this conversation as resolved.
Show resolved Hide resolved
thekaveman marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions docs/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nav:
- README.md
- ...
13 changes: 13 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Home

This website provides technical documentation for the `eligibility-api` package from the [California Integrated Travel Project (Cal-ITP)](https://www.calitp.org).

Documentation for the `main` (default) branch is available [online](https://docs.calitp.org/eligibility-api).

## Overview

`eligibility-api` is a Python package that encapsulates the data exchange needed to verify one or more eligibility criteria for transit benefits.

The API is designed for privacy and security of user information:

- The API communicates with signed and encrypted JSON Web Tokens containing only the most necessary of user data for the purpose of eligibility verification
35 changes: 35 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Getting started

The following commands should be run in a terminal program like `bash`.

## Clone the repository

```bash
git clone https://github.com/cal-itp/eligibility-api.git
```

## Develop with VS Code Remote Containers

This repository comes with a [VS Code Remote Containers](https://code.visualstudio.com/docs/remote/containers) configuration file.

Once you clone the repository locally, simply open it within VS Code, which will prompt you to re-open the repository within the Remote Container.

## Run and develop the Documentation

When running the [Devcontainer](#develop-with-vs-code-remote-containers), the server is automatically started.

Otherwise, manually start the docs container with

```bash
docker compose up docs
```

The site is served from `http://localhost` at a port dynamically assigned by Docker. See
[Docker dynamic ports][docker-dynamic-ports] for more information.

The website is automatically rebuilt as changes are made to `docs/` files.

Read more on how to run the docs [here][benefits-docs].

[benefits-docs]: https://docs.calitp.org/benefits/getting-started/documentation/
[docker-dynamic-ports]: https://docs.calitp.org/benefits/getting-started/docker-dynamic-ports