quick fix #12
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
| # Naziv workflow-a koji će se videti u GitHub Actions tabu | |
| name: CI | |
| # Kada se pipeline pokreće | |
| on: | |
| push: | |
| branches: ["main", "develop", "feature/**"] | |
| pull_request: | |
| branches: ["main", "develop"] | |
| # Minimalne dozvole – samo čitanje repozitorijuma | |
| permissions: | |
| contents: read | |
| # Ako se uradi više push-eva brzo → stari pipeline se prekida | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ========================= | |
| # BACKEND – LARAVEL TESTOVI | |
| # ========================= | |
| backend-tests: | |
| name: Backend (Laravel) - tests | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_DATABASE: crmnekretnine_test | |
| MYSQL_USER: crm | |
| MYSQL_PASSWORD: crm | |
| MYSQL_ROOT_PASSWORD: root | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.2" | |
| extensions: mbstring, dom, fileinfo, pdo_mysql | |
| coverage: none | |
| - name: Cache Composer | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| laravel/vendor | |
| ~/.composer/cache/files | |
| key: ${{ runner.os }}-composer-${{ hashFiles('laravel/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Install dependencies (Composer) | |
| working-directory: laravel | |
| run: composer install --no-interaction --prefer-dist --no-progress | |
| - name: Prepare .env for tests | |
| working-directory: laravel | |
| run: | | |
| cp .env.example .env | |
| php artisan key:generate | |
| php artisan config:clear | |
| - name: Run migrations (mysql) | |
| working-directory: laravel | |
| env: | |
| APP_ENV: testing | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: crmnekretnine_test | |
| DB_USERNAME: crm | |
| DB_PASSWORD: crm | |
| run: php artisan migrate --force | |
| - name: Run PHPUnit tests | |
| working-directory: laravel | |
| env: | |
| APP_ENV: testing | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: crmnekretnine_test | |
| DB_USERNAME: crm | |
| DB_PASSWORD: crm | |
| run: php artisan test |