Merge pull request #34 from agitnaeta/feat/rv5-header-2baris #23
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 | |
| on: | |
| push: | |
| branches: [ master, "upgrade/**" ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| phpunit: | |
| name: PHPUnit (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.2', '8.3'] | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: secret | |
| MYSQL_DATABASE: absensi_testing | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1 -u root --password=secret" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| env: | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: absensi_testing | |
| DB_USERNAME: root | |
| DB_PASSWORD: secret | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mbstring, pdo_mysql, bcmath, gd, zip, intl, exif | |
| coverage: none | |
| tools: composer:v2 | |
| - name: Cache Composer packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: composer-${{ matrix.php }}-${{ hashFiles('composer.lock') }} | |
| restore-keys: composer-${{ matrix.php }}- | |
| - name: Install dependencies | |
| run: composer install --no-interaction --prefer-dist --no-progress | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Build frontend assets (Vite) | |
| # Test yang me-render view butuh public/build/manifest.json. | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Install PyMuPDF (CV extraction) | |
| # CvExtractionService memakai python3 + pymupdf untuk baca teks PDF. | |
| run: pip install --quiet pymupdf | |
| - name: Prepare environment | |
| run: | | |
| cp .env.example .env | |
| php artisan key:generate | |
| # phpunit.xml hanya override DB_DATABASE; host/port/user/password diambil | |
| # dari .env — set eksplisit agar cocok dengan MySQL service di atas. | |
| sed -i 's/^DB_HOST=.*/DB_HOST=127.0.0.1/' .env | |
| sed -i 's/^DB_PORT=.*/DB_PORT=3306/' .env | |
| sed -i 's/^DB_DATABASE=.*/DB_DATABASE=absensi_testing/' .env | |
| sed -i 's/^DB_USERNAME=.*/DB_USERNAME=root/' .env | |
| sed -i 's/^DB_PASSWORD=.*/DB_PASSWORD=secret/' .env | |
| - name: Wait for MySQL | |
| run: | | |
| for i in $(seq 1 30); do | |
| if mysqladmin ping -h 127.0.0.1 -u root --password=secret --silent; then | |
| echo "MySQL is up"; break | |
| fi | |
| echo "waiting for mysql... ($i)"; sleep 2 | |
| done | |
| - name: Run migrations | |
| run: php artisan migrate --force --database=mysql | |
| env: | |
| DB_DATABASE: absensi_testing | |
| - name: Run PHPUnit | |
| # artisan test OOM di app ini (render menu) — pakai phpunit langsung + flag memory. | |
| run: php -d memory_limit=2G -d xdebug.mode=off vendor/bin/phpunit --no-coverage | |
| pint: | |
| name: Pint (style, informational) | |
| runs-on: ubuntu-latest | |
| # Non-blocking: repo masih punya utang style lama (290 file). Job ini | |
| # menampilkan pelanggaran tanpa memerahkan CI, sampai ada inisiatif | |
| # `pint` repo-wide terpisah. Setelah bersih, hapus continue-on-error. | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: none | |
| tools: composer:v2 | |
| - name: Install dependencies | |
| run: composer install --no-interaction --prefer-dist --no-progress | |
| - name: Check code style (Pint) | |
| run: vendor/bin/pint --test |