diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..93b3ecc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: โœ… CI + +on: + push: + branches: [main] + pull_request: + workflow_call: {} + +jobs: + php-lint: + name: ๐Ÿ” PHP syntax check + runs-on: ubuntu-24.04 + + steps: + - name: ๐Ÿ“ฅ Checkout code + uses: actions/checkout@v6 + + - name: ๐Ÿ˜ Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: none + + - name: ๐Ÿ” Validate PHP syntax + run: git ls-files | grep '\.php$' | xargs -P4 -I{} php -l {} + + tests: + name: ๐Ÿงช Run tests + runs-on: ubuntu-24.04 + + steps: + - name: ๐Ÿ“ฅ Checkout code + uses: actions/checkout@v6 + + - name: ๐Ÿ˜ Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + extensions: intl, sockets, sqlite3, pdo_sqlite + coverage: none + + - name: ๐Ÿ“ฆ Install dependencies + run: composer install --no-interaction --prefer-dist --no-progress + + - name: ๐Ÿ›ก๏ธ Audit dependencies + run: composer audit + + - name: ๐ŸŽจ Check code style + run: vendor/bin/pint --test + + - name: ๐Ÿงฐ Prepare environment + run: | + cp .env.example .env + php artisan key:generate + + - name: ๐Ÿงช Run test suite + run: php artisan test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fabad01..21b43c1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,40 +12,14 @@ env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: - php-lint: - name: ๐Ÿ” PHP syntax check - runs-on: ubuntu-24.04 - - steps: - - name: ๐Ÿ“ฅ Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: ๐Ÿ˜ Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.4' - tools: none - - - name: ๐Ÿ” Validate PHP syntax - run: | - PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") - if [ -z "$PREVIOUS_TAG" ]; then - FILES=$(git ls-files | grep '\.php$' || true) - else - FILES=$(git diff --name-only --diff-filter=d "$PREVIOUS_TAG"..HEAD | grep '\.php$' || true) - fi - if [ -z "$FILES" ]; then - echo "No PHP files changed since last tag." - exit 0 - fi - echo "$FILES" | xargs -P4 -I{} php -l {} + ci: + name: โœ… CI + uses: ./.github/workflows/ci.yml setup: name: ๐Ÿ” Extract version runs-on: ubuntu-24.04 - needs: [php-lint] + needs: [ci] outputs: version: ${{ steps.get_version.outputs.VERSION }} prerelease: ${{ steps.get_version.outputs.PRERELEASE }} @@ -195,13 +169,17 @@ jobs: - name: ๐Ÿค– Generate release notes id: ai_notes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_VERSION: ${{ needs.setup.outputs.version }} + COMMIT_LOG: ${{ steps.commits.outputs.LOG }} run: | RESPONSE=$(curl -s https://models.inference.ai.azure.com/chat/completions \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Authorization: Bearer $GH_TOKEN" \ -H "Content-Type: application/json" \ -d "$(jq -n \ - --arg version "${{ needs.setup.outputs.version }}" \ - --arg log "${{ steps.commits.outputs.LOG }}" \ + --arg version "$RELEASE_VERSION" \ + --arg log "$COMMIT_LOG" \ '{ model: "gpt-4o-mini", messages: [