WIP #3410
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: Tests | |
on: | |
push: | |
pull_request: | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:latest | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
ports: | |
- 3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: none | |
php-version: 8.2 | |
- name: Setup MySQL database | |
run: mysql -u root -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} -e "CREATE DATABASE benjamincrozat_test" | |
- name: Setup Redis | |
uses: zhulik/redis-action@1.1.0 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Create .env file | |
run: cp .env.example .env | |
- name: Install back-end dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Generate encryption key | |
run: php artisan key:generate | |
- name: Install front-end dependencies | |
run: yarn | |
- name: Build CSS and JavaScript | |
run: yarn build | |
- name: Run tests | |
run: php artisan test | |
env: | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
DEPLOYMENT_URL: ${{ secrets.DEPLOYMENT_URL }} | |
TORCHLIGHT_TOKEN: ${{ secrets.TORCHLIGHT_TOKEN }} | |
- name: Deploy on production | |
run: curl -X POST ${{ secrets.DEPLOYMENT_URL }} | |
if: github.ref == 'refs/heads/main' && success() |