Skip to content

Feature/Intergalactic Research Network #777

Feature/Intergalactic Research Network

Feature/Intergalactic Research Network #777

name: Docker Compose Build and Test
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.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 .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
- 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