-
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
65 changed files
with
2,310 additions
and
1,384 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,139 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-version: [7.4] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
php-version: ${{ matrix.php-version }} | ||
tools: cs2pr | ||
extensions: json snmp | ||
|
||
- 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-latest | ||
strategy: | ||
matrix: | ||
php-version: [7.3] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
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-latest | ||
strategy: | ||
matrix: | ||
php-version: [7.3, 7.4] | ||
dependencies: ["", --prefer-lowest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
php-version: ${{ matrix.php-version }} | ||
extensions: json snmp | ||
|
||
- name: Install dependencies | ||
run: sudo apt install python-pip snmp | ||
|
||
- name: Install snmpsim | ||
run: sudo pip 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: version | ||
run: php -v && php -i | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
coverage: | ||
name: Tests Coverage | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-version: [7.4] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: pcov | ||
php-version: ${{ matrix.php-version }} | ||
extensions: json snmp | ||
|
||
- name: Install dependencies | ||
run: sudo apt install python-pip snmp | ||
|
||
- name: Install snmpsim | ||
run: sudo pip 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: pwd && ls -la && ls -la coverage && echo $USER && vendor/bin/php-coveralls --verbose --coverage_clover coverage/clover.xml --json_path coverage |
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 |
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,2 @@ | ||
simpod/php-snmp [![Coverage Status](https://coveralls.io/repos/github/simPod/PHP-SNMP/badge.svg)](https://coveralls.io/github/simPod/PHP-SNMP) | ||
=============== |
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.