Skip to content

Commit

Permalink
Initial Release (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jashparekh authored Dec 15, 2021
1 parent dda83e5 commit 7ce4f4a
Show file tree
Hide file tree
Showing 33 changed files with 1,170 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[bandit]
exclude: *venv*,*env*,*scratch*
skips: B101
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github/
.git/
venv/
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 88
max-complexity = 8
ignore = W503,E501
builtins = unicode
tee = True
exclude = venv,env,.venv,scratch
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''

---


14 changes: 14 additions & 0 deletions .github/actions/install-dependencies/action.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -euo pipefail

echo "Ensuring pip is up to date"
python -m pip install --upgrade pip

if [[ "${INSTALL_REQUIREMENTS}" == "true" ]]; then
echo "Installing code requirements"
pip install -r requirements.txt
fi

if [[ "${INSTALL_TEST_REQUIREMENTS}" == "true" ]]; then
echo "Installing test requirements"
pip install -r requirements-test.txt
fi
20 changes: 20 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Install Dependencies"
description: "Install Python dependencies"
inputs:
requirements:
description: "Should requirements.lock be installed"
default: "false"
required: false
test-requirements:
description: "Should requirements-test.txt be installed"
default: "false"
required: false
runs:
using: "composite"
steps:
- name: "Install Python dependencies"
run: "$GITHUB_ACTION_PATH/action.sh"
shell: "bash"
env:
INSTALL_REQUIREMENTS: ${{ inputs.requirements }}
INSTALL_TEST_REQUIREMENTS: ${{ inputs.test-requirements }}
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/docker"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
16 changes: 16 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Summary

*`TODO:` What does this PR do? (Replace with summary!)*

## Other Information

`TODO` (if relevant)

## PR Checklist

Please run through before submitting for final review:

- [ ] The PR title is descriptive of what changed.
- [ ] The description sections above are filled out.
- [ ] The CI pipeline is passing
- [ ] Added the `ready-for-review` label to the PR.
109 changes: 109 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: "Lint"
on:
pull_request: {}
push:
branches: ["main"]

env:
PYTHON_VERSION: "3.10.1"

jobs:
shfmt:
name: Bash shfmt
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- run: docker-compose run --rm shfmt

lint:
name: Lint bash and markdown
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- run: docker-compose run --rm lint

bandit:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
requirements: "true"
test-requirements: "true"

- name: Run bandit
run: bandit --ini .bandit -r plugin_scripts tests

black:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
requirements: "true"
test-requirements: "true"

- name: Run black
run: black --check plugin_scripts tests

flake8:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
requirements: "true"
test-requirements: "true"

- name: Run flake8
run: flake8 plugin_scripts tests

isort:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
requirements: "true"
test-requirements: "true"

- name: Run isort
run: isort --profile black --atomic --check-only plugin_scripts tests

mypy:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
requirements: "true"
test-requirements: "true"

- name: Run mypy
run: mypy plugin_scripts tests
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Unit Tests"
on:
pull_request: {}
push:
branches: ["main"]

env:
PYTHON_VERSION: "3.10.1"

jobs:
test:
name: Pytest
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
requirements: "true"
test-requirements: "true"

- name: Run pytest
run: pytest --cov plugin_scripts/ tests --cov-report xml:coverage-${{ env.PYTHON_VERSION }}.xml --junitxml=test-results-${{ env.PYTHON_VERSION }}.xml

- name: Upload pytest test results artifact
uses: actions/upload-artifact@v2
with:
name: pytest-results-${{ env.PYTHON_VERSION }}
path: test-results-${{ env.PYTHON_VERSION }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

- name: Upload coverage results artifact
uses: actions/upload-artifact@v2
with:
name: pytest-coverage-${{ env.PYTHON_VERSION }}
path: coverage-${{ env.PYTHON_VERSION }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

- name: Publish coverage results to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage-${{ env.PYTHON_VERSION }}.xml
fail_ci_if_error: true
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# OS junk files
[Tt]humbs.db
*.DS_Store

# Ignore vim & emacs temp files
*.swp
*.swo
*~
\#*#

# Files from testing
.hypothesis
.cache
**/*.csv
*.avro

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Unit test / coverage reports
htmlcov/
*cov*html*
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Environments
.venv
env/
venv*/
ENV/
env.bak/
venv.bak/
scp/
worker_venv/

# PyCharm
.idea
*.iml

# Cache Directories
.pytest_cache/
.mypy_cache/

# Do not version control these files please
docker/files/secrets/
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile=black
atomic=true
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.1.0] - 2021-12-14

### Changed

* Initial Release
Loading

0 comments on commit 7ce4f4a

Please sign in to comment.