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
11 changes: 0 additions & 11 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: pokeapi
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
16 changes: 6 additions & 10 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ name: Code Quality

on:
pull_request:
paths:
paths: &paths
- "**.py"
- "**.toml"
- "Makefile"
- "uv.lock"
- ".github/workflows/code-quality.yml"
- "**.lock"
Comment thread
FallenDeity marked this conversation as resolved.
- Makefile
- .github/actions/setup-uv/action.yml
- .github/workflows/code-quality.yml
push:
branches-ignore:
- master
- staging
paths:
- "**.py"
- "**.toml"
- "Makefile"
- "uv.lock"
- ".github/workflows/code-quality.yml"
paths: *paths

jobs:
ruff:
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@ name: Database

on:
pull_request:
paths: &paths
- "**.py"
- "**.toml"
- "**.lock"
- "data/**"
- "Resources/docker/app/Dockerfile"
- "Resources/nginx/**"
Comment thread
Naramsim marked this conversation as resolved.
- "docker-compose**"
- Makefile
- .github/actions/setup-uv/action.yml
- .github/workflows/database.yml
push:
branches-ignore:
- master
- staging
paths: *paths

jobs:
csv:
Expand Down Expand Up @@ -66,19 +78,14 @@ jobs:
with:
submodules: recursive
- name: Build and start services
run: |
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d --build
run: make docker-dev-up
- name: Run migrations and build database
run: |
make docker-migrate
make docker-build-db
- name: Dump DB
run: docker compose exec -T db pg_dump -U ash -Fc -N 'hdb_*' pokeapi > pokeapi.dump
- name: Drop and recreate database
run: |
docker compose exec -T db psql -U ash -d postgres -c "DROP DATABASE pokeapi WITH (FORCE);"
docker compose exec -T db psql -U ash -d postgres -c "CREATE DATABASE pokeapi;"
run: make docker-dump-db
- name: Import database
run: docker compose exec -T db pg_restore -U ash -d pokeapi < pokeapi.dump
run: make docker-restore-db
- name: Test data
run: curl -Ss http://localhost/api/v2/pokemon/1/ | grep -q 'bulbasaur'
11 changes: 8 additions & 3 deletions .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Publish

on:
push:
paths:
Comment thread
FallenDeity marked this conversation as resolved.
- "**.py"
- "**.toml"
- "**.lock"
- "Resources/docker/**"
- .github/workflows/docker-build-and-push.yml
branches:
- 'master'
- 'staging'
- master
- staging
tags:
- '*.*.*'

Expand All @@ -28,7 +34,6 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME_NARAMSIM }}
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/docker-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ name: Container

on:
pull_request:
paths:
- "**.py"
- "**.toml"
- "**.lock"
- "data/**"
- "docker-compose**"
- "Resources/docker/**"
- "Resources/k8s/**"
- "Resources/kind/**"
- Makefile
- .github/workflows/docker-k8s.yml

jobs:
docker:
Expand Down Expand Up @@ -107,8 +118,8 @@ jobs:
uses: actions/checkout@v6
- name: Build dev environment
run: |
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d
sleep 30
make docker-dev-up
sleep 5
- name: Assert containers running
run: |
last_command=$(docker ps | grep 'pokeapi-' | wc -l)
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/nix-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ name: Nix Environment

on:
pull_request:
paths: &paths
- "**.py"
- "**.toml"
- "**.lock"
- default.nix
- Makefile
- .github/workflows/nix-environment.yml
push:
branches:
- master
paths: *paths

jobs:
nix-test:
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ name: Release

on:
push:
paths:
- "**.py"
- "**.toml"
- "**.lock"
- "data/**"
Comment thread
FallenDeity marked this conversation as resolved.
- Makefile
- .github/actions/setup-uv/action.yml
- .github/workflows/release.yml
branches:
- master
Comment thread
Naramsim marked this conversation as resolved.
tags:
Expand All @@ -18,27 +26,24 @@ jobs:
submodules: recursive
- name: Start pokeapi (docker)
run: |
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d
make docker-dev-up
make docker-migrate
make docker-build-db
- name: Dump PG db
run: docker compose exec -T -u postgres db sh -c "cd /tmp && pg_dump -h localhost -Fc -U ash -N 'hdb_*' pokeapi > pokeapi.pgdump"
- name: Copy PG dump
run: |
docker compose cp db:/tmp/pokeapi.pgdump ./
ls -larth
run: make docker-dump-db
- name: List folder
run: ls -larth
- name: Setup uv
uses: ./.github/actions/setup-uv
- name: Start pokeapi
- name: Generate SQLite db
run: |
rm -rf .venv
make install-base
make setup
make build-db
nohup make serve &
sleep 3
- name: Release tag
uses: softprops/action-gh-release@v3.0.1
uses: softprops/action-gh-release@v3.0.2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
Expand All @@ -48,7 +53,7 @@ jobs:
db.sqlite3
generate_release_notes: true
- name: Release master branch
uses: softprops/action-gh-release@v3.0.1
uses: softprops/action-gh-release@v3.0.2
if: github.ref == 'refs/heads/master'
with:
body: |
Expand Down
5 changes: 0 additions & 5 deletions CONTRIBUTORS.txt

This file was deleted.

11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ openapi-generate: check-uv
docker-up: # (Docker) Create services/volumes/networks
docker compose up -d

docker-dev-up: # (Docker) Build local pokeapi image and create services/volumes/networks
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d --build

docker-migrate: # (Docker) Run any pending migrations
docker compose exec -T app python manage.py migrate ${docker_config}

Expand Down Expand Up @@ -95,6 +98,14 @@ docker-prod:

docker-setup: docker-up docker-migrate docker-build-db # (Docker) Start services, prepare the latest DB schema, populate the DB

docker-dump-db:
docker compose exec -T db pg_dump -U ash -Fc -N 'hdb_*' pokeapi > pokeapi.pgdump

docker-restore-db:
docker compose exec -T db psql -U ash -d postgres -c "DROP DATABASE pokeapi WITH (FORCE);"
docker compose exec -T db psql -U ash -d postgres -c "CREATE DATABASE pokeapi;"
docker compose exec -T db pg_restore -U ash -d pokeapi < pokeapi.pgdump

format: check-uv # Format the source code
uv run ruff format .

Expand Down
Loading