Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build

on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-tests:
name: Build and Test
runs-on: ubuntu-latest
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run linting
run: |
pip install flake8
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

- name: Run tests
run: |
pip install pytest
pytest test_api.py

17 changes: 17 additions & 0 deletions test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest
from app import app

@pytest.fixture
def client():
with app.test_client() as client:
yield client

def test_svg_response(client):
response = client.get("/28/")

assert response.status_code == 200

assert response.content_type == "image/svg+xml"

assert b"<svg" in response.data
assert b"</svg>" in response.data