-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[maykinmedia/open-api-framework#96] Add quick-start.yml
- Loading branch information
1 parent
da504f5
commit c4f1038
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: quick-start | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
fixtures: | ||
required: false | ||
type: string | ||
|
||
superuser: | ||
required: false | ||
type: string | ||
|
||
web_service: | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Start docker containers | ||
run: docker compose up -d --build || ( docker compose logs >&2 && exit 1; ) | ||
- name: Wait for migrations to finish | ||
run: | | ||
echo "Waiting for migrations to complete..." | ||
until ! docker compose exec -T web src/manage.py showmigrations | grep -q '\[ \]'; do | ||
echo "Migrations not finished, waiting..." | ||
sleep 3 | ||
done | ||
- name: Load fixtures | ||
if: ${{ inputs.fixtures != '' }} | ||
run: docker compose exec -T web src/manage.py loaddata ${{ inputs.fixtures }} | ||
- name: Create superuser | ||
run: | | ||
SUPERUSER="${{ inputs.superuser || 'admin' }}" | ||
WEB_SERVICE="${{ inputs.web_service || 'web' }}" | ||
docker compose exec -T $WEB_SERVICE src/manage.py createsuperuser --username $SUPERUSER --email [email protected] --no-input | ||
- name: Check main page | ||
run: | | ||
curl_status=$(curl -w '%{http_code}' -o /dev/null -s http://localhost:8000/) | ||
if [[ $curl_status != 200 ]]; then | ||
printf "Index page responds with ${curl_status} status.\r\n\r\n" >&2 | ||
curl -i http://localhost:8000 | ||
exit 1 | ||
fi |