-
Notifications
You must be signed in to change notification settings - Fork 0
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 #65 from TukiLaCosa/develop
Merge final a produccion
- Loading branch information
Showing
65 changed files
with
5,637 additions
and
372 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
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,11 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
|
||
# Tests directory | ||
./app/tests/ | ||
|
||
# Database file | ||
./app/database/*.sqlite |
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,38 @@ | ||
name: Tuki Testing CI | ||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
ENVIRONMENT: test | ||
TEST_DIRECTORY: ${{ github.workspace }}/app/tests | ||
TEST_DB_FILE: ${{ github.workspace }}/app/database/database_test.sqlite | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install and caching poetry dependencies | ||
run: pipx install poetry | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: "poetry" | ||
- run: poetry install | ||
|
||
- name: Test Game module | ||
run: | | ||
poetry run coverage run -m pytest $TEST_DIRECTORY/game_tests | ||
rm -f $TEST_DB_FILE | ||
- name: Test Player module | ||
run: | | ||
poetry run coverage run -m pytest $TEST_DIRECTORY/player_tests | ||
rm -f $TEST_DB_FILE | ||
- name: Test Card module | ||
run: | | ||
poetry run coverage run -m pytest $TEST_DIRECTORY/card_tests | ||
rm -f $TEST_DB_FILE |
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,23 @@ | ||
FROM python:3.10-slim as requirements-stage | ||
|
||
WORKDIR /tmp | ||
|
||
RUN pip install poetry | ||
|
||
COPY ./pyproject.toml ./poetry.lock* ./ | ||
|
||
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes | ||
|
||
FROM python:3.10-slim | ||
|
||
WORKDIR /code | ||
|
||
COPY --from=requirements-stage /tmp/requirements.txt ./requirements.txt | ||
|
||
RUN pip install --no-cache-dir --upgrade -r ./requirements.txt | ||
|
||
COPY ./app ./app | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] |
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
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
from pony.orm import db_session | ||
from .models import Card | ||
import csv | ||
from app.config.config import settings | ||
|
||
|
||
@db_session | ||
def populate_card_table(): | ||
if Card.select().count() > 0: | ||
print("Los datos de cartas ya estan en la base de datos. No se realizará la inicialización") | ||
return | ||
cartas = 'app/resources/cartas.csv' | ||
with open(cartas, newline='') as csvfile: | ||
|
||
with open(settings.CARDS_CSV_FILE_PTAH, newline='') as csvfile: | ||
csvreader = csv.reader(csvfile, delimiter=';') | ||
for row in csvreader: | ||
number, card_type, name, description = row | ||
Card(number=number, type=card_type, | ||
number, card_type, card_subtype, name, description = row | ||
Card(number=number, type=card_type, subtype=card_subtype, | ||
name=name, description=description) |
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,23 @@ | ||
from pony.orm import db_session, commit | ||
from .models import Player, Game | ||
|
||
|
||
@db_session | ||
def create_seed_data(): | ||
players = [] | ||
for i in range(1, 7): | ||
player = Player(name=f"Player{i}") | ||
players.append(player) | ||
commit() | ||
|
||
game = Game(name="TestGame", | ||
min_players=4, | ||
max_players=12, | ||
password='secure', | ||
host=players[0], | ||
) | ||
commit() | ||
players[0].game = game.name | ||
commit() | ||
for i in range(1, 6): | ||
game.players.add(players[i]) |
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
Oops, something went wrong.