fix(EnvironmentLoader): remove invalid @var PHPDoc on constructor pro… #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
| name: Maatify Bootstrap Tests | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| GH_START_ISO: ${{ github.event.head_commit.timestamp }} | |
| APP_ENV: testing | |
| strategy: | |
| matrix: | |
| php: [ "8.4" ] # ✅ Only 8.4 supported officially | |
| steps: | |
| - name: 🛎️ Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: ⚙️ Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| extensions: mbstring, intl, bcmath, redis | |
| tools: composer:v2 | |
| - name: ♻️ Cache Composer packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.composer/cache | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: 📦 Install dependencies | |
| run: composer install --no-interaction --no-progress --prefer-dist | |
| - name: Run PHPStan | |
| id: phpstan | |
| run: | | |
| ( | |
| set +e | |
| composer analyse > phpstan_output.txt | |
| ANALYSE_EXIT=$? | |
| echo "phpstan_exit=$ANALYSE_EXIT" >> $GITHUB_OUTPUT | |
| ERRORS=$(grep -Eo "Found ([0-9]+) errors" phpstan_output.txt | grep -Eo "[0-9]+") | |
| if [ -z "$ERRORS" ]; then ERRORS=0; fi | |
| echo "phpstan_errors=$ERRORS" >> $GITHUB_OUTPUT | |
| ) | |
| echo "PHPStan step completed without failing CI." | |
| - name: 🧪 Run PHPUnit Tests | |
| id: tests | |
| run: | | |
| vendor/bin/phpunit --configuration phpunit.xml | tee phpunit.log | |
| continue-on-error: true | |
| - name: 📄 Validate README & composer.json | |
| run: | | |
| test -f README.md | |
| composer validate --no-check-all | |
| - name: 🧾 Summary Report | |
| if: always() | |
| run: | | |
| echo "### 🧾 Bootstrap Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "📦 Environment: $APP_ENV" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| tail -n 20 phpunit.log >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if grep -q "FAILURES!" phpunit.log; then | |
| echo "❌ Some tests failed." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "✅ All tests passed successfully." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.phpstan.outputs.phpstan_errors }}" -eq 0 ]; then | |
| echo "🧹 PHPStan: Passed (0 errors)." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ PHPStan: ${{ steps.phpstan.outputs.phpstan_errors }} errors detected." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: 🐳 Docker Build Check | |
| run: docker build -t maatify/bootstrap:test -f docker/Dockerfile . | |
| - name: 📲 Notify Telegram | |
| if: always() | |
| env: | |
| TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CI_CHAT_ID }} | |
| run: | | |
| START_TS=$(date -u -d "$GH_START_ISO" +%s) | |
| END_TS=$(date +%s) | |
| START_TIME=$(date -u -d "@$START_TS" +"%H:%M:%S UTC") | |
| END_TIME=$(date -u +"%H:%M:%S UTC") | |
| DURATION=$((END_TS - START_TS)) | |
| if [ "$DURATION" -lt 60 ]; then | |
| DURATION_STR="${DURATION}s" | |
| else | |
| DURATION_STR="$(($DURATION / 60))m $(($DURATION % 60))s" | |
| fi | |
| STATUS="✅ Tests passed successfully!" | |
| COLOR="🟢" | |
| HEADER="Maatify CI Report (${GITHUB_REPOSITORY})" | |
| if grep -q "FAILURES!" phpunit.log || [ "${{ job.status }}" != "success" ]; then | |
| STATUS="❌ Some tests failed. Please review the log." | |
| COLOR="🔴" | |
| HEADER="Maatify CI Alert (${GITHUB_REPOSITORY})" | |
| fi | |
| PROJECT="maatify/bootstrap" | |
| BRANCH="$GITHUB_REF_NAME" | |
| ACTOR="$GITHUB_ACTOR" | |
| URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" | |
| PHPSTAN_ERRORS="${{ steps.phpstan.outputs.phpstan_errors }}" | |
| if [ "$PHPSTAN_ERRORS" -eq 0 ]; then | |
| PHPSTAN_SUMMARY="🧹 <b>PHPStan:</b> Passed (0 errors)" | |
| else | |
| PHPSTAN_SUMMARY="🧹 <b>PHPStan:</b> ${PHPSTAN_ERRORS} errors detected" | |
| fi | |
| MESSAGE="📢 <b>${HEADER}</b> | |
| ${COLOR} ${STATUS} | |
| ${PHPSTAN_SUMMARY} | |
| 📦 <b>Project:</b> ${PROJECT} | |
| 🧱 <b>Branch:</b> ${BRANCH} | |
| 👷♂️ <b>Committer:</b> ${ACTOR} | |
| ⏱ <b>Start:</b> ${START_TIME} | |
| 🕒 <b>End:</b> ${END_TIME} | |
| 📈 <b>Duration:</b> ${DURATION_STR} | |
| 🔗 <a href='${URL}'>View Run Log</a>" | |
| PAYLOAD=$(jq -n \ | |
| --arg chat_id "$TELEGRAM_CHAT_ID" \ | |
| --arg text "$MESSAGE" \ | |
| --arg parse_mode "HTML" \ | |
| '{chat_id: $chat_id, text: $text, parse_mode: $parse_mode}') | |
| RESPONSE=$(curl -s -o /tmp/tg_resp.json -w "%{http_code}" \ | |
| -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD") | |
| echo "Raw Telegram Response (HTTP $RESPONSE):" | |
| cat /tmp/tg_resp.json | |
| if [ "$RESPONSE" -ne 200 ]; then | |
| echo "⚠️ Telegram notification failed (HTTP $RESPONSE)" >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/tg_resp.json >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "✅ Telegram notification sent successfully." >> $GITHUB_STEP_SUMMARY | |
| fi | |