Fix CI #66
This file contains hidden or 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: CI/CD | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| container: abourtnik/laravel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: 📦 Install dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: ⚙️ Run PHPStan | |
| run: ./vendor/bin/phpstan analyse --memory-limit=2G | |
| test: | |
| runs-on: ubuntu-latest | |
| container: abourtnik/laravel | |
| services: | |
| mariadb: | |
| image: mariadb:11.6.2 | |
| env: | |
| MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: "yes" | |
| MARIADB_DATABASE: emojisworld_test | |
| options: >- | |
| --health-cmd="healthcheck.sh --connect --innodb_initialized" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: 📦 Install dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: ⚙️ Run tests | |
| run: php artisan test --env=testing --stop-on-failure | |
| build: | |
| runs-on: ubuntu-latest | |
| container: oven/bun | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: 📦 Install dependencies | |
| run: bun install | |
| - name: ⚙️ Build assets | |
| run: bun run build | |
| - name: ⬆️ Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: public-build | |
| path: public/build/ | |
| retention-days: 1 | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: [ lint, test, build ] | |
| environment: Production | |
| steps: | |
| - name: ⬇️ Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: public-build | |
| path: public/build/ | |
| - name: ⬇️ Upload build | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USERNAME }} | |
| key: ${{ secrets.SSH_KEY }} | |
| port: ${{ secrets.SSH_PORT }} | |
| source: public/build/* | |
| target: ${{ secrets.SSH_PATH }}/public/build/ | |
| strip_components: 2 | |
| - name: 🚀 Deploy updates | |
| uses: appleboy/ssh-action@v1.2.0 | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USERNAME }} | |
| key: ${{ secrets.SSH_KEY }} | |
| port: ${{ secrets.SSH_PORT }} | |
| script: | | |
| cd ${{ secrets.SSH_PATH }} | |
| make deploy |