diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..778e75f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI # Name of the workflow + +on: + push: + branches: + - master + +jobs: + test: # Defines a job called "test" + runs-on: ubuntu-latest # The job runs on the latest Ubuntu runner + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Poetry + run: pip install poetry + + - name: Install dependencies + run: poetry install + + - name: Run tests with coverage + run: poetry run coverage run -m pytest + + - name: Generate Coverage Report # Ensure creation of coverage.xml + run: poetry run coverage xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{secrets.CODECOV_TOKEN}} + file: ./coverage.xml diff --git a/README.md b/README.md index 7b716c0..8a62376 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ +![Codecov](https://codecov.io/gh/senju1337/senju/branch/master/graph/badge.svg) + # senju API / Webservice for Phrases/Words/Kanji/Haiku diff --git a/senju/__init__.py b/senju/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/senju/main.py b/senju/main.py index 72e0e65..cb7493e 100644 --- a/senju/main.py +++ b/senju/main.py @@ -79,9 +79,11 @@ def haiku_index_view(): :raises KeyError: If no haikus exist in the store yet. """ haiku_id: int | None = store.get_id_of_latest_haiku() - if haiku_id is None: + haiku_default = haiku_id is None + if haiku_default: haiku_id = 0 - return redirect(url_for("haiku_view", haiku_id=haiku_id, is_default=1)) + return redirect(url_for("haiku_view", haiku_id=haiku_id, + is_default=1 if haiku_default else 0)) @app.route("/haiku/") diff --git a/senju/templates/base.html b/senju/templates/base.html index b2dee1a..5492e5f 100644 --- a/senju/templates/base.html +++ b/senju/templates/base.html @@ -23,11 +23,11 @@ 選集 + - - - - -
- -
-
-
- -
-
-
Tom Cook
-
tom@example.com
-
- -
-
diff --git a/senju/templates/prompt.html b/senju/templates/prompt.html index 77b2825..7c9c343 100644 --- a/senju/templates/prompt.html +++ b/senju/templates/prompt.html @@ -3,7 +3,7 @@ {% block content %}
-

Very 1337 prompt input

+

Haiku Generator