Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Paths (relative to the plugin dir) excluded from the distributable ZIP and the WP.org SVN deploy
# Read by bin/build-zip.php; CI deploys the extracted ZIP, so this file defines what reaches WP.org.
/.git
/.github
/.vscode
/.wordpress-org
/node_modules
/vendor
/tests
/build
.distignore
.gitignore
.gitattributes
.editorconfig
.DS_Store
Thumbs.db
README.md
composer.json
composer.lock
package.json
package-lock.json
phpcs.xml
phpcs.xml.dist
.phpcs.xml.dist
phpstan.neon
phpstan.neon.dist
*.log
*.map
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# WordPress coding standards: tabs, LF, UTF-8.
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.{yml,yaml,json}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Line endings: always LF (WordPress Coding Standards; CI runs on Linux).
* text=auto eol=lf
*.png binary
*.jpg binary
*.gif binary
*.pdf binary
*.zip binary

# Export only the plugin directory in GitHub-generated source zips

# 1) Exclude everything by default
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# GitHub Actions Workflows

Два workflow-а: **QA** проверява всяка промяна, **Complete Release Pipeline** пуска версия само ако QA мине.

## `ci.yml` — QA

**Кога:** push в `main`/`dev`, PR към `main`/`dev`, ръчно, или извикан от `release.yml`.

| Job | Какво проверява |
|---|---|
| Version consistency | `Version:` в header-а = `Stable tag` в readme = `BIZZIO_SYNC_GENCLOUD_VERSION` = fallback в core класа; има changelog запис; при таг — тагът съвпада (`bin/check-versions.php`) |
| PHP 7.4 … 8.5 syntax | `php -l` на всеки PHP файл за всяка поддържана версия |
| PHPCS + PHPStan | WordPress Coding Standards + PHPCompatibilityWP (`phpcs.xml.dist`), PHPStan level 5 с WP/WC stubs (`phpstan.neon.dist`); грешките излизат като анотации в PR-а |
| Plugin Check | Официалният WP.org Plugin Check (strict + experimental) върху **билднатия ZIP**, т.е. точно това, което ще се качи |

Версиите на инструментите са заключени в `composer.lock`, затова локално и в CI резултатът е еднакъв.

## `release.yml` — Complete Release Pipeline

```
QA (ci.yml) ──► Build ZIP ──┬─► GitHub Release
└─► WordPress.org SVN (trunk + tags/<version>)
```

**Как се пуска версия:**
```bash
# 1. Вдигни версията: header + константа + fallback в core класа + readme (Stable tag + changelog)
composer qa # локално: PHPCS + PHPStan + Plugin Check (LocalWP)
php bin/check-versions.php # трябва да отпечата новата версия
# 2. merge в main, после:
git tag v1.2.3 && git push origin v1.2.3
```

- При **таг `v*`**: QA → build → GitHub Release → deploy в WordPress.org.
- **Ръчно** (Actions → Complete Release Pipeline → Run workflow): QA → build → GitHub Release; deploy в WP.org само ако `deploy-to-wporg = true`.
- Всичко се билдва от тагнатия комит, а не от `main`.
- ZIP-ът се прави с `bin/build-zip.php` по `.distignore` (в корена на репото). В WP.org се качва съдържанието на същия ZIP.
- Банери/иконки за WP.org: сложи ги в `.wordpress-org/` в корена — 10up action-ът ги качва в `assets/`.

**Тайни:** `WP_SVN_USERNAME`, `WP_SVN_PASSWORD`.
**Environment:** deploy job-ът ползва environment `wordpress.org`. В Settings → Environments може да се добави задължително одобрение преди качване.

## Локално (същите проверки)

| Команда | Какво прави |
|---|---|
| `composer lint` / `composer lint:fix` | PHPCS / PHPCBF |
| `composer analyse` | PHPStan |
| `composer plugin-check` | Plugin Check в LocalWP сайта от `wp-cli.local.yml` |
| `composer build` | `build/bizzio-sync-for-woocommerce.zip` |
| `composer qa` | версии + lint + analyse + plugin-check |

Тестовият сайт се настройва с `bin/setup-local-site.sh` (виж коментара в скрипта).
112 changes: 112 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Quality gate for the free WP.org plugin. Runs on every push/PR and is called by release.yml,
# so nothing is built or deployed unless all of these pass.
name: QA

on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
workflow_call:

permissions:
contents: read

concurrency:
group: qa-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PLUGIN_SLUG: bizzio-sync-for-woocommerce

jobs:
versions:
name: Version consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
coverage: none

- name: Plugin header, readme, constants and changelog agree
run: |
tag=""
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then tag="${GITHUB_REF_NAME}"; fi
php bin/check-versions.php "$tag"

php-lint:
name: PHP ${{ matrix.php }} syntax
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# readme.txt "Requires PHP: 7.4" up to the newest supported release.
php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"]
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: php -l
run: |
failed=0
while IFS= read -r -d '' file; do
out=$(php -l "$file" 2>&1) || { echo "$out"; failed=1; }
done < <(find "$PLUGIN_SLUG" -name '*.php' -print0)
exit "$failed"

static-analysis:
name: PHPCS (WPCS) + PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
coverage: none
tools: cs2pr

- uses: ramsey/composer-install@v3

- name: PHPCS – WordPress Coding Standards + PHPCompatibilityWP
run: vendor/bin/phpcs --no-cache --report-full --report-checkstyle=./phpcs-report.xml

- name: PHPCS annotations
if: ${{ always() && hashFiles('phpcs-report.xml') != '' }}
run: cs2pr ./phpcs-report.xml --graceful-warnings

- name: PHPStan
run: vendor/bin/phpstan analyse --memory-limit=2G --no-progress --error-format=github

plugin-check:
name: Plugin Check (WP.org)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
coverage: none

# Check exactly what will be shipped: the ZIP built with .distignore, not the repo folder.
- name: Build distributable
run: |
php bin/build-zip.php "$PLUGIN_SLUG" build
mkdir -p build/dist
unzip -q "build/$PLUGIN_SLUG.zip" -d build/dist

- name: Run Plugin Check
uses: wordpress/plugin-check-action@v1
with:
build-dir: build/dist/${{ env.PLUGIN_SLUG }}
include-experimental: true
strict: true
29 changes: 0 additions & 29 deletions .github/workflows/deploy-assets.yml

This file was deleted.

87 changes: 0 additions & 87 deletions .github/workflows/deploy-wporg.yml

This file was deleted.

Loading
Loading