Skip to content

Commit

Permalink
NEW Add docuemntation linting matrix entry
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Apr 3, 2024
1 parent 8aef03d commit b50a2e5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ inputs:
js:
type: boolean
default: true
doclinting:
type: boolean
default: true

# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
outputs:
Expand Down Expand Up @@ -124,6 +127,7 @@ runs:
echo "phpcoverage_force_off: ${{ inputs.phpcoverage_force_off }}" >> __inputs.yml
echo "phplinting: ${{ inputs.phplinting }}" >> __inputs.yml
echo "phpunit: ${{ inputs.phpunit }}" >> __inputs.yml
echo "doclinting: ${{ inputs.doclinting }}" >> __inputs.yml
echo "dynamic_matrix: ${{ inputs.dynamic_matrix }}" >> __inputs.yml
echo "simple_matrix: ${{ inputs.simple_matrix }}" >> __inputs.yml
echo "github_repository: '$GITHUB_REPOSITORY'" >> __inputs.yml
Expand Down
11 changes: 11 additions & 0 deletions job_creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public function createJob(int $phpIndex, array $opts): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => false,
'doclinting' => false,
// Needs full setup if installerVersion is set, OR this is one of the no-installer lockstepped repos
'needs_full_setup' => $this->installerVersion !== '' || in_array($this->repoName, NO_INSTALLER_LOCKSTEPPED_REPOS),
];
Expand Down Expand Up @@ -559,6 +560,12 @@ private function buildDynamicMatrix(
'js' => true
]);
}
// documentation linting
if ($run['doclinting'] && file_exists('.ss-docs-lint')) {
$matrix['include'][] = $this->createJob(0, [
'doclinting' => true
]);
}
return $matrix;
}

Expand Down Expand Up @@ -617,6 +624,7 @@ public function createJson(string $yml): string
'phpcoverage',
'phpcoverage_force_off',
'phplinting',
'doclinting',
])) {
$run[$input] = $this->parseBoolValue($value);
} else if ($input === 'extra_jobs') {
Expand Down Expand Up @@ -714,6 +722,9 @@ public function createJson(string $yml): string
if ($job['phplinting'] == 'true') {
$name[] = 'phplinting';
}
if ($job['doclinting'] == 'true') {
$name[] = 'doclinting';
}
$name[] = $job['name_suffix'];
$name = array_filter($name);
$matrix['include'][$i]['name'] = implode(' ', $name);
Expand Down
18 changes: 18 additions & 0 deletions tests/JobCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function provideCreateJob(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => false,
'doclinting' => false,
'needs_full_setup' => false,
]],
// test that NO_INSTALLER_LOCKSTEPPED_REPOS base max PHP version from $branch
Expand Down Expand Up @@ -248,6 +249,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '7.4 prf-low mysql57 phpunit all',
],
Expand All @@ -267,6 +269,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.0 mysql57pdo phpunit all',
],
Expand All @@ -286,6 +289,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.1 mysql80 phpunit all',
],
Expand Down Expand Up @@ -317,6 +321,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.1 prf-low mysql57 phpunit all',
],
Expand All @@ -335,6 +340,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.2 mariadb phpunit all',
],
Expand All @@ -353,6 +359,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.3 mysql80 phpunit all',
],
Expand Down Expand Up @@ -384,6 +391,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.1 prf-low mysql57 phpunit all',
],
Expand All @@ -402,6 +410,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.2 mariadb phpunit all',
],
Expand All @@ -420,6 +429,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.3 mysql80 phpunit all',
],
Expand Down Expand Up @@ -451,6 +461,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.1 prf-low mysql57 phpunit all',
],
Expand All @@ -469,6 +480,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.1 mariadb phpunit all',
],
Expand All @@ -487,6 +499,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.2 mysql80 phpunit all',
],
Expand Down Expand Up @@ -518,6 +531,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.1 prf-low mysql57 phpunit all',
],
Expand All @@ -536,6 +550,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.2 mariadb phpunit all',
],
Expand All @@ -554,6 +569,7 @@ public function provideCreateJson(): array
'endtoend_suite' => 'root',
'endtoend_config' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.3 mysql80 phpunit all',
],
Expand Down Expand Up @@ -589,6 +605,7 @@ private function getGenericYml(): string
phpcoverage_force_off: false
phplinting: true
phpunit: true
doclinting: true
simple_matrix: false
composer_install: false
EOT;
Expand Down Expand Up @@ -665,6 +682,7 @@ public function provideGetInputsValid(): array
'phpcoverage_force_off' => false,
'phplinting' => true,
'phpunit' => true,
'doclinting' => true,
'simple_matrix' => false,
'composer_install' => false,
'github_repository' => 'myaccount/silverstripe-versioned',
Expand Down

0 comments on commit b50a2e5

Please sign in to comment.