Skip to content

Commit ba4910e

Browse files
authored
Merge pull request #1654 from PokeAPI/paths
Limit builds in cicd
2 parents 3347644 + c8d22d3 commit ba4910e

10 files changed

Lines changed: 76 additions & 49 deletions

File tree

‎.github/FUNDING.yml‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
# These are supported funding model platforms
2-
3-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4-
patreon: # Replace with a single Patreon username
51
open_collective: pokeapi
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
otechie: # Replace with a single Otechie username
12-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

‎.github/workflows/code-quality.yml‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@ name: Code Quality
22

33
on:
44
pull_request:
5-
paths:
5+
paths: &paths
66
- "**.py"
77
- "**.toml"
8-
- "Makefile"
9-
- "uv.lock"
10-
- ".github/workflows/code-quality.yml"
8+
- "**.lock"
9+
- Makefile
10+
- .github/actions/setup-uv/action.yml
11+
- .github/workflows/code-quality.yml
1112
push:
1213
branches-ignore:
1314
- master
1415
- staging
15-
paths:
16-
- "**.py"
17-
- "**.toml"
18-
- "Makefile"
19-
- "uv.lock"
20-
- ".github/workflows/code-quality.yml"
16+
paths: *paths
2117

2218
jobs:
2319
ruff:

‎.github/workflows/database.yml‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@ name: Database
22

33
on:
44
pull_request:
5+
paths: &paths
6+
- "**.py"
7+
- "**.toml"
8+
- "**.lock"
9+
- "data/**"
10+
- "Resources/docker/app/Dockerfile"
11+
- "Resources/nginx/**"
12+
- "docker-compose**"
13+
- Makefile
14+
- .github/actions/setup-uv/action.yml
15+
- .github/workflows/database.yml
516
push:
617
branches-ignore:
718
- master
819
- staging
20+
paths: *paths
921

1022
jobs:
1123
csv:
@@ -66,19 +78,14 @@ jobs:
6678
with:
6779
submodules: recursive
6880
- name: Build and start services
69-
run: |
70-
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d --build
81+
run: make docker-dev-up
7182
- name: Run migrations and build database
7283
run: |
7384
make docker-migrate
7485
make docker-build-db
7586
- name: Dump DB
76-
run: docker compose exec -T db pg_dump -U ash -Fc -N 'hdb_*' pokeapi > pokeapi.dump
77-
- name: Drop and recreate database
78-
run: |
79-
docker compose exec -T db psql -U ash -d postgres -c "DROP DATABASE pokeapi WITH (FORCE);"
80-
docker compose exec -T db psql -U ash -d postgres -c "CREATE DATABASE pokeapi;"
87+
run: make docker-dump-db
8188
- name: Import database
82-
run: docker compose exec -T db pg_restore -U ash -d pokeapi < pokeapi.dump
89+
run: make docker-restore-db
8390
- name: Test data
8491
run: curl -Ss http://localhost/api/v2/pokemon/1/ | grep -q 'bulbasaur'

‎.github/workflows/docker-build-and-push.yml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ name: Publish
22

33
on:
44
push:
5+
paths:
6+
- "**.py"
7+
- "**.toml"
8+
- "**.lock"
9+
- "Resources/docker/**"
10+
- .github/workflows/docker-build-and-push.yml
511
branches:
6-
- 'master'
7-
- 'staging'
12+
- master
13+
- staging
814
tags:
915
- '*.*.*'
1016

@@ -28,7 +34,6 @@ jobs:
2834
id: buildx
2935
uses: docker/setup-buildx-action@v3
3036
- name: Login to DockerHub
31-
if: github.event_name != 'pull_request'
3237
uses: docker/login-action@v3
3338
with:
3439
username: ${{ secrets.DOCKERHUB_USERNAME_NARAMSIM }}

‎.github/workflows/docker-k8s.yml‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ name: Container
22

33
on:
44
pull_request:
5+
paths:
6+
- "**.py"
7+
- "**.toml"
8+
- "**.lock"
9+
- "data/**"
10+
- "docker-compose**"
11+
- "Resources/docker/**"
12+
- "Resources/k8s/**"
13+
- "Resources/kind/**"
14+
- Makefile
15+
- .github/workflows/docker-k8s.yml
516

617
jobs:
718
docker:
@@ -107,8 +118,8 @@ jobs:
107118
uses: actions/checkout@v6
108119
- name: Build dev environment
109120
run: |
110-
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d
111-
sleep 30
121+
make docker-dev-up
122+
sleep 5
112123
- name: Assert containers running
113124
run: |
114125
last_command=$(docker ps | grep 'pokeapi-' | wc -l)

‎.github/workflows/nix-environment.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ name: Nix Environment
22

33
on:
44
pull_request:
5+
paths: &paths
6+
- "**.py"
7+
- "**.toml"
8+
- "**.lock"
9+
- default.nix
10+
- Makefile
11+
- .github/workflows/nix-environment.yml
512
push:
613
branches:
714
- master
15+
paths: *paths
816

917
jobs:
1018
nix-test:

‎.github/workflows/release.yml‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ name: Release
22

33
on:
44
push:
5+
paths:
6+
- "**.py"
7+
- "**.toml"
8+
- "**.lock"
9+
- "data/**"
10+
- Makefile
11+
- .github/actions/setup-uv/action.yml
12+
- .github/workflows/release.yml
513
branches:
614
- master
715
tags:
@@ -18,27 +26,24 @@ jobs:
1826
submodules: recursive
1927
- name: Start pokeapi (docker)
2028
run: |
21-
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d
29+
make docker-dev-up
2230
make docker-migrate
2331
make docker-build-db
2432
- name: Dump PG db
25-
run: docker compose exec -T -u postgres db sh -c "cd /tmp && pg_dump -h localhost -Fc -U ash -N 'hdb_*' pokeapi > pokeapi.pgdump"
26-
- name: Copy PG dump
27-
run: |
28-
docker compose cp db:/tmp/pokeapi.pgdump ./
29-
ls -larth
33+
run: make docker-dump-db
34+
- name: List folder
35+
run: ls -larth
3036
- name: Setup uv
3137
uses: ./.github/actions/setup-uv
32-
- name: Start pokeapi
38+
- name: Generate SQLite db
3339
run: |
3440
rm -rf .venv
3541
make install-base
3642
make setup
3743
make build-db
38-
nohup make serve &
3944
sleep 3
4045
- name: Release tag
41-
uses: softprops/action-gh-release@v3.0.1
46+
uses: softprops/action-gh-release@v3.0.2
4247
if: startsWith(github.ref, 'refs/tags/')
4348
with:
4449
draft: true
@@ -48,7 +53,7 @@ jobs:
4853
db.sqlite3
4954
generate_release_notes: true
5055
- name: Release master branch
51-
uses: softprops/action-gh-release@v3.0.1
56+
uses: softprops/action-gh-release@v3.0.2
5257
if: github.ref == 'refs/heads/master'
5358
with:
5459
body: |

‎CONTRIBUTORS.txt‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎Makefile‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ openapi-generate: check-uv
6262
docker-up: # (Docker) Create services/volumes/networks
6363
docker compose up -d
6464

65+
docker-dev-up: # (Docker) Build local pokeapi image and create services/volumes/networks
66+
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d --build
67+
6568
docker-migrate: # (Docker) Run any pending migrations
6669
docker compose exec -T app python manage.py migrate ${docker_config}
6770

@@ -95,6 +98,14 @@ docker-prod:
9598

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

101+
docker-dump-db:
102+
docker compose exec -T db pg_dump -U ash -Fc -N 'hdb_*' pokeapi > pokeapi.pgdump
103+
104+
docker-restore-db:
105+
docker compose exec -T db psql -U ash -d postgres -c "DROP DATABASE pokeapi WITH (FORCE);"
106+
docker compose exec -T db psql -U ash -d postgres -c "CREATE DATABASE pokeapi;"
107+
docker compose exec -T db pg_restore -U ash -d pokeapi < pokeapi.pgdump
108+
98109
format: check-uv # Format the source code
99110
uv run ruff format .
100111

File renamed without changes.

0 commit comments

Comments
 (0)