Skip to content

Commit

Permalink
move execute-deployment to separated job
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Nov 3, 2023
1 parent f49a1c8 commit c8fb47b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
48 changes: 38 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ jobs:
job-description: 'code coverage'
collect-code-coverage: 'yes'

- operating-system: 'ubuntu-20.04'
php-version: '8.2'
job-description: 'deployment check'
execute-deployment: 'yes'

- operating-system: 'windows-latest'
php-version: '8.2'
job-description: 'Fixer on Windows'
Expand Down Expand Up @@ -214,8 +209,41 @@ jobs:
PHP_CS_FIXER_FUTURE_MODE: 1
run: php php-cs-fixer check --diff -v

- name: Execute deployment checks
if: matrix.execute-deployment == 'yes'
run: |
./dev-tools/build.sh
PHP_CS_FIXER_TEST_ALLOW_SKIPPING_SMOKE_TESTS=0 vendor/bin/phpunit tests/Smoke/
deployment:
needs: tests
strategy:
fail-fast: false
matrix:
include:
- operating-system: 'ubuntu-20.04'
php-version: '8.2'

name: Deployment checks

runs-on: ${{ matrix.operating-system }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: ./.github/composite-actions/setup-php
with:
version: ${{ matrix.php-version }}

- name: Setup cache
uses: ./.github/composite-actions/setup-cache
with:
php: ${{ matrix.php-version }}
os: ${{ runner.os }}

- name: Install Composer deps
uses: ./.github/composite-actions/install-composer-deps

- name: Build phar
run: ./dev-tools/build.sh

- name: Run smoke tests
env:
PHP_CS_FIXER_TEST_ALLOW_SKIPPING_SMOKE_TESTS: 0
run: vendor/bin/phpunit tests/Smoke/
8 changes: 3 additions & 5 deletions tests/AutoReview/CiConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ private static function assertSupportedPhpVersionsAreCoveredByCiJobs(array $supp
*/
private function getAllPhpVersionsUsedByCiForDeployments(): array
{
$jobs = array_filter($this->getGitHubJobs(), static fn (array $job): bool => isset($job['execute-deployment']) && 'yes' === $job['execute-deployment']);

return array_map(static fn ($job): string => \is_string($job['php-version']) ? $job['php-version'] : sprintf('%.1f', $job['php-version']), $jobs);
return array_map(static fn ($job): string => \is_string($job['php-version']) ? $job['php-version'] : sprintf('%.1f', $job['php-version']), $this->getGitHubDeploymentJobs());
}

/**
Expand Down Expand Up @@ -216,11 +214,11 @@ private function getMinPhpVersionFromEntryFile(): string
/**
* @return list<array<string, scalar>>
*/
private function getGitHubJobs(): array
private function getGitHubDeploymentJobs(): array
{
$yaml = Yaml::parse(file_get_contents(__DIR__.'/../../.github/workflows/ci.yml'));

return $yaml['jobs']['tests']['strategy']['matrix']['include'];
return $yaml['jobs']['deployment']['strategy']['matrix']['include'];
}

/**
Expand Down

0 comments on commit c8fb47b

Please sign in to comment.