Skip to content

Commit 8c3c44d

Browse files
committed
initial commit: testing result returned, but function tested successfully with evaluation_function.dev
1 parent f70b702 commit 8c3c44d

29 files changed

+6304
-269
lines changed

.dockerignore

Lines changed: 147 additions & 0 deletions
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

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

0 commit comments

Comments
 (0)