fix: Make scoper-autoload.php being compatible with PHP 5 (#846) #676
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
name: End-to-End Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
release: | |
types: [ created ] | |
jobs: | |
build-test-phar: | |
runs-on: ubuntu-latest | |
name: Build (test) PHAR | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: phar.readonly=0 | |
tools: composer | |
coverage: none | |
# https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-environment-variable | |
- name: Configure composer root version | |
run: | | |
source .composer-root-version | |
echo "COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION}" >> $GITHUB_ENV | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
- name: Build PHAR | |
run: make build | |
# Smoke test | |
- name: Ensure the PHAR works | |
run: bin/php-scoper.phar --version | |
- uses: actions/upload-artifact@v3 | |
name: Upload the PHAR artifact | |
with: | |
name: php-scoper-phar-${{ matrix.php }} | |
path: bin/php-scoper.phar | |
e2e-tests: | |
name: 'Test ${{ matrix.e2e }} (PHP: ${{ matrix.php }}) with ${{ matrix.composer }}' | |
runs-on: ubuntu-latest | |
needs: build-test-phar | |
strategy: | |
fail-fast: false | |
matrix: | |
e2e: | |
- 'e2e_004' | |
- 'e2e_005' | |
- 'e2e_011' | |
- 'e2e_013' | |
- 'e2e_014' | |
- 'e2e_015' | |
- 'e2e_016' | |
- 'e2e_017' | |
- 'e2e_018' | |
- 'e2e_019' | |
- 'e2e_020' | |
- 'e2e_024' | |
- 'e2e_025' | |
- 'e2e_027' | |
- 'e2e_028' | |
- 'e2e_029' | |
- 'e2e_030' | |
- 'e2e_031' | |
- 'e2e_032' | |
- 'e2e_033' | |
- 'e2e_034' | |
- 'e2e_035' | |
- 'e2e_036' | |
- 'e2e_037' | |
php: | |
- '8.1' | |
- '8.2' | |
composer: | |
- 'composer:2.2' | |
- 'composer' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: phar.readonly=0 | |
tools: ${{ matrix.composer }} | |
coverage: pcov | |
env: | |
# This is necessary when installing a tool with a specific version | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure composer root version | |
run: | | |
source .composer-root-version | |
echo "COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION}" >> $GITHUB_ENV | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
- name: Retrieve built PHAR | |
uses: actions/download-artifact@v3 | |
with: | |
name: php-scoper-phar-${{ matrix.php }} | |
path: bin | |
- name: Ensure PHAR will not be rebuilt | |
run: touch -c vendor-hotfix bin/php-scoper.phar | |
# See https://github.com/actions/download-artifact#limitations | |
# the permissions are not guaranteed to be preserved | |
- name: Ensure PHAR is executable | |
run: chmod 755 bin/php-scoper.phar | |
- name: Check that the PHAR works | |
run: bin/php-scoper.phar --version | |
- name: Install tree | |
if: matrix.e2e == 'e2e_032' | |
run: sudo apt-get install -y tree | |
- name: Run e2e ${{ matrix.e2e }} | |
run: make ${{ matrix.e2e }} --debug | |
# This is a "trick", a meta task which does not change, and we can use in | |
# the protected branch rules as opposed to the E2E tests one above which | |
# may change regularly. | |
# This allows us to mark only this job as required instead of each individual | |
# ever-changing E2E tests. | |
validate-e2e: | |
name: Check status | |
runs-on: ubuntu-latest | |
needs: e2e-tests | |
if: always() | |
steps: | |
- name: Successful run | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing run | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |