Skip to content

Commit

Permalink
Merge branch 'master' into compose-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Naramsim committed May 8, 2024
2 parents 03dc126 + 367fbe1 commit 79a8d2b
Show file tree
Hide file tree
Showing 27 changed files with 12,783 additions and 3,372 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- run:
name: Run tests
command: make test
- run:
name: Generate OpenAPI schema
command: make openapi-generate
build:
docker:
- image: cimg/python:3.10.9
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
context: .
file: ./Resources/docker/app/Dockerfile
push: false
platforms: local
platforms: local,linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
pokeapi/pokeapi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME_NARAMSIM }}
password: ${{ secrets.DOCKERHUB_TOKEN_NARAMSIM }}
Expand All @@ -43,12 +43,12 @@ jobs:
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: ./Resources/docker/app/Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7,linux/arm/v6
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ make-migrations: # Create migrations files if schema has changed
shell: # Load a shell
python manage.py shell ${local_config}

openapi-generate:
python manage.py spectacular --color --file openapi.yml ${local_config}

docker-up: # (Docker) Create services/volumes/networks
docker compose up -d

Expand Down Expand Up @@ -140,10 +143,10 @@ update-graphql-data-prod:
git submodule update --init
docker compose stop graphql-engine
sync; echo 3 > /proc/sys/vm/drop_caches
docker compose -f docker-compose.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d app
docker compose -f docker-compose.yml -f Resources/compose/docker-compose-prod-graphql.yml up -d app cache
make docker-migrate
make docker-build-db
docker compose stop app
docker compose stop app cache
sync; echo 3 > /proc/sys/vm/drop_caches
docker compose exec -T web sh -c 'rm -rf /tmp/cache/*'
docker compose start graphql-engine
Expand Down
3 changes: 3 additions & 0 deletions Resources/compose/docker-compose-prod-graphql.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: '2.4'
services:
cache:
restart: "no"

db:
environment:
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
Expand Down
6 changes: 3 additions & 3 deletions Resources/docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ RUN mkdir /code
WORKDIR /code

ADD requirements.txt /code/
RUN \
apk add --no-cache postgresql-libs libstdc++ && \
apk add --no-cache --virtual .build-deps gcc g++ musl-dev postgresql-dev && \
RUN apk add --no-cache postgresql-libs libstdc++
RUN apk add --no-cache --virtual .build-deps gcc g++ musl-dev \
postgresql-dev rust cargo && \
python3 -m pip install -r requirements.txt --no-cache-dir && \
apk --purge del .build-deps
ADD . /code/
Expand Down
41 changes: 41 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"corsheaders",
"rest_framework",
"cachalot",
"drf_spectacular",
) + CUSTOM_APPS


Expand All @@ -116,6 +117,7 @@
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"PAGE_SIZE": 20,
"PAGINATE_BY": 20,
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}


Expand All @@ -136,3 +138,42 @@
]

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

SPECTACULAR_SETTINGS = {
"TITLE": "PokéAPI",
"DESCRIPTION": """All the Pokémon data you'll ever need in one place, easily accessible through a modern free open-source RESTful API.
## What is this?
This is a full RESTful API linked to an extensive database detailing everything about the Pokémon main game series.
We've covered everything from Pokémon to Berry Flavors.
## Where do I start?
We have awesome [documentation](https://pokeapi.co/docs/v2) on how to use this API. It takes minutes to get started.
This API will always be publicly available and will never require any extensive setup process to consume.
Created by [**Paul Hallett**(]https://github.com/phalt) and other [**PokéAPI contributors***](https://github.com/PokeAPI/pokeapi#contributing) around the world. Pokémon and Pokémon character names are trademarks of Nintendo.
""",
"SERVERS": [{"url": "https://pokeapi.co"}],
"EXTERNAL_DOCS": {"url": "https://pokeapi.co/docs/v2"},
"VERSION": "2.7.0",
"SERVE_INCLUDE_SCHEMA": False,
"OAS_VERSION": "3.1.0",
"COMPONENT_SPLIT_REQUEST": True,
"TAGS": [
"pokemon",
"evolution",
"berries",
"items",
"machines",
"location",
"contest",
"moves",
"encounters",
"games",
"utility",
],
}
1 change: 1 addition & 0 deletions config/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
framework.
"""

import os
from django.core.wsgi import get_wsgi_application

Expand Down
8 changes: 5 additions & 3 deletions data/v2/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,9 +1242,11 @@ def csv_record_to_objects(info):
id=int(info[0]),
location_id=int(info[1]),
game_index=int(info[2]),
name="{}-{}".format(location.name, info[3])
if info[3]
else "{}-{}".format(location.name, "area"),
name=(
"{}-{}".format(location.name, info[3])
if info[3]
else "{}-{}".format(location.name, "area")
),
)

build_generic((LocationArea,), "location_areas.csv", csv_record_to_objects)
Expand Down
4 changes: 2 additions & 2 deletions data/v2/csv/evolution_trigger_prose.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ evolution_trigger_id,local_language_id,name
1,6,Levelaufstieg
1,9,Level up
2,5,Échange
2,6,Tausch
2,9,Trade
2,6,Tausch oder Verbindungsschnur
2,9,Trade or Linking Cord
3,5,Utilisation d'un objet
3,6,Gegenstand nutzen
3,9,Use item
Expand Down
4 changes: 4 additions & 0 deletions data/v2/csv/item_flag_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -610,3 +610,7 @@ item_id,item_flag_id
303,7
304,5
304,7
2160,1
2160,2
2160,3
2160,5
2 changes: 2 additions & 0 deletions data/v2/csv/item_names.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17822,3 +17822,5 @@ item_id,local_language_id,name
2159,1,チャデスのこな
2159,9,Poltchageist Powder
2159,11,チャデスのこな
2160,9,Linking Cord
2160,11, つながりのヒモ
1 change: 1 addition & 0 deletions data/v2/csv/item_prose.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1519,3 +1519,4 @@ This item can only be obtained or used via the Wonder Launcher."
1003,9,XXX new effect for roto-pp-restore,XXX new effect for roto-pp-restore
1004,9,XXX new effect for roto-boost,XXX new effect for roto-boost
1005,9,XXX new effect for roto-catch,XXX new effect for roto-catch
2160,9,Allows a Pokemon whose evolution is usually triggered by trading to evolve, The Linking Cord triggers the evolution of certain Pokémon (all of which can alternatively evolve when traded) upon use. This consumes the Linking Cord.
1 change: 1 addition & 0 deletions data/v2/csv/items.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2107,5 +2107,6 @@ id,identifier,category_id,cost,fling_power,fling_effect_id
2157,cramorant-down,54,30,,
2158,morpeko-snack,54,15,,
2159,poltchageist-powder,54,30,,
2160,linking-cord,10,8000,,
10001,black-augurite,10,0,,
10002,peat-block,10,0,,
4 changes: 2 additions & 2 deletions data/v2/csv/moves.csv
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,12 @@ id,identifier,generation_id,type_id,power,pp,accuracy,priority,target_id,damage_
718,multi-attack,7,1,120,10,100,0,10,2,269,,,,
719,10-000-000-volt-thunderbolt,7,13,195,1,,0,10,3,1,,,,
720,mind-blown,7,10,150,5,100,0,9,3,420,,,,
721,plasma-fists,7,13,100,15,100,0,10,2,1,,,,
721,plasma-fists,7,13,100,15,100,0,10,2,417,,,,
722,photon-geyser,7,14,100,5,100,0,10,3,1,,,,
723,light-that-burns-the-sky,7,14,200,1,,0,10,3,416,,,,
724,searing-sunraze-smash,7,9,200,1,,0,10,2,411,,,,
725,menacing-moonraze-maelstrom,7,8,200,1,,0,10,3,411,,,,
726,lets-snuggle-forever,7,18,190,1,,0,10,2,417,,,,
726,lets-snuggle-forever,7,18,190,1,,0,10,2,1,,,,
727,splintered-stormshards,7,6,190,1,,0,10,2,418,,,,
728,clangorous-soulblaze,7,16,185,1,,0,11,3,419,100,,,
729,zippy-zap,7,13,80,10,100,2,10,2,1,100,,,
Expand Down
Loading

0 comments on commit 79a8d2b

Please sign in to comment.