Skip to content

Commit

Permalink
chore: Run CI on PHP 8.3 and 8.4, fix PHP 8.4 support, pin actions ve…
Browse files Browse the repository at this point in the history
…rsions (#211)

* chore: Run CI on PHP 8.3 and 8.4, fix PHP 8.4 support, pin actions versions

Signed-off-by: Graham Campbell <[email protected]>

---------

Signed-off-by: Graham Campbell <[email protected]>
Co-authored-by: Graham Campbell <[email protected]>
  • Loading branch information
cprice404 and GrahamCampbell authored Sep 25, 2024
1 parent eec6083 commit 22d1dcb
Show file tree
Hide file tree
Showing 11 changed files with 1,456 additions and 332 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ permissions:

jobs:
dependency-review:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
41 changes: 30 additions & 11 deletions .github/workflows/on-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@ on:


jobs:
test:
strategy:
max-parallel: 1
fail-fast: true
matrix:
php-version: ["7.4", "8.0", "8.1", "8.2"]
runs-on: ubuntu-latest

env:
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
lint:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
Expand All @@ -37,6 +29,33 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: grpc, protobuf
tools: composer

- name: Install dependencies
run: composer install

- name: Check CS
run: php vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=none

test:
strategy:
max-parallel: 1
fail-fast: true
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
runs-on: ubuntu-24.04

env:
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/on-push-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}

Expand All @@ -25,6 +25,9 @@ jobs:
- name: Install dependencies
run: composer install

- name: Check CS
run: php vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=none

- name: Run tests
run: php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/on-push-to-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
env:
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
Expand All @@ -34,6 +34,9 @@ jobs:
- name: Install dependencies
run: composer install

- name: Check CS
run: php vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=none

- name: Run tests
run: php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml

Expand All @@ -52,10 +55,10 @@ jobs:
php ./psr16-example.php
release:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: [ test ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set release
id: semrel
uses: go-semantic-release/action@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:

jobs:
qodana:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Qodana Scan'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/vendor/
.phpunit.cache
.phpunit.result.cache
.php-cs-fixer.cache
.php-cs-fixer.php
.idea/
.vscode/
16 changes: 16 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$finder = (new PhpCsFixer\Finder())->in(__DIR__);

return (new PhpCsFixer\Config())
->setRules([
'clean_namespace' => true,
'encoding' => true,
'full_opening_tag' => true,
'normalize_index_brace' => true,
'no_unset_cast' => true,
'nullable_type_declaration_for_default_null_value' => true,
'octal_notation' => true,
'simple_to_complex_string_variable' => true,
])
->setFinder($finder);
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
},
"require-dev": {
"composer/composer": "^2.4.1",
"phpunit/phpunit": "^9.5.23"
"phpunit/phpunit": "^9.5.23",
"friendsofphp/php-cs-fixer": "3.64.0"
},
"config": {
"platform": {
Expand Down
Loading

0 comments on commit 22d1dcb

Please sign in to comment.