Skip to content

Commit 1163b51

Browse files
[FSSDK-9073] Update to support PHP 8.x (#268)
* [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
1 parent 825acfe commit 1163b51

37 files changed

+3983
-166
lines changed

.github/workflows/php.yml

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,72 @@ on:
88

99
jobs:
1010
linting:
11+
name: Linting
1112
runs-on: ubuntu-latest
1213
steps:
13-
- uses: actions/checkout@v3
14-
- name: Set up PHP 7.0
15-
uses: shivammathur/setup-php@v2
16-
with:
17-
php-version: '7.0'
18-
- name: Install php code sniffer
19-
run: composer require "squizlabs/php_codesniffer=*"
20-
- name: Run linting
21-
run: composer lint
14+
- uses: actions/checkout@v3
15+
- name: Set up PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '8.2'
19+
- name: Install php code sniffer
20+
run: composer require "squizlabs/php_codesniffer=*"
21+
- name: Run linting
22+
run: composer lint
23+
24+
source_clear:
25+
name: Source Clear Scan
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Source clear scan
30+
env:
31+
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
32+
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan
2233

2334
integration_tests:
24-
uses: optimizely/php-sdk/.github/workflows/integration_test.yml@uzair/test-with-fsc
35+
name: Integration Tests
36+
uses: optimizely/php-sdk/.github/workflows/integration_test.yml@master
2537
secrets:
2638
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
2739
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
2840

2941
unit_tests:
42+
name: Unit Tests ${{ matrix.php-versions }}
3043
runs-on: ubuntu-latest
3144
strategy:
3245
fail-fast: false
3346
matrix:
34-
php-versions: [ '5.5', '5.6', '7.0', '7.1', '7.2', '7.3' ]
47+
php-versions: [ '8.1', '8.2' ]
3548
steps:
36-
- uses: actions/checkout@v3
37-
- name: Set up PHP ${{ matrix.ruby }}
38-
uses: shivammathur/setup-php@v2
39-
with:
40-
php-version: ${{ matrix.php-versions }}
41-
- name: Cache Composer packages
42-
id: composer-cache
43-
uses: actions/cache@v3
44-
with:
45-
path: vendor
46-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
47-
restore-keys: |
48-
${{ runner.os }}-php-
49-
- name: Install dependencies
50-
run: composer install
51-
- name: run tests
52-
run: |
53-
mkdir -p build/logs
54-
./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
55-
- name: Upload coverage results to Coveralls
56-
env:
57-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
run: |
59-
composer global require php-coveralls/php-coveralls
60-
php-coveralls --coverage_clover=build/logs/clover.xml -v
49+
- uses: actions/checkout@v3
50+
- name: Set up PHP v${{ matrix.php-versions }}
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: ${{ matrix.php-versions }}
54+
- name: Cache Composer packages
55+
id: composer-cache
56+
uses: actions/cache@v3
57+
with:
58+
path: vendor
59+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
60+
restore-keys: |
61+
${{ runner.os }}-php-
62+
- name: Install dependencies
63+
run: composer install
64+
- name: Run tests
65+
run: |
66+
mkdir -p ./build/logs
67+
./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
68+
- name: Verify clover.xml created
69+
run: |
70+
if [ ! -f ./build/logs/clover.xml ]; then
71+
echo "clover.xml was not created"
72+
exit 1
73+
fi
74+
- name: Upload coverage results to Coveralls
75+
env:
76+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: |
78+
composer global require php-coveralls/php-coveralls
79+
php-coveralls --coverage_clover=./build/logs/clover.xml -v

.github/workflows/source_clear_cron.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.idea/*
22
build/
33
vendor/
4-
composer.lock
54
composer.phar
5+
.phpunit.result.cache

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
"beautify": "phpcbf"
1616
},
1717
"require": {
18-
"php": ">=5.5",
18+
"php": ">=8.1",
1919
"justinrainbow/json-schema": "^1.6 || ^2.0 || ^4.0 || ^5.0",
20-
"lastguest/murmurhash": "1.3.0",
20+
"lastguest/murmurhash": "^1.3.0",
2121
"guzzlehttp/guzzle": ">=6.2",
2222
"monolog/monolog": ">=1.21"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^4.8|^5.0",
26-
"php-coveralls/php-coveralls": "v2.3.0",
27-
"squizlabs/php_codesniffer": "3.*",
28-
"icecave/parity": "^1.0 || ^2.0"
25+
"phpunit/phpunit": "^9.3",
26+
"php-coveralls/php-coveralls": "v2.5.3",
27+
"squizlabs/php_codesniffer": "3.7",
28+
"icecave/parity": "^3.0.1"
2929
},
3030
"autoload": {
3131
"psr-4": {

0 commit comments

Comments
 (0)