Skip to content

Commit 52a05dd

Browse files
committed
✨ Start of Python API using Fast API
- Utilize Fast API - Implement mkdocs - Use pipenv - Add doc images - Add basic readme - Add linting files - Save vscode extensions 🔧 Add black configuration Update dependencies
1 parent 69c4011 commit 52a05dd

28 files changed

+1725
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Validate Pull Request
2+
3+
on: [pull_request, repository_dispatch]
4+
5+
env:
6+
PYTHON_VERSION: 3.8
7+
8+
jobs:
9+
code_analysis:
10+
name: Code Analysis
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v2
15+
- name: Set up Python ${{ env.PYTHON_VERSION }}
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: ${{ env.PYTHON_VERSION }}
19+
- name: Change Directory
20+
run: cd ${{ github.workspace }}
21+
- name: Setup Environment
22+
run: make environment
23+
- name: Lint
24+
run: make lint
25+
- name: Initialize CodeQL
26+
uses: github/codeql-action/init@v1
27+
with:
28+
languages: python
29+
- name: Autobuild
30+
uses: github/codeql-action/autobuild@v1
31+
- name: Perform CodeQL Analysis
32+
uses: github/codeql-action/analyze@v1
33+
34+
linux_check:
35+
name: Linux Check
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout Code
39+
uses: actions/checkout@v2
40+
- name: Set up Python ${{ env.PYTHON_VERSION }}
41+
uses: actions/setup-python@v1
42+
with:
43+
python-version: ${{ env.PYTHON_VERSION }}
44+
- name: Build Docker Image
45+
run: make docker-build

.github/workflows/release.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release Build
2+
3+
on:
4+
milestone:
5+
types: [closed]
6+
7+
env:
8+
PYTHON_VERSION: 3.8
9+
10+
jobs:
11+
code_analysis:
12+
name: Code Analysis
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v2
17+
- name: Set up Python ${{ env.PYTHON_VERSION }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ env.PYTHON_VERSION }}
21+
- name: Change Directory
22+
run: cd ${{ github.workspace }}
23+
- name: Setup Environment
24+
run: make environment
25+
- name: Lint
26+
run: make lint
27+
- name: Initialize CodeQL
28+
uses: github/codeql-action/init@v1
29+
with:
30+
languages: python
31+
- name: Autobuild
32+
uses: github/codeql-action/autobuild@v1
33+
- name: Perform CodeQL Analysis
34+
uses: github/codeql-action/analyze@v1
35+
36+
linux_check:
37+
name: Linux Check
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout Code
41+
uses: actions/checkout@v2
42+
- name: Set up Python ${{ env.PYTHON_VERSION }}
43+
uses: actions/setup-python@v1
44+
with:
45+
python-version: ${{ env.PYTHON_VERSION }}
46+
- name: Build Docker Image
47+
run: make docker-build
48+
49+
release:
50+
name: Release
51+
runs-on: ubuntu-latest
52+
needs: [code_analysis, windows_check, mac_check, linux_check]
53+
steps:
54+
- name: Checkout Code
55+
uses: actions/checkout@v2
56+
- name: Set up Python ${{ env.PYTHON_VERSION }}
57+
uses: actions/setup-python@v1
58+
with:
59+
python-version: ${{ env.PYTHON_VERSION }}
60+
- name: Change Directory
61+
run: cd ${{ github.workspace }}
62+
- name: Get Version
63+
run: echo ::set-env name=PACKAGE_VERSION::$(echo $VERSION | python setup.py --version)
64+
- name: Create Release
65+
id: create_release
66+
uses: actions/[email protected]
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
tag_name: ${{ env.PACKAGE_VERSION }}
71+
release_name: Release ${{ env.PACKAGE_VERSION }}
72+
draft: false
73+
prerelease: false
74+
- name: Push to Docker Hub
75+
uses: docker/build-push-action@v1
76+
with:
77+
username: ${{ secrets.DOCKER_USERNAME }}
78+
password: ${{ secrets.DOCKER_PASSWORD }}
79+
repository: electionguard/electionguard-api
80+
tag_with_ref: true
81+
- name: Push to GitHub Packages
82+
uses: docker/build-push-action@v1
83+
with:
84+
username: ${{ github.actor }}
85+
password: ${{ secrets.GITHUB_TOKEN }}
86+
registry: docker.pkg.github.com
87+
repository: microsoft/electionguard-web-api/electionguard-api
88+
tag_with_ref: true
89+
- name: Deploy Github Pages
90+
run: make docs-deploy-ci

.gitignore

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
.python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/
139+
140+
# VS Code
141+
*.local.json
142+
143+
# Mac
144+
.DS_Store

0 commit comments

Comments
 (0)