Add docker #30
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: 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: 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 |