Skip to content
Open
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']
15 changes: 5 additions & 10 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@ name: Code Quality

on:
pull_request:
paths:
paths: &paths
- "**.py"
- "**.toml"
- "Makefile"
- "uv.lock"
- ".github/workflows/code-quality.yml"
- "**.lock"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the uv setup action, database.yml and release.yml is missing it too btw

- Makefile
- .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
21 changes: 13 additions & 8 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ name: Database

on:
pull_request:
paths: &paths
- "**.py"
- "**.toml"
- "**.lock"
- "data/**"
- "Resources/nginx/**"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the resources docker app dockerfile

- "docker-compose**"
- Makefile
- .github/workflows/database.yml
push:
branches-ignore:
- master
- staging
paths: *paths

jobs:
csv:
Expand Down Expand Up @@ -66,19 +76,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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note if we do ever create a release tag which dosent modify these files the image wont release

- "**.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
21 changes: 12 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Release

on:
push:
paths:
- "**.py"
- "data/**"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toml and lock files here needed if a dep is bumped ever

resources docker for the docker image

and the uv setup action

ps: same issue as with release tag for docker build and publish

- Makefile
- .github/workflows/release.yml
branches:
- master
Comment thread
Naramsim marked this conversation as resolved.
tags:
Expand All @@ -18,18 +23,16 @@ 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
Expand All @@ -38,7 +41,7 @@ jobs:
nohup make serve &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to make serve here we can just all it a day at make build-db right the django server is not being used

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 +51,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