Skip to content

Commit

Permalink
[FSSDK-9073] Update to support PHP 8.x (#268)
Browse files Browse the repository at this point in the history
* [FSSDK-9022] Ignore .phpunit.result.cache

* [FSSDK-9022] Increment version of php to 8.0+

* [FSSDK-9022] Update murmurhash version & use

* [FSSDK-9022] Fixed tests' setUp() signatures

* [FSSDK-9022]

* [FSSDK-9022] Convert PHPUnit_Framework_TestCase to TestCase

* [FSSDK-9022] Adjust deps

* [FSSDK-9022] Adjust PHPUnit bootstrapping

* [FSSDK-9022] Rollback to older murmurhash lib

* [FSSDK-9022] Fix exception type check condition for PHP8

* [FSSDK-9022] Expand the memory limit for running PHPUnit tests

* [FSSDK-9022] Update GitHub Actions workflow

* [FSSDK-9022] Remove @ExpectedException

* [FSSDK-9022] Try fix for no coverage file produced

* [FSSDK-9022] Try fixing clover.xml path

* [FSSDK-9022] Add step to fail if clover.xml not created

* [FSSDK-9022] Try using php-actions/phpunit@v3

* [FSSDK-9022] Adjust phpunit action

* [FSSDK-9022] Set bootstrap: phpunit_bootstrap.php

* [FSSDK-9022] Rollback to script based run PHPUnit

* [FSSDK-9022] Upgrade to minimum PHPUnit that outputs coverage for PHP8

* Add composer.lock to repo

* Move Source Clear scan inside CI

* Remove support for 8.0...

which is no longer actively supported and security support ends 26 Nov 2023

* Fix php workflow to use master

* Add missing property dec + refactors

* Add end of file line

* Add missing Copyright years
  • Loading branch information
mikechu-optimizely committed May 26, 2023
1 parent 825acfe commit 1163b51
Show file tree
Hide file tree
Showing 37 changed files with 3,983 additions and 166 deletions.
91 changes: 55 additions & 36 deletions .github/workflows/php.yml
Expand Up @@ -8,53 +8,72 @@ on:

jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up PHP 7.0
uses: shivammathur/setup-php@v2
with:
php-version: '7.0'
- name: Install php code sniffer
run: composer require "squizlabs/php_codesniffer=*"
- name: Run linting
run: composer lint
- uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install php code sniffer
run: composer require "squizlabs/php_codesniffer=*"
- name: Run linting
run: composer lint

source_clear:
name: Source Clear Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Source clear scan
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan

integration_tests:
uses: optimizely/php-sdk/.github/workflows/integration_test.yml@uzair/test-with-fsc
name: Integration Tests
uses: optimizely/php-sdk/.github/workflows/integration_test.yml@master
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

unit_tests:
name: Unit Tests ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: [ '5.5', '5.6', '7.0', '7.1', '7.2', '7.3' ]
php-versions: [ '8.1', '8.2' ]
steps:
- uses: actions/checkout@v3
- name: Set up PHP ${{ matrix.ruby }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install
- name: run tests
run: |
mkdir -p build/logs
./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
- uses: actions/checkout@v3
- name: Set up PHP v${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install
- name: Run tests
run: |
mkdir -p ./build/logs
./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
- name: Verify clover.xml created
run: |
if [ ! -f ./build/logs/clover.xml ]; then
echo "clover.xml was not created"
exit 1
fi
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=./build/logs/clover.xml -v
16 changes: 0 additions & 16 deletions .github/workflows/source_clear_cron.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
@@ -1,5 +1,5 @@
.idea/*
build/
vendor/
composer.lock
composer.phar
.phpunit.result.cache
12 changes: 6 additions & 6 deletions composer.json
Expand Up @@ -15,17 +15,17 @@
"beautify": "phpcbf"
},
"require": {
"php": ">=5.5",
"php": ">=8.1",
"justinrainbow/json-schema": "^1.6 || ^2.0 || ^4.0 || ^5.0",
"lastguest/murmurhash": "1.3.0",
"lastguest/murmurhash": "^1.3.0",
"guzzlehttp/guzzle": ">=6.2",
"monolog/monolog": ">=1.21"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"php-coveralls/php-coveralls": "v2.3.0",
"squizlabs/php_codesniffer": "3.*",
"icecave/parity": "^1.0 || ^2.0"
"phpunit/phpunit": "^9.3",
"php-coveralls/php-coveralls": "v2.5.3",
"squizlabs/php_codesniffer": "3.7",
"icecave/parity": "^3.0.1"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 1163b51

Please sign in to comment.