From 187d767421262d0dda79585b7fbaf4cde6c5f730 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janusz=20=C5=BBukowicz?= <janusz.zukowicz@gmail.com>
Date: Thu, 21 Jan 2021 21:23:09 +0100
Subject: [PATCH] Feature/GitHub actions (#1)

Add github actions support
---
 .github/workflows/static.yml | 43 ++++++++++++++++++++++++++++++++++++
 .github/workflows/tests.yml  | 15 +++++++++++++
 composer.json                |  2 +-
 3 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 .github/workflows/static.yml
 create mode 100644 .github/workflows/tests.yml

diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
new file mode 100644
index 0000000..e54c9c2
--- /dev/null
+++ b/.github/workflows/static.yml
@@ -0,0 +1,43 @@
+name: Static Analysis
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  composer-validate:
+    name: Composer Validate
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - name: Validate dependencies
+        uses: php-actions/composer@v5
+        with:
+          command: validate --strict
+
+  phpstan:
+    name: PHPStan
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - name: Setup PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: 7.4
+          tools: composer:v2
+          coverage: none
+
+      - name: Install Dependencies
+        uses: nick-invision/retry@v1
+        with:
+          timeout_minutes: 5
+          max_attempts: 5
+          command: composer install --no-interaction --no-progress
+
+      - name: Execute PHPStan
+        run: vendor/bin/phpstan analyze --no-progress src/
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..9efd821
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,15 @@
+name: Tests
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  build-test:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: php-actions/composer@v5
+      - uses: php-actions/phpunit@v2
+
diff --git a/composer.json b/composer.json
index 399027c..cda8ce8 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
     }
   ],
   "require": {
-    "php": "^7.1 || 8.0",
+    "php": "^7.1 || ^8.0",
     "php-http/client-common": "^2.0",
     "php-http/discovery": "^1.6",
     "php-http/httplug": "^2.0",