Skip to content

Commit 747d58a

Browse files
committed
Setup GitHub actions
1 parent f7a72f7 commit 747d58a

File tree

7 files changed

+120
-23
lines changed

7 files changed

+120
-23
lines changed

.github/workflows/run-lint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
php: [7.4, 7.3]
12+
13+
name: PHP${{ matrix.php }}
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v1
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ matrix.php }}
23+
tools: composer:v2, phive
24+
25+
- name: Get Composer Cache Directory
26+
id: composer-cache
27+
run: |
28+
echo "::set-output name=dir::$(composer config cache-files-dir)"
29+
30+
- uses: actions/cache@v2
31+
with:
32+
path: ${{ steps.composer-cache.outputs.dir }}
33+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-php${{ matrix.php }}
34+
restore-keys: |
35+
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
36+
${{ runner.os }}-composer-
37+
38+
- name: Install dependencies
39+
run: |
40+
composer install --prefer-dist --no-interaction --no-suggest
41+
phive --no-progress install --trust-gpg-keys 4AA394086372C20A,CF1A108D0E7AE720,E82B2FB314E9906E
42+
43+
- name: Execute checks
44+
run: |
45+
tools/phpstan analyze src
46+
tools/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no

.github/workflows/run-tests.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Unit tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
unit-tests:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
php: [7.4, 7.3]
12+
laravel: [8.*, 7.*]
13+
include:
14+
- laravel: 8.*
15+
testbench: 6.*
16+
- laravel: 7.*
17+
testbench: ^5.2
18+
19+
name: PHP${{ matrix.php }} - L${{ matrix.laravel }}
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v1
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
tools: composer:v2, phive
30+
coverage: xdebug
31+
32+
- name: Get Composer Cache Directory
33+
id: composer-cache
34+
run: |
35+
echo "::set-output name=dir::$(composer config cache-files-dir)"
36+
37+
- uses: actions/cache@v2
38+
with:
39+
path: ${{ steps.composer-cache.outputs.dir }}
40+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.php }}-php${{ matrix.php }}-L${{ matrix.laravel }}
41+
restore-keys: |
42+
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.php }}-php${{ matrix.php }}
43+
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.php }}
44+
${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
45+
${{ runner.os }}-composer-
46+
47+
- name: Install dependencies
48+
run: |
49+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
50+
composer update --prefer-dist --no-interaction --no-suggest
51+
phive --no-progress install --trust-gpg-keys 4AA394086372C20A,CF1A108D0E7AE720,E82B2FB314E9906E
52+
53+
- name: Execute unit tests
54+
run:
55+
tools/phpunit tests/Unit
56+
57+
- name: Execute feature tests
58+
run:
59+
tools/phpunit tests/Feature

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/vendor/
2-
/.phive/
32
/tools/
43

54
.idea

.phive/phars.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="phpunit" version="^9.5.4" installed="9.5.4" location="./tools/phpunit" copy="true"/>
4+
<phar name="phpstan" version="^0.12.83" installed="0.12.83" location="./tools/phpstan" copy="true"/>
5+
<phar name="php-cs-fixer" version="^2.0" installed="2.18.5" location="./tools/php-cs-fixer" copy="true"/>
6+
</phive>

.php_cs.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22

33
$finder = PhpCsFixer\Finder::create()
4-
->exclude('somedir')
5-
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
64
->in(__DIR__ . DIRECTORY_SEPARATOR . 'src')
75
->in(__DIR__ . DIRECTORY_SEPARATOR . 'tests')
86
;

composer.json

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,27 @@
77
"php": ">=7.3",
88
"ext-json": "*",
99
"aws/aws-php-sns-message-validator": "^1.6"
10-
1110
},
1211
"require-dev" : {
13-
"phpunit/phpunit": "^9.5",
1412
"roave/security-advisories": "dev-latest",
1513
"guzzlehttp/guzzle": "^7.2",
1614
"orchestra/testbench": "^6.0"
1715
},
16+
"autoload": {
17+
"psr-4": {
18+
"MiamiOH\\SnsHandler\\" : "src/"
19+
}
20+
},
1821
"autoload-dev": {
1922
"psr-4": {
2023
"Tests\\MiamiOH\\SnsHandler\\": "tests/"
21-
2224
}
2325
},
2426
"keywords": [
2527
"laravel",
2628
"sns",
27-
"messages"
29+
"messages"
2830
],
29-
"autoload": {
30-
"psr-4": {
31-
"MiamiOH\\SnsHandler\\" : "src/"
32-
}
33-
},
3431
"minimum-stability": "dev",
3532
"prefer-stable": true,
3633
"extra": {
@@ -41,17 +38,11 @@
4138
}
4239
},
4340
"scripts": {
44-
"phpcs-7.3": [
45-
"phpcs -p src --standard=PHPCompatibility --runtime-set testVersion 7.3"
46-
],
47-
"phpcs-7.4": [
48-
"phpcs -p src --standard=PHPCompatibility --runtime-set testVersion 7.4"
49-
],
5041
"cs-fix": [
51-
"php-cs-fixer fix --diff"
42+
"tools/php-cs-fixer fix --diff"
5243
],
5344
"phpstan": [
54-
"phpstan analyze"
45+
"tools/phpstan analyze"
5546
]
5647
}
5748
}

src/Testing/ReceivesSnsMessages.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,5 @@ public function sendSnsMessage(string $arn, string $data): TestResponse
5050
];
5151

5252
$response = $this->postJson('/api/sns/message', $body, $headers);
53-
5453
}
55-
56-
}
54+
}

0 commit comments

Comments
 (0)