Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joseph sentry patch 2 #230

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3ea5eef
step0: add python dependencies
joseph-sentry Jun 13, 2023
642719f
Merge pull request #1 from joseph-sentry/step0
joseph-sentry Jun 13, 2023
c35d1c0
step1: add calculator backend and tests
joseph-sentry Jun 13, 2023
e6db927
Merge pull request #2 from joseph-sentry/step1
joseph-sentry Jun 13, 2023
db2cca0
step2: upload coverage reports to Codecov
joseph-sentry Jun 13, 2023
5ad8e6c
change python version
joseph-sentry Jun 13, 2023
5119328
Merge pull request #3 from joseph-sentry/step2
joseph-sentry Jun 13, 2023
94f7ab7
1
joseph-sentry Jun 27, 2023
b64b9b4
2
joseph-sentry Jun 27, 2023
0fc784a
3
joseph-sentry Jun 27, 2023
84c1c85
Create codecov.yml
joseph-sentry Jul 13, 2023
1635875
wip
joseph-sentry Jul 21, 2023
6219e53
rm venv
joseph-sentry Jul 26, 2023
3532633
no longer track gitignore
joseph-sentry Jul 26, 2023
afd7a9b
wip
joseph-sentry Jul 26, 2023
3f44ba8
wip
joseph-sentry Aug 2, 2023
d0e6fd0
wip
joseph-sentry Aug 2, 2023
3fe10c3
wip
joseph-sentry Aug 2, 2023
5b174c2
make change on main
joseph-sentry Aug 14, 2023
1713006
make change to codecov yaml
joseph-sentry Aug 18, 2023
38c2d02
make change to app
joseph-sentry Aug 18, 2023
41dffb9
change codecov config
joseph-sentry Sep 19, 2023
5cb3b7d
change
joseph-sentry Sep 19, 2023
f6d82bb
hello world
joseph-sentry Sep 19, 2023
3e2b3cc
hello world
joseph-sentry Sep 19, 2023
561de9a
hello world
joseph-sentry Sep 22, 2023
9c7d965
hello world
joseph-sentry Sep 22, 2023
0a72b58
hello world
joseph-sentry Sep 22, 2023
d636228
hello world
joseph-sentry Sep 22, 2023
c8a0aa9
hello world
joseph-sentry Sep 22, 2023
bcf9ef3
hello world
joseph-sentry Sep 18, 2023
0b5433e
hello world
joseph-sentry Oct 27, 2023
84ce443
hello world
joseph-sentry Nov 6, 2023
4ca6580
hello world
joseph-sentry Nov 6, 2023
cd76b08
hello world
joseph-sentry Nov 6, 2023
7f5c68d
hello world
joseph-sentry Dec 21, 2023
cb1e86c
hello world
joseph-sentry Dec 21, 2023
96c3763
change codecov.yml
joseph-sentry Jan 8, 2024
c130c08
change yml again
joseph-sentry Jan 8, 2024
309c573
test change
joseph-sentry Jan 8, 2024
2d613ce
test default env vars
joseph-sentry Jan 9, 2024
a2ace5d
test
joseph-sentry Jan 9, 2024
1eae6f7
test
joseph-sentry Jan 9, 2024
45e4d0d
test
joseph-sentry Jan 9, 2024
e461ff7
hello world test
joseph-sentry Jan 31, 2024
be8018c
hello world test
joseph-sentry Jan 31, 2024
25c884f
test
joseph-sentry Mar 21, 2024
1e3d2e7
test
joseph-sentry Mar 21, 2024
86d9978
test
joseph-sentry Mar 21, 2024
1bfb578
test
joseph-sentry Mar 21, 2024
c653235
test
joseph-sentry Mar 21, 2024
b5dc561
test
joseph-sentry May 10, 2024
a0a7b31
test
joseph-sentry May 10, 2024
3c3c660
test
joseph-sentry May 10, 2024
5c4f8bb
test
joseph-sentry May 10, 2024
22b13d3
tet
joseph-sentry May 10, 2024
1c10ead
test
joseph-sentry May 10, 2024
cf91186
Update 1.txt
joseph-sentry Jul 4, 2024
4a7885d
Update 1.txt
joseph-sentry Jul 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: API workflow

on: [push, pull_request, workflow_dispatch]

permissions: write-all

jobs:
build:
runs-on: ubuntu-latest
name: Test python API
strategy:
matrix:
python_version: ['3.10', '3.9']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: rename the file
run: mv 1.txt ${{ matrix.python_version }}-1.txt
- name: do the thing
uses: actions/upload-artifact@v4
with:
name: do_the_thing-${{ matrix.python_version }}
path: ${{ matrix.python_version }}-1.txt

later:
needs: [build]
runs-on: ubuntu-latest
name: do the other thing
steps:
- name: download
uses: actions/download-artifact@v4
with:
path: artifact
merge-multiple: true
pattern: do_the_thing-*
- run: ls -R

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
__pycache__
.coverage
.pytest_cache/
coverage.xml
node_modules/
coverage/
.venv
*.xml
*.sh
.vscode
2 changes: 2 additions & 0 deletions 1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1
2
1 change: 1 addition & 0 deletions 2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world
1 change: 1 addition & 0 deletions 3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world
40 changes: 40 additions & 0 deletions api/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from flask import (
Flask,
request,
)

from temp.calculator.calculator import Calculator

app = Flask(__name__)


@app.route("/api/add", methods=["POST"])
def add():
return operation("add", 2)


@app.route("/api/subtract", methods=["POST"])
def subtract():
return operation("subtract", 2)


@app.route("/api/multiply", methods=["POST"])
def multiply():
return operation("multiply", 2)


@app.route("/api/divide", methods=["POST"])
def divide():
return operation("divide", 2)


def operation(method, num_factors):
factors = []
if num_factors == 2:
factors.append(float(request.json.get("x")))
factors.append(float(request.json.get("y")))

return str(getattr(Calculator, method)(*factors))


app.run(host="0.0.0.0", port=8080)
17 changes: 17 additions & 0 deletions api/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
blinker==1.6.2
click==8.1.3
coverage==7.2.7
exceptiongroup==1.1.1
Flask==2.3.2
importlib-metadata==6.6.0
iniconfig==2.0.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
packaging==23.1
pluggy==1.0.0
pytest==7.3.2
pytest-cov==4.1.0
tomli==2.0.1
Werkzeug==2.3.6
zipp==3.15.0
Empty file added api/something/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions api/something/something.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Something:
def do_something(self, x):
x = x + 1 if x > 0 else x
return x

def do_something_else(self, x, y):
return x * 2 - y
16 changes: 16 additions & 0 deletions api/something/test_something.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from api.something.something import Something


def test_something():
st = Something()
assert st.do_something(1) == 2
assert st.do_something(2) == 3
assert st.do_something(5) == 6
assert st.do_something(10) == 11


def test_something_else():
st = Something()
assert st.do_something_else(1, 1) == 1
assert st.do_something_else(1, 2) == 0
assert st.do_something_else(1000, 10) == 1990
5 changes: 5 additions & 0 deletions api/something/test_something_else.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import api.something.something as something


def test_something():
assert something.Something.do_something(-4) == -4
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
flag_management:
individual_flags:
- name: .FsOgp9g:Zus|a5F&Xo@[16;#R`S<a{X+C!GToYQi^yFVmz]aV4Re3$yfz$*<HxHYVko2VM7V2>F(|FezVM7H^>cD?hO)]U4Lgvn~GTytOs9:Hz}wD.IA10nA]sZ`5x>q\A9,,6[\nNH\,cV?z&k~VUbbD>0QlILVE}0WJt:T%*yn~F%V;>7ZLi|yd1G$A.V+|f>)^3n_Tvy231^tWu6~<=/pRjI#eW2asi:7?\O0,++@rq/j,\0&r+1\5h*X7juW_h~}Hp\kM*p[Qs84eC{~hx31)?>{?H.kB>9;cs^0/,=kRngrs5h2&K|o@/lc}L@NIF=-6+D:^c5A@{z&3B`q>Vr:79p71p`]4[x.O=w@U57#2(6x~B7+T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