Skip to content

Merge pull request #6 from somethingsoftware/dockerfile #7

Merge pull request #6 from somethingsoftware/dockerfile

Merge pull request #6 from somethingsoftware/dockerfile #7

Workflow file for this run

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