Skip to content

Add docker

Add docker #36

Workflow file for this run

name: Laravel Pest Tests
on:
pull_request:
branches: [ "main" ]
jobs:
laravel-tests:
runs-on: ubuntu-latest
services:
docker:
image: docker
options: --privileged
ports:
- 3306:3306
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Copy password file
run: cp database/password.txt.example database/password.txt
- name: Copy .env file
run: cp .env.example .env
- name: Set app key
run: sed -i "s/APP_KEY=/APP_KEY=base64:$(openssl rand -base64 32)/" .env
- name: Set up Docker Compose
run: |
docker compose -f compose.testing.yaml up -d
- name: Run tests
run: |
docker compose -f compose.testing.yaml --env-file .env exec server-testing ./vendor/bin/pest tests
- name: Tear down Docker Compose
run: |
docker-compose -f compose.testing.yaml down