deploy step #36
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: Deploy | |
on: [ push ] | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
env: | |
DB_DATABASE: testing | |
DB_USER: root | |
DB_PASSWORD: root | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up MySQL | |
run: | | |
sudo /etc/init.d/mysql start | |
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: zip, sqlite3 | |
coverage: none | |
- name: Install composer dependencies | |
run: composer install --no-cache --no-ansi --no-interaction --no-progress | |
- name: Install node dependencies | |
run: npm i | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Format code | |
run: | | |
echo "running eslint and prettier..." | |
npm run format | |
echo "running php-cs-fixer..." | |
vendor/bin/php-cs-fixer fix | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Build frontend | |
run: | | |
npm run build | |
- name: Execute tests | |
env: | |
DB_USERNAME: root | |
DB_PASSWORD: root | |
run: php artisan test |