-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from somethingsoftware/workflow
Add a github workflow
- Loading branch information
Showing
4 changed files
with
65 additions
and
2 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,58 @@ | ||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
sudo python -m pip install --upgrade pip | ||
sudo pip install flake8 | ||
if [ -f requirements.txt ]; then sudo pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Start server | ||
run: | | ||
sudo python main.py & | ||
- name: Wait for server to be up | ||
run: | | ||
for i in {1..30}; do | ||
if curl -s http://localhost:8080 > /dev/null; then | ||
echo "Server is up!" | ||
break | ||
fi | ||
echo "Waiting for server to be up..." | ||
sleep 2 | ||
done | ||
- name: Send test request | ||
run: | | ||
OUT=$(cat example_image.json | curl -X POST http://localhost:8080/classify -H "Content-Type: application/json" -d @-) | ||
echo $OUT | ||
if echo $OUT | grep '"success": true'; then | ||
echo "passed" | ||
else | ||
exit 1 | ||
fi | ||
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,3 @@ | ||
load-dotenv==0.1.0 | ||
pillow==10.3.0 | ||
tensorflow==2.16.1 |