Skip to content

Commit

Permalink
ci: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brokeyourbike committed May 14, 2023
1 parent 48af6c6 commit 13ee9a8
Show file tree
Hide file tree
Showing 11 changed files with 233 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/devcontainers/php:0-8.1

RUN apt-get update && apt-get install -y \
libzip-dev \
libxml2-dev

# Install php extensions
RUN docker-php-ext-install \
pdo \
pdo_mysql \
xml \
zip \
bcmath \
pcntl

# disable xdebug
RUN rm -f /usr/local/etc/php/conf.d/xdebug.ini

# set memory limit
RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini;

26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/php
{
"name": "parallex-bank-api-client-php",

// More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile"
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"bmewburn.vscode-intelephense-client",
"calebporzio.better-phpunit",
"neilbrayfield.php-docblocker",
"MehediDracula.php-namespace-resolver",
"GitHub.copilot"
]
}
}
}
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Auto detect text files and perform LF normalization
* text=auto

.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
.github/ export-ignore
tests/ export-ignore
phpunit.xml export-ignore
phpstan.neon export-ignore
psalm.xml export-ignore
17 changes: 17 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: release-please

on:
push:
branches:
- main

jobs:
update_release_draft:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: google-github-actions/release-please-action@v2
with:
release-type: php
bump-minor-pre-major: true
28 changes: 28 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: static analysis

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

jobs:
phpstan:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
php-version: [8.1]

steps:
- uses: actions/checkout@v3

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

- run: composer update --no-interaction --no-progress
- run: composer bin phpstan require phpstan/phpstan
- run: vendor/bin/phpstan analyze --no-progress
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: tests

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

jobs:
laravel-tests:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
php-version: [8.1]

steps:
- uses: actions/checkout@v3

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

- run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- nrun: vendor/bin/phpunit --coverage-clover=coverage.xml

- uses: paambaati/codeclimate-action@v4
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
with:
coverageCommand: ''
coverageLocations: ./coverage.xml:clover

- uses: codecov/codecov-action@v3
continue-on-error: true
with:
files: ./coverage.xml
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/vendor/
/vendor-bin/
node_modules/
npm-debug.log
yarn-error.log

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
public/storage
public/hot

# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot

storage/*.key
.env
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache
composer.lock
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
# parallex-bank-api-client

[![Latest Stable Version](https://img.shields.io/github/v/release/brokeyourbike/parallex-bank-api-client-php)](https://github.com/brokeyourbike/parallex-bank-api-client-php/releases)
[![Total Downloads](https://poser.pugx.org/brokeyourbike/parallex-bank-api-client/downloads)](https://packagist.org/packages/brokeyourbike/parallex-bank-api-client)
[![Maintainability](https://api.codeclimate.com/v1/badges/b42d6d359e4f7fc486fb/maintainability)](https://codeclimate.com/github/brokeyourbike/parallex-bank-api-client-php/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/b42d6d359e4f7fc486fb/test_coverage)](https://codeclimate.com/github/brokeyourbike/parallex-bank-api-client-php/test_coverage)

Parallex Bank API Client for PHP

## Installation

```bash
composer require brokeyourbike/parallex-bank-api-client
```

## Usage

```php
use BrokeYourBike\ParallexBank\Client;
use BrokeYourBike\ParallexBank\Interfaces\ConfigInterface;

assert($config instanceof ConfigInterface);
assert($httpClient instanceof \GuzzleHttp\ClientInterface);

$apiClient = new Client($config, $httpClient);
$apiClient->postTransaction();
```

## Authors
- [Ivan Stasiuk](https://github.com/brokeyourbike) | [Twitter](https://twitter.com/brokeyourbike) | [LinkedIn](https://www.linkedin.com/in/brokeyourbike) | [stasi.uk](https://stasi.uk)

## License
[Mozilla Public License v2.0](https://github.com/brokeyourbike/parallex-bank-api-client-php/blob/main/LICENSE)
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: max
paths:
- src
19 changes: 19 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Tests">
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>

0 comments on commit 13ee9a8

Please sign in to comment.