Skip to content

Commit

Permalink
Merge pull request #5 from dolejska-daniel/v2.0.0
Browse files Browse the repository at this point in the history
PHP8.1 Update, GitHub Actions, minor refactors and code cleanup
  • Loading branch information
dolejska-daniel committed Jun 10, 2023
2 parents 5e131ea + 16f0fb2 commit 61d8306
Show file tree
Hide file tree
Showing 25 changed files with 421 additions and 391 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/php.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PHP Composer

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: read

jobs:
test:
name: Run tests on PHP ${{ matrix.php_version }}
runs-on: ubuntu-latest
strategy:
matrix:
php_version:
- 8.1
- 8.2

steps:
- uses: actions/checkout@v3

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php${{ matrix.php_version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php${{ matrix.php_version }}-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: PHPUnit Tests
uses: php-actions/phpunit@v3
env:
XDEBUG_MODE: coverage
with:
configuration: phpunit.xml
php_extensions: xdebug memcached
args: tests --coverage-clover ./coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
118 changes: 112 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,117 @@
.idea/

# Composer files
vendor/
# Created by https://www.toptal.com/developers/gitignore/api/composer,phpunit,phpstorm+all
# Edit at https://www.toptal.com/developers/gitignore?templates=composer,phpunit,phpstorm+all

### Composer ###
composer.phar
phpunit.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
composer.lock

# Cache
src/Base/cache/
build
### PhpStorm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### PhpStorm+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

.idea/*

!.idea/codeStyles
!.idea/runConfigurations

### PHPUnit ###
# Covers PHPUnit
# Reference: https://phpunit.de/

# Generated files
.phpunit.result.cache
.phpunit.cache

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

# End of https://www.toptal.com/developers/gitignore/api/composer,phpunit,phpstorm+all
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# RiotAPI PHP7 wrapper base
> Version v1.0.0
# RiotAPI PHP8 wrapper base
> Version v2.0.0
[![Build Status](https://img.shields.io/travis/dolejska-daniel/riot-api-base/master)](https://travis-ci.org/dolejska-daniel/riot-api-base)
[![Test Coverage](https://img.shields.io/codeclimate/coverage/dolejska-daniel/riot-api-base?logo=code-climate)](https://codeclimate.com/github/dolejska-daniel/riot-api-base/coverage)
[![example workflow](https://github.com/dolejska-daniel/riot-api-base/actions/workflows/php.yaml/badge.svg)](https://github.com/dolejska-daniel/riot-api-base/actions)
[![Code Coverage](https://codecov.io/gh/dolejska-daniel/riot-api-base/branch/master/graph/badge.svg?token=QSQ2SSRLP9)](https://codecov.io/gh/dolejska-daniel/riot-api-base)
[![Packagist](https://img.shields.io/packagist/l/dolejska-daniel/riot-api-base)](https://packagist.org/packages/dolejska-daniel/riot-api-base)
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-base)
[![Support Project](https://img.shields.io/badge/support_project-PayPal-blue)](https://www.paypal.me/dolejskad)


Expand All @@ -17,11 +18,11 @@ The implementation is being used by concrete game API implementations such as Le
There sould be no need to download this library on its own, because it doesn't do much on its own.
To download API for a Riot game, please refer to the repositories of API implementations below.

| Library Description | Latest Version | Stable Version |
| --------------------------------------------------------------------------------- | -------------- | -------------- |
| [All APIs](https://github.com/dolejska-daniel/riot-api) (metapackage) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api) |
| [League of Legends API](https://github.com/dolejska-daniel/riot-api-league) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-league?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-league) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-league)
| Library Description | Latest Version | Stable Version |
|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [All APIs](https://github.com/dolejska-daniel/riot-api) (metapackage) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api) |
| [League of Legends API](https://github.com/dolejska-daniel/riot-api-league) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-league?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-league) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-league) |
| [DataDragon API](https://github.com/dolejska-daniel/riot-api-datadragon) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-datadragon?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-datadragon) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-datadragon) |
| [Teamfight Tactics API](https://github.com/dolejska-daniel/riot-api-tft) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-tft?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-tft) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-tft) |
| [Legends of Runeterra API](https://github.com/dolejska-daniel/riot-api-runeterra) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-runeterra?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-runeterra) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-runeterra) |
| [Valorant API](https://github.com/dolejska-daniel/riot-api-valorant) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-valorant?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-valorant) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-valorant) |
| [Teamfight Tactics API](https://github.com/dolejska-daniel/riot-api-tft) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-tft?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-tft) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-tft) |
| [Legends of Runeterra API](https://github.com/dolejska-daniel/riot-api-runeterra) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-runeterra?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-runeterra) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-runeterra) |
| [Valorant API](https://github.com/dolejska-daniel/riot-api-valorant) | ![GitHub Latest Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-valorant?include_prereleases) | ![GitHub Release](https://img.shields.io/github/v/release/dolejska-daniel/riot-api-valorant) ![PHP Version](https://img.shields.io/packagist/php-v/dolejska-daniel/riot-api-valorant) |
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
}
],
"scripts": {
"test": "vendor/bin/phpunit -v --bootstrap phpunit.php --configuration phpunit.xml --coverage-text --coverage-html build/coverage"
"test": "XDEBUG_MODE=coverage vendor/bin/phpunit tests -v --configuration phpunit.xml --coverage-text --coverage-html build/coverage"
},
"require": {
"guzzlehttp/guzzle": "^7|^6",
"symfony/cache": "^6|^5",
"psr/cache": "^1",
"php": ">=7.3",
"guzzlehttp/guzzle": "^7",
"symfony/cache": "^6",
"psr/cache": "^3",
"php": ">=8.1",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9"
"phpunit/phpunit": "^10"
},
"autoload": {
"psr-4": {
Expand Down
23 changes: 0 additions & 23 deletions phpunit.php

This file was deleted.

62 changes: 24 additions & 38 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,42 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="phpunit.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
beStrictAboutOutputDuringTests="true"
>
<testsuites>
<testsuite name="BaseAPI:Library_Tests">
<directory>tests/Base/Library/</directory>
</testsuite>
<testsuite name="BaseAPI:Definition_Tests">
<directory>tests/Base/Definitions/</directory>
</testsuite>
<!--
<testsuite name="BaseAPI:Object_Tests">
<directory>tests/Base/Objects/</directory>
</testsuite>
-->
</testsuites>

<coverage cacheDirectory="build/cache/phpunit_coverage"
includeUncoveredFiles="true"
processUncoveredFiles="true"
pathCoverage="false"
ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true"
>
<include>
<directory suffix=".php">src/Base</directory>
</include>

<exclude>
<directory suffix=".php">vendor</directory>
</exclude>
</coverage>
</phpunit>
<testsuites>
<testsuite name="BaseAPI:Library_Tests">
<directory>tests/Base/Library/</directory>
</testsuite>
<testsuite name="BaseAPI:Definition_Tests">
<directory>tests/Base/Definitions/</directory>
</testsuite>
</testsuites>
<coverage ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true"
/>
<source>
<include>
<directory>src/Base</directory>
</include>
<exclude>
<directory>vendor</directory>
</exclude>
</source>
</phpunit>
Loading

0 comments on commit 61d8306

Please sign in to comment.