Skip to content
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

Add initial functionality and tests #1

Merged
merged 5 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Exclude these files from release archives.
#
# This will also make the files unavailable when using Composer with `--prefer-dist`.
# If you develop using Composer, use `--prefer-source`.
#
# Via WPCS.
#
/.php_cs-fixer.dist.php export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
/.github export-ignore
/tests export-ignore

#
# Auto detect text files and perform LF normalization.
#
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
#
* text=auto

#
# The above will handle all files not found below.
#
*.md text
*.php text
*.inc text
23 changes: 23 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Summary

As titled.

## Notes for reviewers

None.

## Changelog entries

### Added

- Initial release.

### Changed

### Deprecated

### Removed

### Fixed

### Security
43 changes: 43 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PHPCS

on:
pull_request:

jobs:
coding-standards:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.1]

name: Coding Standards
steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}

- name: Check out code
uses: actions/checkout@v2

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Validate Composer config
run: composer validate --strict

- name: Install composer dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer install

- name: Run PHPCS
run: composer run phpcs
38 changes: 38 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PHPUnit

on:
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.1, 8.0, 7.4]
can_fail: [false]

name: PHP ${{ matrix.php }}
env:
CACHEDIR: /tmp/test-cache
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Install Composer dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer install

- name: Run PHPUnit
shell: bash
run: composer run phpunit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vendor
composer.lock
.php_cs.cache
.phpunit.result.cache
29 changes: 29 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the traverse/reshape package.
*
* (c) Alley <info@alley.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

$finder = PhpCsFixer\Finder::create()->in([
__DIR__ . '/src/',
__DIR__ . '/tests/',
]);

$config = new PhpCsFixer\Config();
$config->setRules([
'@PSR12' => true,
'@PHP80Migration' => true,

'native_constant_invocation' => true,
'native_function_casing' => true,
'native_function_invocation' => true,
'native_function_type_declaration_casing' => true,
]);
$config->setFinder($finder);

return $config;
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/).

## 1.0.0

Initial release.
Loading