Skip to content

Commit

Permalink
chore: init project
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 5, 2021
1 parent dd4bc85 commit e788709
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.3, 7.4, 8.0] # 7.2,
php: [8.0]
os: [ubuntu-latest, macOS-latest] # windows-latest,
# include: # will not testing on php 7.2
# - os: 'ubuntu-latest'
Expand Down
39 changes: 14 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.4]
php: [8.0]

steps:
- name: Checkout
Expand All @@ -32,39 +32,28 @@ jobs:
with:
php-version: ${{ matrix.php}}
tools: pecl, php-cs-fixer, phpunit
extensions: mbstring, dom, fileinfo, mysql, openssl # , swoole-4.4.19 #optional, setup extensions
extensions: mbstring, dom, fileinfo, openssl # , swoole-4.4.19 #optional, setup extensions
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
coverage: none #optional, setup coverage driver: xdebug, none

- name: Install dependencies # eg: v1.0.3
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

- name: Install dependencies
run: |
echo $RELEASE_TAG
echo $RELEASE_NAME
tag1=${GITHUB_REF#refs/*/}
echo "release tag: ${tag1}"
composer update --no-progress
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context
# - name: Generate changelog file
# id: changelog
# run: |
# php bin/kite gh cl prev $RELEASE_TAG --style gh-release --no-merges --fetch-tags --unshallow --file tmp/changelog-${RELEASE_TAG}.md
# cat tmp/changelog-${RELEASE_TAG}.md

# https://github.com/meeDamian/github-release
# - name: Create release and upload assets
# uses: meeDamian/github-release@2.0
# with:
# gzip: false
# token: ${{ secrets.GITHUB_TOKEN }}
# tag: ${{ env.RELEASE_TAG }}
# name: ${{ env.RELEASE_TAG }}
# body: |
# ${{ steps.changelog.outputs.CHLOGBODY }}
# files: kite-${{ env.RELEASE_TAG }}.phar
# more see https://github.com/inhere/kite
- name: Generate changelog file
id: changelog
run: |
wget -c -q https://github.com/inhere/kite/releases/latest/download/kite.phar
php kite.phar git cl prev last --style gh-release --no-merges --fetch-tags --unshallow --file changelog.md
cat changelog.md
# https://github.com/softprops/action-gh-release
- name: Create release and upload assets
Expand All @@ -73,7 +62,7 @@ jobs:
with:
name: ${{ env.RELEASE_TAG }}
tag_name: ${{ env.RELEASE_TAG }}
# body_path: tmp/changelog-${{ env.RELEASE_TAG }}.md
body_path: changelog.md
# files: kite-${{ env.RELEASE_TAG }}.phar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# php-pkg-template

[![License](https://img.shields.io/packagist/l/inherelab/php-pkg-template.svg?style=flat-square)](LICENSE)
[![Php Version](https://img.shields.io/badge/php-%3E=7.2.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/inherelab/php-pkg-template)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/inherelab/php-pkg-template)](https://github.com/inherelab/php-pkg-template)
[![Actions Status](https://github.com/inherelab/php-pkg-template/workflows/Unit-Tests/badge.svg)](https://github.com/inherelab/php-pkg-template/actions)
[![License](https://img.shields.io/packagist/l/phppkg/fasttpl.svg?style=flat-square)](LICENSE)
[![Php Version](https://img.shields.io/badge/php-%3E=7.4.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/phppkg/fasttpl)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/phppkg/fasttpl)](https://github.com/phppkg/fasttpl)
[![Actions Status](https://github.com/phppkg/fasttpl/workflows/Unit-Tests/badge.svg)](https://github.com/phppkg/fasttpl/actions)

TODO: package description
⚡️ Simple and fast template engine for PHP

## Install

**composer**

```bash
composer require inherelab/php-pkg-template
composer require phppkg/fasttpl
```

## Usage

- clone this repository to local
- update readme description
- search all `inherelab/php-pkg-template` and replace to your package name.
- search all `phppkg/fasttpl` and replace to your package name.
- update `composer.json` contents: name, description, require, autoload

## License
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"name": "inherelab/php-pkg-template",
"description": "TODO: package description",
"name": "phppkg/fasttpl",
"description": "⚡️ Simple and fast template engine for PHP",
"type": "template",
"license": "MIT",
"homepage": "https://github.com/inherelab/php-pkg-template",
"homepage": "https://github.com/phppkg/fasttpl",
"authors": [
{
"name": "inhere",
"email": "in.798@qq.com"
}
],
"require": {
"php": ">7.1.0",
"php": ">7.4.0",
"ext-mbstring": "*",
"toolkit/cli-utils":"~1.0"
},
"autoload": {
"psr-4": {
"InhereLab\\PhpPkg\\": "src/"
"PhpPkg\\FastTpl\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"InhereLab\\PhpPkgTest\\": "test/"
"PhpPkg\\FastTplTest\\": "test/"
}
},
"bin": [

],
"scripts": {
"test": "php vender/bin/phpunit"
Expand Down
10 changes: 7 additions & 3 deletions test/BaseTestCase.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php declare(strict_types=1);

namespace Toolkit\PFlagTest;
namespace PhpPkg\FastTplTest;

use PHPUnit\Framework\TestCase;
use ReflectionException;
use ReflectionMethod;
use RuntimeException;
use Throwable;

/**
* Class BaseTestCase
Expand Down Expand Up @@ -34,7 +38,7 @@ protected static function getMethod($class, string $method): ReflectionMethod
{
// $class = new \ReflectionClass($class);
// $method = $class->getMethod($method);

$method = new \ReflectionMethod($class, $method);
$method->setAccessible(true);

Expand All @@ -54,6 +58,6 @@ protected function runAndGetException(callable $cb): Throwable
return $e;
}

return new RuntimeException('NO ERROR');
return new RuntimeException('NO ERROR', -1);
}
}
4 changes: 2 additions & 2 deletions test/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

$libDir = dirname(__DIR__);
$npMap = [
'InhereLab\\PhpPkgTest\\' => $libDir . '/test/',
'InhereLab\\PhpPkg\\' => $libDir . '/src/',
'PhpPkg\\FastTplTest\\' => $libDir . '/test/',
'PhpPkg\\FastTpl\\' => $libDir . '/src/',
];

spl_autoload_register(static function ($class) use ($npMap) {
Expand Down

0 comments on commit e788709

Please sign in to comment.