Skip to content

Commit a834e41

Browse files
authored
Merge pull request #9 from maykinmedia/feature/add-quick-start
[maykinmedia/open-api-framework#96] Add quick-start.yml
2 parents 8881833 + ef5dbd1 commit a834e41

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/quick-start.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: quick-start
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
fixtures:
7+
required: false
8+
type: string
9+
10+
port:
11+
required: false
12+
type: string
13+
default: "8000"
14+
15+
jobs:
16+
run:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Start docker containers
21+
run: docker compose up -d --build || ( docker compose logs >&2 && exit 1; )
22+
- name: Wait for migrations to finish
23+
run: |
24+
echo "Waiting for migrations to complete..."
25+
until ! docker compose exec -T web src/manage.py showmigrations | grep -q '\[ \]'; do
26+
echo "Migrations not finished, waiting..."
27+
sleep 3
28+
done
29+
- name: Load fixtures
30+
if: ${{ inputs.fixtures != '' }}
31+
run: docker compose exec -T web src/manage.py loaddata ${{ inputs.fixtures }}
32+
- name: Check main page
33+
run: |
34+
curl_status=$(curl -w '%{http_code}' -o /dev/null -s http://localhost:${{ inputs.port }}/)
35+
if [[ $curl_status != 200 ]]; then
36+
printf "Index page responds with ${curl_status} status.\r\n\r\n" >&2
37+
curl -i http://localhost:${{ inputs.port }}
38+
exit 1
39+
fi

0 commit comments

Comments
 (0)