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
4 changes: 3 additions & 1 deletion .docheader
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* This source file is subject to the license bundled
* with this source code in the file LICENSE.
*
* @link https://github.com/php-fast-forward/container
* @copyright Copyright (c) 2025-%year% Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
* @license https://opensource.org/licenses/MIT MIT License
*
* @see https://github.com/php-fast-forward/container
* @see https://github.com/php-fast-forward
* @see https://datatracker.ietf.org/doc/html/rfc2119
*/
6 changes: 0 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
/.github/ export-ignore
/tests/ export-ignore
/.docheader export-ignore
/.dockerignore export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.php export-ignore
/docker-compose export-ignore
/Dockerfile export-ignore
/infection.json5 export-ignore
/phpunit.xml export-ignore
17 changes: 17 additions & 0 deletions .github/workflows/reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Fast Forward Reports"

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

jobs:
reports:
uses: php-fast-forward/dev-tools/.github/workflows/reports.yml@main
secrets: inherit
98 changes: 9 additions & 89 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,15 @@
name: Run PHPUnit Tests
name: "Fast Forward Test Suite"

on:
workflow_dispatch:
pull_request:
push:
branches: [ "main" ]
push:
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false
contents: write
pages: write
id-token: write

jobs:
tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.head_ref || github.ref_name }}

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install dependencies
uses: php-actions/composer@v6
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }'
with:
php_version: '8.4'

- name: Run PHPUnit tests
uses: php-actions/phpunit@v3
env:
XDEBUG_MODE: coverage
with:
php_version: '8.4'
php_extensions: pcov

- name: Ensure minimum code coverage
env:
MINIMUM_COVERAGE: 80
run: |
COVERAGE=$(php -r '
$xml = new SimpleXMLElement(file_get_contents("public/coverage/clover.xml"));
$m = $xml->project->metrics;
$pct = (int) round(((int) $m["coveredstatements"]) * 100 / (int) $m["statements"]);
echo $pct;
')
echo "Coverage: ${COVERAGE}%"
if [ "${COVERAGE}" -lt ${{ env.MINIMUM_COVERAGE }} ]; then
echo "Code coverage below ${{ env.MINIMUM_COVERAGE }}% threshold."
exit 1
fi

- name: Generate phpDocumentor API Docs
uses: php-actions/composer@v6
with:
php_version: '8.4'
command: 'docs'

- name: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: public/

deploy:
name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
needs: tests
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
tests:
uses: php-fast-forward/dev-tools/.github/workflows/tests.yml@main
secrets: inherit
124 changes: 12 additions & 112 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,17 @@
name: Update Wiki
name: "Fast Forward Wiki Update"

on:
workflow_dispatch:
pull_request:
push:
branches: [ "main" ]
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
id-token: write
contents: write
pages: write
id-token: write

jobs:
wiki:
name: Update Wiki
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: '${{ github.token }}'
submodules: recursive

- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install dependencies
uses: php-actions/composer@v6
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }'
with:
php_version: '8.4'

- name: Create Docs Markdown
uses: php-actions/composer@v6
with:
php_version: '8.4'
command: 'docs'

- name: Commit & push changes in wiki submodule
id: wiki_commit
working-directory: docs/wiki
run: |
echo "Status before commit (submodule docs/wiki):"
git status --porcelain || true

changed="false"

if [ -z "$(git status --porcelain)" ]; then
echo "wiki_changed=$changed" >> "$GITHUB_OUTPUT"
exit 0
fi

default_branch="$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"

if [ -z "$default_branch" ]; then
default_branch="main"
fi

git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"

git add .

if git diff --cached --quiet; then
echo "wiki_changed=$changed" >> "$GITHUB_OUTPUT"
exit 0
fi

git commit -m "Update wiki docs at $(date "+%Y-%m-%d %H:%M:%S")"
git push origin "$default_branch"

changed="true"
echo "wiki_changed=$changed" >> "$GITHUB_OUTPUT"

- name: Update submodules
id: update
run: git submodule update --remote --recursive

- name: Check if parent repo has submodule pointer changes
id: changes
if: steps.wiki_commit.outputs.wiki_changed == 'true'
run: |
git status --porcelain
echo "wiki_changed='${{ steps.wiki_commit.outputs.wiki_changed }}'"

git add docs/wiki

changed="false"

if ! git diff --cached --quiet; then
changed="true"
fi

echo "changed=$changed" >> "$GITHUB_OUTPUT"

- name: Add and commit parent repo
if: steps.changes.outputs.changed == 'true'
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git commit -m "Update wiki submodule pointer at $(date "+%Y-%m-%d %H:%M:%S")"

- name: Push changes (parent repo)
if: steps.changes.outputs.changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.ref_name }}
wiki:
uses: php-fast-forward/dev-tools/.github/workflows/wiki.yml@main
secrets: inherit
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# Project-specific files
.idea/
.phpdoc/
.vscode/
public/
tmp/
vendor/
composer.lock
*.cache

# GitHub Actions
DOCKER_ENV
Dockerfile-php-build
docker_tag
output.log
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "docs/wiki"]
path = docs/wiki
[submodule ".github/wiki"]
path = .github/wiki
url = https://github.com/php-fast-forward/container.wiki.git
26 changes: 0 additions & 26 deletions .php-cs-fixer.php

This file was deleted.

Loading
Loading