Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,15 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2']
kubernetes: ['1.24.12', '1.25.8', '1.26.3']
laravel: ['9.*', '10.*', '11.*']
php: [8.2, 8.3, 8.4]
kubernetes: [1.32.9, 1.33.5, 1.34.1]
laravel: [11, 12]
prefer: [prefer-lowest, prefer-stable]
include:
- laravel: "9.*"
testbench: "7.*"
- laravel: "10.*"
testbench: "8.*"
- laravel: "11.*"
testbench: "9.*"
exclude:
- laravel: "11.*"
php: "8.1"

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - K8s v${{ matrix.kubernetes }} --${{ matrix.prefer }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -48,7 +38,7 @@ jobs:
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, yaml
coverage: pcov

- uses: actions/cache@v3.0.5
- uses: actions/cache@v4
name: Cache dependencies
with:
path: ~/.composer/cache/files
Expand All @@ -57,7 +47,7 @@ jobs:
- uses: medyagh/setup-minikube@latest
name: Setup Minikube
with:
minikube-version: 1.29.0
minikube-version: 1.37.0
container-runtime: containerd
kubernetes-version: v${{ matrix.kubernetes }}

Expand All @@ -67,16 +57,21 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.prefer }} --prefer-dist --no-interaction
composer require "laravel/framework:^${{ matrix.laravel }}.0" --dev "orchestra/testbench" --no-interaction --${{ matrix.prefer }} --prefer-dist

- name: Setup in-cluster config
env:
TEST_TOKEN: some-token
TEST_CERT: c29tZS1jZXJ0Cg==
TEST_NAMESPACE: some-namespace
run: |
sudo mkdir -p /var/run/secrets/kubernetes.io/serviceaccount
echo "some-token" | sudo tee /var/run/secrets/kubernetes.io/serviceaccount/token
echo "c29tZS1jZXJ0Cg==" | sudo tee /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
echo "some-namespace" | sudo tee /var/run/secrets/kubernetes.io/serviceaccount/namespace
sudo chmod -R 777 /var/run/secrets/kubernetes.io/serviceaccount/
echo "$TEST_TOKEN" | sudo tee /var/run/secrets/kubernetes.io/serviceaccount/token
echo "$TEST_CERT" | sudo tee /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
echo "$TEST_NAMESPACE" | sudo tee /var/run/secrets/kubernetes.io/serviceaccount/namespace
sudo chmod 644 /var/run/secrets/kubernetes.io/serviceaccount/token
sudo chmod 644 /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
sudo chmod 644 /var/run/secrets/kubernetes.io/serviceaccount/namespace

- name: Setting CRDs for testing
run: |
Expand All @@ -86,6 +81,6 @@ jobs:
run: |
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml

- uses: codecov/codecov-action@v3.1.0
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ composer.phar
composer.lock
.DS_Store
.idea/
.phpunit.result.cache
.phpunit.cache
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
}
],
"require": {
"guzzlehttp/guzzle": "^6.5|^7.0",
"illuminate/macroable": "^9.35|^10.1|^11.0",
"illuminate/support": "^9.35|^10.1|^11.0",
"php": "^8.2|^8.3|^8.4|^8.5",
"guzzlehttp/guzzle": "^7.0",
"illuminate/macroable": "^11.0|^12.0",
"illuminate/support": "^11.0|^12.0",
"ratchet/pawl": "^0.4.1",
"symfony/process": "^5.4|^6.0|^7.0",
"vierbergenlars/php-semver": "^2.1|^3.0"
"symfony/process": "^6.0|^7.0",
"vierbergenlars/php-semver": "^3.0"
},
"suggest": {
"ext-yaml": "YAML extension is used to read or generate YAML from PHP K8s internal classes."
Expand All @@ -48,13 +49,13 @@
"test": "vendor/bin/phpunit"
},
"require-dev": {
"mockery/mockery": "^1.5",
"orchestra/testbench": "^7.23|^8.1|^9.0",
"phpunit/phpunit": "^9.5.20|^10.0",
"vimeo/psalm": "^4.20|^5.22"
"mockery/mockery": "^1.6",
"orchestra/testbench": "^9.0|^10.0",
"phpunit/phpunit": "^10.5|^11.0"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"prefer-stable": true
}
35 changes: 21 additions & 14 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Renoki Co Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<server name="APP_ENV" value="testing"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="Renoki Co Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<php>
<server name="APP_ENV" value="testing"/>
</php>

<source restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
18 changes: 0 additions & 18 deletions psalm.xml

This file was deleted.

9 changes: 4 additions & 5 deletions tests/KubeConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace RenokiCo\PhpK8s\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use RenokiCo\PhpK8s\Exceptions\KubeConfigBaseEncodedDataInvalid;
use RenokiCo\PhpK8s\Exceptions\KubeConfigClusterNotFound;
use RenokiCo\PhpK8s\Exceptions\KubeConfigContextNotFound;
Expand Down Expand Up @@ -208,10 +209,8 @@ public function test_in_cluster_config()
K8sResource::setDefaultNamespace('default');
}

/**
* @dataProvider environmentVariableContextProvider
*/
public function test_from_environment_variable(string $context = null, string $expectedDomain)
#[DataProvider('environmentVariableContextProvider')]
public function test_from_environment_variable(?string $context, string $expectedDomain)
{
$_SERVER['KUBECONFIG'] = __DIR__.'/cluster/kubeconfig.yaml::'.__DIR__.'/cluster/kubeconfig-2.yaml';

Expand All @@ -220,7 +219,7 @@ public function test_from_environment_variable(string $context = null, string $e
$this->assertSame("https://{$expectedDomain}:8443/?", $cluster->getCallableUrl('/', []));
}

public function environmentVariableContextProvider(): iterable
public static function environmentVariableContextProvider(): iterable
{
yield [null, 'minikube'];
yield ['minikube-2', 'minikube-2'];
Expand Down