Skip to content

Commit f8bf08d

Browse files
Initial commit
0 parents  commit f8bf08d

File tree

21 files changed

+1161
-0
lines changed

21 files changed

+1161
-0
lines changed

.coveragerc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[run]
2+
relative_files = True
3+
4+
# Use 'source' instead of 'omit' in order to ignore 'tests/unit/__init__.py'
5+
source = hello_world

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Sage-Bionetworks-IT/sagebio-it @Sage-Bionetworks-IT/infra-oversight-committee

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DELETE THIS TEMPLATE BEFORE SUBMITTING
2+
3+
PR Checklist:
4+
[ ] Clearly explain your change with a desriptive commit message
5+
6+
[ ] Setup pre-commit and run the validators (info in README.md)
7+
To validate files run: `pre-commit run --all-files`
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: sam-build
2+
3+
runs:
4+
# This creates a composite action to be used as a step in a job
5+
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
6+
using: "composite"
7+
steps:
8+
# Convert Pipfile.lock to requirements.txt for sam
9+
- uses: actions/setup-python@v5
10+
with:
11+
python-version: 3.12
12+
- run: pip install -U pipenv
13+
shell: bash
14+
15+
# This needs to be in the 'CodeUri' directory
16+
- run: pipenv requirements > requirements.txt
17+
shell: bash
18+
19+
# Install aws-sam-cli
20+
- uses: aws-actions/setup-sam@v2
21+
with:
22+
use-installer: true
23+
24+
# Use a lambda-like docker container to build the lambda artifact
25+
- run: sam build --use-container
26+
shell: bash

.github/workflows/periodic.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: periodic
2+
3+
on:
4+
# Run once a month
5+
schedule:
6+
- cron: '30 16 15 * *' # 16:30 UTC (9:30 PST) on the 15th of the month
7+
8+
jobs:
9+
# Check that our current dependencies still work
10+
dependency-check:
11+
uses: "./.github/workflows/test.yaml"

.github/workflows/post-merge.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: post-merge
2+
3+
on:
4+
# Run on merges to main or tag pushes
5+
push:
6+
branches: [ 'main' ]
7+
tags: [ '*' ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}
11+
12+
jobs:
13+
lambda-test:
14+
uses: "./.github/workflows/test.yaml"
15+
16+
package-and-publish:
17+
runs-on: ubuntu-latest
18+
needs: lambda-test
19+
permissions:
20+
id-token: write
21+
env:
22+
BOOTSTRAP_BUCKET: bootstrap-awss3cloudformationbucket-19qromfd235z9
23+
ESSENTIALS_BUCKET: essentials-awss3lambdaartifactsbucket-x29ftznj6pqw
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
# Install sam-cli and run "sam build"
28+
- uses: ./.github/actions/sam-build
29+
30+
# authenticate with AWS via OIDC
31+
- uses: aws-actions/configure-aws-credentials@v4
32+
with:
33+
aws-region: us-east-1
34+
role-to-assume: arn:aws:iam::745159704268:role/sagebase-github-oidc-lambda-template-deploy-sageit
35+
role-session-name: GHA-${{ github.event.repository.name }}-${{ github.run_id }} # Must not exceed 64 chars
36+
role-duration-seconds: 900
37+
38+
# upload the lambda artifact to s3 and generate a cloudformation template referencing it
39+
- run: sam package --template-file .aws-sam/build/template.yaml --s3-bucket $ESSENTIALS_BUCKET --s3-prefix ${{ github.event.repository.name }}/${{ github.ref_name }} --output-template-file .aws-sam/build/${{ github.event.repository.name }}.yaml
40+
41+
# upload the generated cloudformation template to s3
42+
- run: aws s3 cp .aws-sam/build/${{ github.event.repository.name }}.yaml s3://$BOOTSTRAP_BUCKET/${{ github.event.repository.name }}/${{ github.ref_name }}/

.github/workflows/pre-merge.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: pre-merge
2+
3+
on:
4+
# Run on open pull requests
5+
pull_request:
6+
7+
jobs:
8+
lambda-test:
9+
uses: "./.github/workflows/test.yaml"

.github/workflows/test.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: lambda-test
2+
3+
on:
4+
# This is a dispatched workflow to be called as a job in other workflows
5+
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow
6+
workflow_call:
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: 3.12
17+
- uses: pre-commit/action@v3.0.1
18+
19+
pytest:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: 3.12
27+
- run: pip install -U pipenv
28+
- run: pipenv sync --dev
29+
- run: pipenv run coverage run -m pytest tests/ -svv
30+
- run: pipenv run coverage lcov
31+
- name: upload coverage to coveralls
32+
uses: coverallsapp/github-action@v2
33+
with:
34+
file: coverage.lcov
35+
fail-on-error: false
36+
37+
sam-build-and-lint:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: ./.github/actions/sam-build
42+
- run: sam validate --lint --template .aws-sam/build/template.yaml

.gitignore

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
coverage.lcov
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
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+
.python-version
87+
88+
# pipenv
89+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
90+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
91+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
92+
# install all needed dependencies.
93+
#Pipfile.lock
94+
95+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
96+
__pypackages__/
97+
98+
# Celery stuff
99+
celerybeat-schedule
100+
celerybeat.pid
101+
102+
# SageMath parsed files
103+
*.sage.py
104+
105+
# Environments
106+
.env
107+
.venv
108+
env/
109+
venv/
110+
ENV/
111+
env.bak/
112+
venv.bak/
113+
114+
# Spyder project settings
115+
.spyderproject
116+
.spyproject
117+
118+
# Rope project settings
119+
.ropeproject
120+
121+
# mkdocs documentation
122+
/site
123+
124+
# mypy
125+
.mypy_cache/
126+
.dmypy.json
127+
dmypy.json
128+
129+
# Pyre type checker
130+
.pyre/
131+
132+
# jetbrains
133+
.idea/
134+
135+
# generated dynamically from Pipfile
136+
requirements.txt

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ci:
2+
autoupdate_schedule: monthly
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
# On Windows, git will convert all CRLF to LF, but only after all hooks are done executing.
8+
# yamllint will fail before git has a chance to convert line endings, so line endings must be explicitly converted before yamllint
9+
- id: mixed-line-ending
10+
args: ['--fix=lf']
11+
description: Forces to replace line ending by the UNIX 'LF' character
12+
- id: end-of-file-fixer
13+
- id: trailing-whitespace
14+
- id: check-ast
15+
- repo: https://github.com/adrienverge/yamllint
16+
rev: v1.37.1
17+
hooks:
18+
- id: yamllint
19+
- repo: https://github.com/awslabs/cfn-python-lint
20+
rev: v1.34.2
21+
hooks:
22+
- id: cfn-python-lint
23+
files: template\.(json|yml|yaml)$
24+
- repo: https://github.com/Lucas-C/pre-commit-hooks
25+
rev: v1.5.5
26+
hooks:
27+
- id: remove-tabs
28+
- repo: https://github.com/aristanetworks/j2lint.git
29+
rev: v1.2.0
30+
hooks:
31+
- id: j2lint

0 commit comments

Comments
 (0)