-
Notifications
You must be signed in to change notification settings - Fork 22
46 lines (44 loc) · 2.1 KB
/
run-tests-docker-compose-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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