Skip to content

Commit 3f5c2c0

Browse files
committed
Initial commit
0 parents  commit 3f5c2c0

19 files changed

+1500
-0
lines changed

.dockerignore

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
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+
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+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# VSCode configuration
132+
.vscode
133+
134+
# Evaluation function config
135+
config.json
136+
137+
# README
138+
README.md
139+
140+
# GitHub
141+
.github
142+
143+
# Data folder
144+
data/
145+
146+
# Test reports
147+
reports/

.github/workflows/deploy.yml

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Build, Test and Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
actions: read
17+
checks: write
18+
pull-requests: write
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.12"]
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
id: python-setup
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Load cached Poetry installation
36+
id: poetry-cache
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.local
40+
key: poetry-0
41+
42+
- name: Install and configure Poetry
43+
if: steps.poetry-cache.outputs.cache-hit != 'true'
44+
uses: snok/install-poetry@v1
45+
with:
46+
virtualenvs-in-project: true
47+
48+
- name: Load cached venv
49+
id: dependencies-cache
50+
uses: actions/cache@v3
51+
with:
52+
path: .venv
53+
key: venv-${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
54+
55+
- name: Install dependencies
56+
if: steps.dependencies-cache.outputs.cache-hit != 'true'
57+
run: |
58+
poetry install --no-interaction --no-root
59+
60+
# TODO: add linting / black / flake8
61+
# - name: Lint with flake8
62+
# run: |
63+
# source .venv/bin/activate
64+
# # stop the build if there are Python syntax errors or undefined names
65+
# flake8 ./evaluation_function --count --select=E9,F63,F7,F82 --show-source --statistics
66+
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
67+
# flake8 ./evaluation_function --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
68+
69+
- name: Run tests
70+
if: always()
71+
run: |
72+
source .venv/bin/activate
73+
pytest --junit-xml=./reports/pytest.xml --tb=auto -v
74+
75+
- name: Upload test results
76+
uses: actions/upload-artifact@v4
77+
if: always()
78+
with:
79+
name: test-results
80+
path: ./reports/pytest.xml
81+
if-no-files-found: warn
82+
83+
build:
84+
name: Build Docker Image
85+
uses: lambda-feedback/evaluation-function-workflows/.github/workflows/build.yml@main
86+
needs: test
87+
permissions:
88+
contents: read
89+
id-token: write
90+
packages: write
91+
92+
deploy:
93+
name: Deploy to Lambda Feedback
94+
uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@main
95+
needs: test
96+
with:
97+
template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python"
98+
permissions:
99+
contents: read
100+
id-token: write
101+
packages: write
102+
secrets:
103+
aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
104+
aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
105+
function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}}

.github/workflows/test-report.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test Report
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build, Test and Deploy"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: read
11+
actions: read
12+
checks: write
13+
14+
jobs:
15+
report:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Test Report
19+
uses: dorny/test-reporter@v1
20+
if: always()
21+
with:
22+
name: Pytest Report
23+
artifact: test-results
24+
path: '*.xml'
25+
reporter: java-junit
26+
fail-on-error: false

0 commit comments

Comments
 (0)