forked from Sage-Bionetworks/s3-synapse-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IT-937] Setup pre-commit, pipenv, and CI (Sage-Bionetworks#2)
* Setup pre-commit[1] for linting python, yaml and cloudformation templates * Setup pipenv[2] to manage python package dependencies * Setup travis CI to automate build and deploy lambda to an S3 bucket for consumption * add documentation [1] https://pre-commit.com/ [2] https://pipenv-fork.readthedocs.io/en/latest/
- Loading branch information
Showing
7 changed files
with
929 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.1.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-ast | ||
- repo: https://github.com/adrienverge/yamllint | ||
rev: v1.24.2 | ||
hooks: | ||
- id: yamllint | ||
- repo: https://github.com/awslabs/cfn-python-lint | ||
rev: v0.34.0 | ||
hooks: | ||
- id: cfn-python-lint | ||
files: template\.(json|yml|yaml)$ | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
rev: v1.1.8 | ||
hooks: | ||
- id: remove-tabs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
language: python | ||
python: 3.6 | ||
cache: pip | ||
env: | ||
- REPO_NAME="${PWD##*/}" | ||
install: | ||
- pip install pipenv | ||
- pipenv install --dev | ||
- wget https://github.com/Sage-Bionetworks/infra-utils/archive/master.zip -O /tmp/infra-utils.zip | ||
- unzip -j -n /tmp/infra-utils.zip -x "infra-utils-master/.gitignore" "infra-utils-master/LICENSE" "infra-utils-master/*.md" "infra-utils-master/aws/*" | ||
- ./setup_aws_cli.sh || travis_terminate 1 | ||
- export SAM_CLI_TELEMETRY=0 | ||
stages: | ||
- name: validate | ||
- name: deploy | ||
if: (tag =~ ^v) OR (branch = master AND type = push) | ||
jobs: | ||
fast_finish: true | ||
include: | ||
- stage: validate | ||
script: | ||
- pre-commit run --all-files | ||
- sam build | ||
# - python -m pytest tests/ -v | ||
- stage: deploy | ||
script: | ||
- sam build | ||
- | | ||
sam package --template-file .aws-sam/build/template.yaml \ | ||
--s3-bucket essentials-awss3lambdaartifactsbucket-x29ftznj6pqw \ | ||
--output-template-file .aws-sam/build/$REPO_NAME.yaml | ||
- aws s3 cp .aws-sam/build/$REPO_NAME.yaml s3://bootstrap-awss3cloudformationbucket-19qromfd235z9/$REPO_NAME/$TRAVIS_BRANCH/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
|
||
extends: default | ||
|
||
rules: | ||
braces: | ||
level: warning | ||
max-spaces-inside: 1 | ||
brackets: | ||
level: warning | ||
max-spaces-inside: 1 | ||
colons: | ||
level: warning | ||
commas: | ||
level: warning | ||
comments: disable | ||
comments-indentation: disable | ||
document-start: disable | ||
empty-lines: | ||
level: warning | ||
hyphens: | ||
level: warning | ||
indentation: | ||
level: warning | ||
indent-sequences: consistent | ||
line-length: disable | ||
truthy: disable | ||
new-line-at-end-of-file: | ||
level: warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
pylint = "~=2.5.3" | ||
pytest = "~=6.0.1" | ||
pytest-mock = "~=3.2.0" | ||
pre-commit = "~=2.6.0" | ||
responses = "~=0.10.15" | ||
aws-sam-cli = "<2,>=1.1" | ||
|
||
[packages] | ||
synapseclient = "<3,>=2.1" | ||
|
||
[requires] | ||
python_version = "3.6" |
Oops, something went wrong.