diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61fcc70..37cb5b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,11 @@ name: CI on: + merge_group: + types: + - checks_requested + paths-ignore: + - '**.md' push: branches: - main diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml new file mode 100644 index 0000000..d4f7308 --- /dev/null +++ b/.github/workflows/update-changelog.yml @@ -0,0 +1,16 @@ +name: Prepare Release +on: + merge_group: + types: + - checks_requested + +jobs: + calculate_next_version: + uses: codenamephp/workflows.common/.github/workflows/calculate-next-version.yml@1 + update_changelog: + uses: codenamephp/workflows.common/.github/workflows/update-changelog.yml@1 + needs: calculate_next_version + with: + ref: ${{github.ref_name}} + future-release: ${{ needs.calculate_next_version.outputs.version }} + release-branch: 'release' \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..e6ee102 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/deployer.crontab.iml b/.idea/deployer.crontab.iml index 488ea94..f7c8f8e 100644 --- a/.idea/deployer.crontab.iml +++ b/.idea/deployer.crontab.iml @@ -23,6 +23,5 @@ - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..a161c77 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,130 @@ + + + + \ No newline at end of file diff --git a/.idea/jsonSchemas.xml b/.idea/jsonSchemas.xml new file mode 100644 index 0000000..493d10d --- /dev/null +++ b/.idea/jsonSchemas.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index b856f30..9d0a770 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,7 +3,6 @@ - \ No newline at end of file diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml new file mode 100644 index 0000000..932423e --- /dev/null +++ b/.idea/php-test-framework.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index 8228373..013abee 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -29,7 +29,7 @@ - + @@ -41,6 +41,11 @@ + + + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 48ade16..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,5 @@ - \ No newline at end of file diff --git a/composer.json b/composer.json index aa1bb70..52b1f0b 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "psalm": "tools/psalm --threads=10 --long-progress", "composer-unused": "tools/composer-unused --no-progress --no-interaction", "composer-require-checker": "tools/composer-require-checker --no-interaction", - "infection": "XDEBUG_MODE=coverage tools/infection --min-msi=95 --min-covered-msi=95 --threads=4 --no-progress --show-mutations", + "infection": "XDEBUG_MODE=coverage tools/infection --min-msi=100 --min-covered-msi=100 --threads=4 --no-progress --show-mutations", "ci-all": [ "@phpunit", "@psalm", diff --git a/src/Command/CrontabCommandFactoryInterface.php b/src/Command/CrontabCommandFactoryInterface.php new file mode 100644 index 0000000..52032ae --- /dev/null +++ b/src/Command/CrontabCommandFactoryInterface.php @@ -0,0 +1,25 @@ + $options Array of arguments to pass to the command with numerical indexes so the arguments can be expanded, e.g. ['--production', '--fund=false'] + * @param string|null $file The file to use. Defaults to null which means the default crontab file will be used + * @param bool $sudo Flag if the command should be executed as root + * @param iRunConfiguration|null $runConfiguration The run configuration for the command. Defaults to an empty configuration + * @return iCommand The command to run + */ + public function build(array $options = [], string $file = null, bool $sudo = false, iRunConfiguration $runConfiguration = null) : iCommand; +} \ No newline at end of file diff --git a/src/Command/WithBinaryFromDeployer.php b/src/Command/WithBinaryFromDeployer.php new file mode 100644 index 0000000..a2a3107 --- /dev/null +++ b/src/Command/WithBinaryFromDeployer.php @@ -0,0 +1,29 @@ +deployer->get('crontab:binary', 'crontab'), + $options, + [], + $sudo, + $runConfiguration ?? new SimpleContainer()); + } +} \ No newline at end of file diff --git a/test/Command/WithBinaryFromDeployerTest.php b/test/Command/WithBinaryFromDeployerTest.php new file mode 100644 index 0000000..66f8134 --- /dev/null +++ b/test/Command/WithBinaryFromDeployerTest.php @@ -0,0 +1,52 @@ +deployer); + } + + public function test__construct_withOptionalArguments() : void { + $deployer = $this->createMock(iGet::class); + + $sut = new WithBinaryFromDeployer($deployer); + + self::assertSame($deployer, $sut->deployer); + } + + public function testBuild() : void { + $deployer = $this->createMock(iGet::class); + $deployer->expects(self::once())->method('get')->with('crontab:binary', 'crontab')->willReturn('crontab'); + + $sut = new WithBinaryFromDeployer($deployer); + + $command = $sut->build(); + + self::assertEquals(new Command('crontab', [], [], false, new SimpleContainer()), $command); + } + + public function testBuild_withOptionalArguments() : void { + $deployer = $this->createMock(iGet::class); + $deployer->expects(self::once())->method('get')->with('crontab:binary', 'crontab')->willReturn(null); + + $sut = new WithBinaryFromDeployer($deployer); + + $runConfiguration = $this->createMock(iRunConfiguration::class); + + $command = $sut->build(['some', 'options'], 'someFile', true, $runConfiguration); + + self::assertEquals(new Command('', ['some', 'options'], [], true, $runConfiguration), $command); + } +}