Skip to content

Rewrite TransportMock to make use of HttpStatus utility class #895

Rewrite TransportMock to make use of HttpStatus utility class

Rewrite TransportMock to make use of HttpStatus utility class #895

Workflow file for this run

name: Quicktest
on:
push:
branches-ignore:
- stable
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
#### QUICK TEST STAGE ####
# Runs the tests against select PHP versions for pushes to arbitrary branches.
quicktest:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['5.6', '7.2', 'latest']
name: "Quick Test: PHP ${{ matrix.php }}"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On, log_errors_max_len=0
coverage: none
# At least one test needs a non-en_US locale to be available, so make sure it is.
- name: Install locales
run: |
sudo apt-get update
sudo apt-get install locales-all
- name: Show available locales
run: locale -a
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies - normal
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup proxy server
run: pip3 install mitmproxy
- name: Check mitmproxy version
run: mitmdump --version
- name: Start test server
run: |
PORT=8080 vendor/bin/start.sh
echo "REQUESTS_TEST_HOST_HTTP=localhost:8080" >> $GITHUB_ENV
- name: Ping localhost domain
run: ping -c1 localhost
- 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_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 Render is spun up
run: curl -s -I https://requests-test-server.onrender.com/ > /dev/null
- 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: Grab PHPUnit version
id: phpunit_version
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
- name: Run the unit tests (PHPUnit < 10)
if: ${{ ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: composer test
- name: Run the unit tests (PHPUnit 10+)
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: composer test10
- name: Stop proxy server
continue-on-error: true
run: |
PORT=9002 tests/utils/proxy/stop.sh
PORT=9003 tests/utils/proxy/stop.sh
- name: Stop test server
continue-on-error: true
run: vendor/bin/stop.sh