fix: use proper database and debugging configurations #11
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
name: Build template | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DB_DATABASE: db | |
DB_USER: root | |
DB_PASSWORD: root | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start MySQL | |
run: | | |
sudo systemctl start mysql -u root | |
mysql -e "CREATE DATABASE IF NOT EXISTS db;" -u root | |
- name: Build docker image | |
run: | | |
docker compose build | |
docker compose run --rm web composer install | |
docker compose run --rm web php artisan migrate --force | |
- name: Run docker container | |
run: docker compose up -d | |
- name: Test if service is reachable | |
run: | | |
sleep 30 | |
curl -v -s --retry 10 --retry-connrefused http://localhost:8000/ | |
- name: Report error to Sentry | |
if: failure() | |
run: | | |
curl -sL https://sentry.io/get-cli/ | bash | |
export SENTRY_DSN=${{ secrets.SENTRY_DSN }} | |
MESSAGE_HEAD='Template: "${{ github.workflow }}" failed in ${{ github.repository }}.' | |
MESSAGE_BODY='Check <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}> for more details.' | |
sentry-cli send-event -m "$MESSAGE_HEAD" -m "$MESSAGE_BODY" --log-level=error |