Feature/Intergalactic Research Network #713
Workflow file for this run
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: Docker Compose Production Build and Test | |
# Note: This workflow will install ALL composer dependencies including dev packages in order to run tests. | |
# The separate workflow "Docker Compose Production Build" will install only production dependencies and will not run tests. | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
test-docker: | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:26.0.0 | |
options: --privileged | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Modify Dockerfile to disable USER www (which is not supported by GitHub Actions, as it runs as root) | |
run: | | |
sed -i '/USER www/s/^/#/' ./Dockerfile | |
- name: Set up Docker Compose | |
run: | | |
# Build the images and start the services | |
docker compose -f docker-compose.prod.yml up -d | |
# Ensure the database is ready | |
docker compose exec -T ogame-db bash -c 'until mariadb -h "ogame-db" -u "root" -p"toor" -e "SELECT 1"; do sleep 1; done' | |
- name: Set Permissions | |
run: docker compose exec -T ogame-app chmod -R 777 /var/www | |
- name: Copy .env | |
run: docker compose exec -T ogame-app cp .env.example-prod .env | |
- name: Run Laravel setup commands | |
run: | | |
docker compose exec -T ogame-app composer install | |
docker compose exec -T ogame-app php artisan key:generate | |
- name: Run DB Migrations | |
run: docker compose exec -T ogame-app php artisan migrate --force | |
- name: Run configuration cache commands | |
run: docker compose exec -T ogame-app php artisan cache:clear && docker compose exec -T ogame-app php artisan config:cache && docker compose exec -T ogame-app php artisan route:cache && docker compose exec -T ogame-app php artisan view:cache | |
- name: Run Tests | |
run: docker compose exec -T ogame-app php artisan test | |
- name: Run custom Race Condition Tests | |
run: | | |
docker compose exec -T ogame-app php artisan test:race-condition-unitqueue | |
docker compose exec -T ogame-app php artisan test:race-condition-game-mission |