Skip to content

feat: add support for php 8.3 #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2024
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
13 changes: 8 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.git/
nbproject/
vendor/
build/
.phpdoc/
**/*.cache
**/composer.lock
vendor
tools/vendor
**/composer.lock
**/tests/.phpunit.result.cache
**/build/
# From tools/cache/.gitignore
tools/cache/**/*
!tools/cache/**/.gitignore
14 changes: 12 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
version: 2
updates:
- package-ecosystem: composer
versioning-strategy: widen
directory: "/"
versioning-strategy: increase
directories:
- "/"
- "/tools"
schedule:
interval: weekly
day: friday
time: "04:00"
groups:
dev-dependencies:
dependency-type: development

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: friday
time: "04:00"
groups:
github-actions-dependencies:
patterns:
- "*"
77 changes: 77 additions & 0 deletions .github/workflows/__shared-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Shared - Continuous Integration for common tasks

on:
workflow_call:

jobs:
checks:
strategy:
matrix:
include:
- php-versions: "8.1"
- php-versions: "8.2"
- php-versions: "8.3"
stable: true

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: ⚙️ Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: none,iconv,dom,curl,mbstring,tokenizer,xml,xmlwriter,simplexml,ctype
coverage: pcov

- name: ♻️ Get composer cache directory
id: composer-cache
shell: bash
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.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: ⚙️ Install dependencies
shell: bash
run: |
composer install --no-progress --prefer-dist --optimize-autoloader
composer --working-dir=tools install --no-progress --prefer-dist --optimize-autoloader

- name: ♻️ Tools cache
uses: actions/cache@v4
with:
path: tools/cache
key: ${{ runner.os }}-tools-${{ github.sha }}
restore-keys: |
${{ runner.os }}-tools-

- name: 👕 Lint
if: matrix.stable
run: composer php-cs-fixer -- --format=checkstyle | tools/vendor/bin/cs2pr

- name: 🔬 Static analysis
if: matrix.stable
run: composer stan -- --error-format=checkstyle | tools/vendor/bin/cs2pr

- name: ♻️ Tests cache
uses: actions/cache@v4
with:
path: tests/.phpunit.result.cache
key: ${{ runner.os }}-tests-${{ github.sha }}
restore-keys: |
${{ runner.os }}-tests-

- name: 🧪 Test
run: composer test:ci

- name: 📊 Upload coverage results to Codecov
if: matrix.stable
uses: codecov/codecov-action@v5
with:
files: ./build/logs/clover.xml
62 changes: 0 additions & 62 deletions .github/workflows/continuous-integration.yml

This file was deleted.

110 changes: 110 additions & 0 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Main - Continuous Integration

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

on:
push:
branches:
- main

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

jobs:
ci:
name: Continuous Integration
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit

docs-generate-site:
runs-on: ubuntu-latest
needs: ci
steps:
- uses: actions/checkout@v4
- run: |
mkdir -p ./_site

echo -e "theme: jekyll-theme-cayman" > ./_site/_config.yml

to_title_case() {
echo "$1" | awk '{
for (i=1; i<=NF; i++) {
$i = toupper(substr($i, 1, 1)) tolower(substr($i, 2))
}
print
}'
}

create_site_page() {
page="$1"
title="$(to_title_case "$2")"
content_path="$3"
echo -e "---\nlayout: default\ntitle: $title\n---\n" > "$page"
echo "$(sed -r s"/(\{%[^%]+%\})/{% raw %}\1{% endraw %}/g" "$content_path")" >> "$page"
}

create_site_page "./_site/index.md" "Home" "./README.md"

for filepath in ./docs/*.md; do
filename=$(basename -- "$filepath")
section="${filename%.*}"
mkdir -p "./_site/$section"
create_site_page "./_site/$section/index.md" "$section" "$filepath"
done

- uses: actions/upload-artifact@v4
with:
name: docs-site
path: ./_site

docs-generate-phpdoc:
runs-on: ubuntu-latest
needs: ci
steps:
- uses: actions/checkout@v4

- name: 📃 Generate PHP documentation
run: docker run --rm -v $(pwd):/data phpdoc/phpdoc:3 -d ./src -t ./_site/phpdoc

- uses: actions/upload-artifact@v4
with:
name: docs-phpdoc
path: ./_site

docs-publish:
name: Publish documentation
needs: [docs-generate-site, docs-generate-phpdoc]
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:

- uses: actions/download-artifact@v4
with:
pattern: 'docs-*'
path: ./
merge-multiple: true

- name: ⚙️ Setup Pages
uses: actions/configure-pages@v5

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

- name: 🚀 Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
21 changes: 21 additions & 0 deletions .github/workflows/need-fix-to-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Need fix to Issue

on:
push:
branches:
- main
workflow_dispatch:
inputs:
manual-commit-ref:
description: "The SHA of the commit to get the diff for"
required: true
manual-base-ref:
description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here"
required: false

jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@0.15.0
with:
manual-commit-ref: ${{ inputs.manual-commit-ref }}
manual-base-ref: ${{ inputs.manual-base-ref }}
63 changes: 0 additions & 63 deletions .github/workflows/publish.yml

This file was deleted.

Loading