diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
new file mode 100644
index 000000000..85c844d05
--- /dev/null
+++ b/.github/workflows/code-quality.yml
@@ -0,0 +1,74 @@
+name: Code Quality Checks
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+
+jobs:
+
+ lint: #-----------------------------------------------------------------------
+ name: Lint PHP files
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out source code
+ uses: actions/checkout@v2
+
+ - name: Set up PHP envirnoment
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '7.4'
+ tools: cs2pr
+
+ - name: Get Composer cache Directory
+ id: composer-cache
+ run: |
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Use Composer cache
+ uses: actions/cache@v1
+ with:
+ path: ${{ steps['composer-cache'].outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --prefer-dist --no-progress --no-suggest
+
+ - name: Run Linter
+ run: vendor/bin/parallel-lint -j 10 . --exclude vendor --checkstyle | cs2pr
+
+ phpcs: #----------------------------------------------------------------------
+ name: PHPCS
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out source code
+ uses: actions/checkout@v2
+
+ - name: Set up PHP envirnoment
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '7.4'
+ tools: cs2pr
+
+ - name: Get Composer cache Directory
+ id: composer-cache
+ run: |
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Use Composer cache
+ uses: actions/cache@v1
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --prefer-dist --no-progress --no-suggest
+
+ - name: Run PHPCS
+ run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
new file mode 100644
index 000000000..53b86ff26
--- /dev/null
+++ b/.github/workflows/testing.yml
@@ -0,0 +1,96 @@
+name: Testing
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+
+jobs:
+
+ unit:
+ name: Unit test / PHP ${{ matrix.php }}
+ strategy:
+ fail-fast: false
+ matrix:
+ php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out source code
+ uses: actions/checkout@v2
+
+ - name: Set up PHP environment
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '${{ matrix.php }}'
+ coverage: none
+ tools: composer,cs2pr
+
+ - name: Get Composer cache Directory
+ id: composer-cache
+ run: |
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Use Composer cache
+ uses: actions/cache@master
+ with:
+ path: ${{ steps['composer-cache'].outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --prefer-dist --no-progress --no-suggest
+
+ - name: Setup problem matcher to provide annotations for PHPUnit
+ run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
+
+ - name: Setup Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.8'
+
+ - name: Setup proxy server
+ run: pip3 install mitmproxy
+
+ - name: Start test server
+ run: |
+ PORT=8080 vendor/bin/start.sh
+ echo "REQUESTS_TEST_HOST_HTTP=localhost:8080" >> $GITHUB_ENV
+
+ - name: Start proxy server
+ run: |
+ PORT=9002 tests/utils/proxy/start.sh
+ PORT=9003 AUTH="test:pass" tests/utils/proxy/start.sh
+ echo "REQUESTS_HTTP_PROXY=localhost:9002" >> $GITHUB_ENV
+ echo "REQUESTS_HTTP_PROXY=localhost:9002" >> $GITHUB_ENV
+ echo "REQUESTS_HTTP_PROXY_AUTH=localhost:9003" >> $GITHUB_ENV
+ echo "REQUESTS_HTTP_PROXY_AUTH_USER=test" >> $GITHUB_ENV
+ echo "REQUESTS_HTTP_PROXY_AUTH_PASS=pass" >> $GITHUB_ENV
+
+ - name: Ensure the HTTPS test instance on Heroku is spun up
+ run: curl -s -I http://requests-php-tests.herokuapp.com/ > /dev/null
+
+ - name: Check mitmproxy version
+ run: mitmdump --version
+
+ - name: Ping localhost domain
+ run: ping -c1 localhost
+
+ - name: Access localhost on port 8080
+ run: curl -i http://localhost:8080
+
+ - name: Access localhost on port 9002
+ run: curl -i http://localhost:9002
+
+ - name: Run PHPUnit
+ run: composer test
+
+ - name: Stop proxy server
+ run: |
+ PORT=9002 tests/utils/proxy/stop.sh
+ PORT=9003 tests/utils/proxy/stop.sh
+
+ - name: Stop test server
+ run: vendor/bin/stop.sh
diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
index 8381fb896..4e95aa118 100644
--- a/.phpcs.xml.dist
+++ b/.phpcs.xml.dist
@@ -40,11 +40,8 @@
#############################################################################
-->
-
-
-
- /examples/*\.php$
-
+
+