Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aoskotsky-amplify committed Aug 16, 2019
0 parents commit 1d597e3
Show file tree
Hide file tree
Showing 20 changed files with 648 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
engines:
coverage:
enabled: true
excluded_paths:
- test/**
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[report]
show_missing = true
107 changes: 107 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Prepared dependencies for deployment
dependencies/

# serverless
.serverless/
serverless.yml

# Mac OS X
.DS_Store

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

# C extensions
*.so

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

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

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

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env
.venv

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# IDE files
.project
.pydevproject
.ropeproject

# Pycharm
.idea/*
.ropeproject/

# Editor files
*~
*.sw?
\#*#
*.iml
node_modules/
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sudo: true
language: python
python: 2.7
before_install:
# need pandoc to convert markdown readme to reStructuredText that PyPi requires
- sudo apt-get install pandoc
install:
- pip install tox-travis codacy-coverage pypandoc
script:
- bash bin/versionCheck.sh $TRAVIS_BRANCH $TRAVIS_PULL_REQUEST
- tox
- python-codacy-coverage -r reports/coverage.xml
deploy:
provider: pypi
user: $PYPI_USER
password: $PYPI_PASSWORD
on:
branch: master
before_deploy:
- sed --expression "s|GIT_HASH|$TRAVIS_COMMIT|g" --in-place **/version.py
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright 2017 Amplify Education, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Manifest file for the egg
include *.pip
include *.md
include *.rst
prune test
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# python_hcl2
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/amplify-education/python_hcl2/master/LICENSE)

A project for being awesome.
# About Amplify
Amplify builds innovative and compelling digital educational products that empower teachers and students across the country. We have a long history as the leading innovator in K-12 education - and have been described as the best tech company in education and the best education company in tech. While others try to shrink the learning experience into the technology, we use technology to expand what is possible in real classrooms with real students and teachers.

Learn more at https://www.amplify.com

# Getting Started
## Prerequisites
python_hcl2 requires the following to be installed:
```
python >= 3.6
```

For development, `tox>=2.9.1` is recommended.

## Installing/Building
python_hcl2 is setup through tox, so simply run `tox`.

## Running Tests
As mentioned above, python_hcl2 uses tox, so running `tox` will automatically execute linters as well as the unit tests. You can also run functional and integration tests by using the -e argument.

For example, `tox -e lint,py27-unit,py27-integration` will run the linters, and then the unit and integration tests in python 2.7.

To see all the available options, run `tox -l`.

## Deployment
So how do we deploy this thing?

## Configuration
So how do we configure this thing?
# Responsible Disclosure
If you have any security issue to report, contact project maintainers privately.
You can reach us at <github@amplify.com>

# Contributing
We welcome pull requests! For your pull request to be accepted smoothly, we suggest that you:
1. For any sizable change, first open a GitHub issue to discuss your idea.
2. Create a pull request. Explain why you want to make the change and what it’s for.
We’ll try to answer any PR’s promptly.
39 changes: 39 additions & 0 deletions bin/versionCheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -e # halt script on error
set -x # print debugging

TARGET_BRANCH=$1
IS_PULL_REQUEST=$2 # false if not a pull request,

# Makes sure travis does not check version if doing a pull request
if [ "$IS_PULL_REQUEST" != "false" ]; then
if git diff --quiet "origin/${TARGET_BRANCH}...HEAD" 'python_hcl2' "test" setup.* ./*.pip; then
echo "No changes found to main code or dependencies: no version change needed"
exit 0
fi

CURRENT_VERSION=$(git show "origin/${TARGET_BRANCH}:python_hcl2/version.py" | sed -n 's/^__version__ = "\(.*\)"$/\1/p')
NEW_VERSION=$(sed -n 's/^__version__ = "\(.*\)"$/\1/p' python_hcl2/version.py)

if [ "$CURRENT_VERSION" == "$NEW_VERSION" ]; then
FAILURE_REASON="Failure reason: Version number should be bumped."
fi

HIGHEST_VERSION=$(echo -e "$CURRENT_VERSION\n$NEW_VERSION" | sort --version-sort | tail -n 1)

if [ "$HIGHEST_VERSION" != "$NEW_VERSION" ]; then
FAILURE_REASON="Failure Reason: New version ($NEW_VERSION) is less than current version ($HIGHEST_VERSION)"
fi


if [ -n "$FAILURE_REASON" ]; then
set +x # is super annoying
echo "============== PR Build Failed ==================="
echo
echo "$FAILURE_REASON"
echo
echo "=================================================="
exit 1
fi
fi
Loading

0 comments on commit 1d597e3

Please sign in to comment.