-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 2: support for multiple SNMP transports
Also move to Github Actions and Coveralls
- Loading branch information
Showing
69 changed files
with
3,354 additions
and
1,393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: [7.3] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
extensions: json, snmp | ||
php-version: ${{ matrix.php-version }} | ||
tools: cs2pr | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: php-${{ matrix.php-version }} | ||
restore-keys: php-${{ matrix.php-version }} | ||
|
||
- name: Install dependencies with composer | ||
run: COMPOSER_ARGS="--prefer-stable" make | ||
|
||
- name: Run a static analysis with phpstan/phpstan | ||
env: | ||
PHPSTAN_ARGS: --error-format=checkstyle | ||
run: make -is static-analysis | cs2pr | ||
|
||
coding-standards: | ||
name: Coding Standards | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: [7.3] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
extensions: snmp | ||
php-version: ${{ matrix.php-version }} | ||
tools: cs2pr | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: php-${{ matrix.php-version }} | ||
restore-keys: php-${{ matrix.php-version }} | ||
|
||
- name: Install dependencies with composer | ||
run: COMPOSER_ARGS="--prefer-stable" make | ||
|
||
- name: Run squizlabs/php_codesniffer | ||
env: | ||
PHPCS_ARGS: -q --no-colors --report=checkstyle | ||
run: make -is cs | cs2pr | ||
|
||
tests: | ||
name: Tests | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: [7.3, 7.4] | ||
dependencies: ["", --prefer-lowest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
extensions: json, snmp | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: Install dependencies | ||
run: sudo apt install python3-pip snmp | ||
|
||
- name: Install snmpsim | ||
run: sudo pip3 install snmpsim | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: php-${{ matrix.php-version }}-dependencies-${{ matrix.dependencies }} | ||
restore-keys: php-${{ matrix.php-version }} | ||
|
||
- name: Install dependencies with composer | ||
run: COMPOSER_ARGS="--prefer-stable ${{ matrix.dependencies }}" make | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
coverage: | ||
name: Tests Coverage | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: [7.4] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: pcov | ||
extensions: json, snmp | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: Install dependencies | ||
run: sudo apt install python3-pip snmp | ||
|
||
- name: Install snmpsim | ||
run: sudo pip3 install snmpsim | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: php-${{ matrix.php-version }} | ||
restore-keys: php-${{ matrix.php-version }} | ||
|
||
- name: Install dependencies with composer | ||
run: COMPOSER_ARGS="--prefer-stable" make | ||
|
||
- name: Run tests coverage | ||
run: PHPUNIT_ARGS="--coverage-clover coverage/clover.xml" make test | ||
|
||
- name: Report to Coveralls | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_RUN_LOCALLY: 1 | ||
run: vendor/bin/php-coveralls --coverage_clover coverage/clover.xml --json_path coverage/coveralls.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
/coverage/ | ||
/vendor/ | ||
|
||
/.phpcs-cache | ||
/.phpunit.result.cache | ||
/composer.lock | ||
/phpcs.xml | ||
/phpstan.neon | ||
/phpunit.xml |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
COMPOSER_ARGS += --no-interaction --no-progress --no-suggest | ||
|
||
.PHONY: build | ||
build: vendor | ||
|
||
.PHONY: vendor | ||
vendor: vendor/lock | ||
|
||
vendor/lock: composer.json | ||
composer update $(COMPOSER_ARGS) | ||
touch vendor/lock | ||
|
||
.PHONY: test | ||
test: | ||
vendor/bin/phpunit $(PHPUNIT_ARGS) | ||
|
||
.PHONY: cs | ||
cs: | ||
vendor/bin/phpcs $(PHPCS_ARGS) | ||
|
||
.PHONY: fix | ||
fix: | ||
vendor/bin/phpcbf | ||
|
||
.PHONY: static-analysis | ||
static-analysis: | ||
vendor/bin/phpstan analyse $(PHPSTAN_ARGS) | ||
|
||
.PHONY: check | ||
check: build cs static-analysis test | ||
|
||
.PHONY: clean | ||
clean: clean-vendor | ||
|
||
.PHONY: clean-vendor | ||
clean-vendor: | ||
rm -rf vendor composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PHP SNMP Client | ||
=============== | ||
|
||
[![Build Status](https://github.com/simPod/PHP-SNMP/workflows/CI/badge.svg?branch=master)](https://github.com/simPod/PHP-SNMP/actions) | ||
[![Packagist](https://poser.pugx.org/simpod/php-snmp/v/stable.svg)](https://packagist.org/packages/simpod/php-snmp) | ||
[![Coverage Status](https://coveralls.io/repos/github/simPod/PHP-SNMP/badge.svg?branch=master)](https://coveralls.io/github/simPod/PHP-SNMP?branch=master) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
parameters: | ||
memory-limit: -1 | ||
level: max | ||
paths: | ||
- %currentWorkingDirectory%/src | ||
- %currentWorkingDirectory%/tests | ||
|
||
includes: | ||
- vendor/phpstan/phpstan-phpunit/extension.neon | ||
- vendor/phpstan/phpstan-phpunit/rules.neon | ||
- vendor/phpstan/phpstan-strict-rules/rules.neon | ||
ignoreErrors: | ||
# extension is badly designed, we know these types won't ever be here | ||
- '~Parameter #1 \$output of method SimPod\\PhpSnmp\\Transport\\ExtensionSnmpClient::processOutput\(\) expects array<string, string>, array\|string\|false given\.~' | ||
- '~Parameter #1 \$output of method SimPod\\PhpSnmp\\Transport\\ExtensionSnmpClient::processOutput\(\) expects array<string, string>, array\|false given\.~' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimPod\PhpSnmp\Exception; | ||
|
||
use RuntimeException; | ||
use function Safe\sprintf; | ||
|
||
final class CannotParseUnknownValueType extends RuntimeException implements SnmpException | ||
{ | ||
public static function new(string $type) : self | ||
{ | ||
return new self(sprintf('Encountered unknown value type "%s"', $type)); | ||
} | ||
} |
Oops, something went wrong.