Skip to content

Commit

Permalink
Merge branch 'v3' into features/Stationeers
Browse files Browse the repository at this point in the history
  • Loading branch information
bumbummen99 committed Dec 1, 2024
2 parents f22c42e + 37cdd6d commit 8b595cf
Show file tree
Hide file tree
Showing 248 changed files with 2,432 additions and 1,087 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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": "PHP",
"build": {
"dockerfile": "docker/Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"postCreateCommand": ".devcontainer/postCreate.sh",
"remoteUser": "vscode"
}
16 changes: 16 additions & 0 deletions .devcontainer/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Define the DevContainer template to be used as the base
ARG PHP=8.3
ARG DISTRO=bullseye

FROM mcr.microsoft.com/vscode/devcontainers/php:$PHP-$DISTRO

# Update the registry once
RUN apt-get update

# Install ext-bz2
RUN apt-get install -y libbz2-dev \
&& docker-php-ext-configure bz2 \
&& docker-php-ext-install bz2

# Install act
RUN curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash -s -- -b /usr/local/bin
6 changes: 6 additions & 0 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# Install dependencies using Composer
if [ ! -f composer.lock ]; then
composer install
fi
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
* text=auto

/build export-ignore
/examples export-ignore
/tests export-ignore
/.coveralls.yml export-ignore
/.scrutinizer.yml export-ignore
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml export-ignore
/phpunit.xml.dist export-ignore
/CONTRIBUTING.md export-ignore
/README.md export-ignore
57 changes: 57 additions & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Documentation

on:
workflow_dispatch:
push:
branches:
- v3

jobs:
apigen:
runs-on: ubuntu-22.04
name: ApiGen
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 10
path: source

- name: Checkout gh-pages
uses: actions/checkout@v4
with:
fetch-depth: 10
ref: gh-pages
path: gh-pages

- name: Validate composer.json
run: |
cd source
composer validate
- name: Cache composer files
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('source/composer.json') }}

- name: Install dependencies using composer
run: |
cd source
composer install --prefer-dist --no-interaction ${{ matrix.composer-extra }}
- name: Clean old ApiGen
run: |
rm -rf gh-pages/api
mkdir -p gh-pages/api
- name: ApiGen
run: docker run --rm --interactive --user $(id -u):$(id -g) --volume "$PWD:$PWD" --workdir "$PWD/source" apigen/apigen:edge src --output ../gh-pages/api

- name: Commit & Push updated file
if: always()
uses: EndBug/add-and-commit@v9
with:
default_author: github_actor
message: 'Regenerated ApiGen documentation.'
cwd: gh-pages
39 changes: 21 additions & 18 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1]
ocular: [^1.9]
php: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3]
experimental: [false]
composer-extra: ['']
include:
- php: 5.6
experimental: false
ocular: ~1.8.1
- php: 8.2
- php: 8.4
experimental: true
ocular: ^1.9
composer-extra: '--ignore-platform-req=php+'
env:
PHP_VERSION: ${{ matrix.php }}
Expand All @@ -39,7 +34,7 @@ jobs:
extensions: bz2,xml,curl

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 10

Expand All @@ -65,15 +60,23 @@ jobs:
run: vendor/bin/phpunit -c phpunit.xml --verbose

- name: Upload Coveralls coverage
if: github.repository == 'Austinb/GameQ'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php ~/.composer/vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
uses: coverallsapp/github-action@v2
with:
parallel: true
file: build/logs/clover.xml

- name: Upload Scrutinizer coverage
uses: sudo-bot/action-scrutinizer@latest
if: github.repository == 'Austinb/GameQ'
run: |
composer global require scrutinizer/ocular ${{ matrix.ocular }}
php ~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}
with:
cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"

Finish:
needs: CI
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
20 changes: 14 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@

# Development
/remotes/
test.php
/.buildpath
/.project
/.settings/*
vendor

# JetBrains
/.idea
*.iml

# Composer
vendor
composer.lock
composer.phar

# PHPUnit
.phpunit.result.cache
coverage/
build/logs/
test.php
*.iml
/remotes/
build/logs/*
!build/logs/.gitkeep
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "php",
"request": "launch",
"port": 0,
"cwd": "${workspaceFolder}",
"runtimeArgs": [
"-dxdebug.mode=debug,develop",
"-dxdebug.client_port=${port}",
"-dxdebug.start_with_request=yes"
],
"program": "${workspaceFolder}/vendor/bin/phpunit",
}
]
}
8 changes: 8 additions & 0 deletions GameQ.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
GameQ is a PHP library that allows you to query multiple types of multiplayer game & voice servers at the same time.

## Requirements
* PHP 5.6.40+ - [Tested](https://github.com/Austinb/GameQ/actions/workflows/Tests.yml) in PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 & 8.2-dev
* PHP 5.6.40+ - [Tested](https://github.com/Austinb/GameQ/actions/workflows/Tests.yml) in PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 & 8.4
* [Bzip2](http://www.php.net/manual/en/book.bzip2.php) - Used for A2S Compressed responses

## Installation
#### [Composer](https://getcomposer.org/)
This method assumes you already have composer [installed](https://getcomposer.org/doc/00-intro.md) and working properly. Add `austinb/gameq` as a requirement to composer.json by using `composer require austinb/gameq:~3.0` or by manually adding the following to the *composer.json* file in the **require** section:
This method assumes you already have composer [installed](https://getcomposer.org/doc/00-intro.md) and working properly. Add `austinb/gameq` as a requirement to composer.json by using `composer require austinb/gameq:~3.1` or by manually adding the following to the *composer.json* file in the **require** section:

```javascript
"austinb/gameq": "~3.1"
Expand Down
Empty file added build/logs/.gitkeep
Empty file.
8 changes: 4 additions & 4 deletions src/GameQ/Buffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,28 @@ class Buffer
/**
* The number type we use for reading integers. Defaults to little endian
*
* @type string
* @var string
*/
private $number_type = self::NUMBER_TYPE_LITTLEENDIAN;

/**
* The original data
*
* @type string
* @var string
*/
private $data;

/**
* The original data
*
* @type int
* @var int
*/
private $length;

/**
* Position of pointer
*
* @type int
* @var int
*/
private $index = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/GameQ/Filters/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace GameQ\Filters;

use GameQ\Concerns\WithArrayHelpers;
use GameQ\Server;

/**
Expand All @@ -27,11 +28,10 @@
*/
abstract class Base
{

/**
* Holds the options for this instance of the filter
*
* @type array
* @var array
*/
protected $options = [];

Expand Down
Loading

0 comments on commit 8b595cf

Please sign in to comment.