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
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,15 @@ jobs:
[ "${VORTEX_CI_CODE_COVERAGE_PR_COMMENT_SKIP:-0}" = "1" ] && exit 0
.circleci/post-coverage-comment.sh /tmp/artifacts/coverage/phpunit/coverage.txt

#;< CODE_COVERAGE_PROVIDER_CODECOV
- run:
name: Upload code coverage reports to Codecov
command: |
[ "${CIRCLE_NODE_TOTAL:-1}" -gt 1 ] && [ "${CIRCLE_NODE_INDEX:-0}" -ne 0 ] && exit 0
if [ -n "${CODECOV_TOKEN}" ] && [ -d /tmp/artifacts/coverage ] && ! echo "${CIRCLE_BRANCH}" | grep -q '^deps/'; then
codecov -Z -s /tmp/artifacts/coverage;
fi
#;> CODE_COVERAGE_PROVIDER_CODECOV

- run:
name: Check code coverage threshold
Expand Down
2 changes: 2 additions & 0 deletions .circleci/vortex-test-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,15 @@ jobs:
[ "${VORTEX_CI_CODE_COVERAGE_PR_COMMENT_SKIP:-0}" = "1" ] && exit 0
.circleci/post-coverage-comment.sh /tmp/artifacts/coverage/phpunit/coverage.txt

#;< CODE_COVERAGE_PROVIDER_CODECOV
- run:
name: Upload code coverage reports to Codecov
command: |
[ "${CIRCLE_NODE_TOTAL:-1}" -gt 1 ] && [ "${CIRCLE_NODE_INDEX:-0}" -ne 0 ] && exit 0
if [ -n "${CODECOV_TOKEN}" ] && [ -d /tmp/artifacts/coverage ] && ! echo "${CIRCLE_BRANCH}" | grep -q '^deps/'; then
codecov -Z -s /tmp/artifacts/coverage;
fi
#;> CODE_COVERAGE_PROVIDER_CODECOV

- run:
name: Check code coverage threshold
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ jobs:
</details>
hide_and_recreate: true

#;< CODE_COVERAGE_PROVIDER_CODECOV
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
if: ${{ (matrix.instance == 0 || strategy.job-total == 1) && env.CODECOV_TOKEN != '' }}
Expand All @@ -493,6 +494,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
#;> CODE_COVERAGE_PROVIDER_CODECOV

- name: Check code coverage threshold
if: ${{ matrix.instance == 0 || strategy.job-total == 1 }}
Expand Down
430 changes: 213 additions & 217 deletions .vortex/docs/static/img/installer.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .vortex/docs/static/img/installer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions .vortex/installer/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ cd .vortex/installer
UPDATE_SNAPSHOTS=1 ./vendor/bin/phpunit --filter "testHandlerProcess.*baseline"
```

### Updating the Installer Video

**Whenever the installer prompt flow changes** (new handler added, prompt
renamed, section reordered, prompt removed), the installer video shown in the
documentation goes stale and must be regenerated.

```bash
# From .vortex/ directory
ahoy update-installer-video
```

Requires `asciinema`, `expect`, `php`, `composer`, `npx` on PATH. Produces
`installer.json` (asciicast), `installer.svg`, `installer.png`, and
`installer.gif` under `.vortex/docs/static/img/`. Requires explicit user
permission before running, same as `ahoy update-snapshots`.

Triggers that require re-recording:
- New `Handlers/*.php` class or handler removal.
- Wording change to `label()` or `hint()` of any existing handler.
- Reordering prompts inside `PromptManager::runPrompts()`.
- Change to `TOTAL_RESPONSES` constant.

## Conditional Token System

### Patterns
Expand Down
83 changes: 83 additions & 0 deletions .vortex/installer/src/Prompts/Handlers/CodeCoverageProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

declare(strict_types=1);

namespace DrevOps\VortexInstaller\Prompts\Handlers;

use DrevOps\VortexInstaller\Utils\File;

class CodeCoverageProvider extends AbstractHandler {

const NONE = 'none';

const CODECOV = 'codecov';

/**
* {@inheritdoc}
*/
public function label(): string {
return 'Code coverage provider';
}

/**
* {@inheritdoc}
*/
public function hint(array $responses): ?string {
return 'Use ⬆ and ⬇ to select the code coverage provider.';
}

/**
* {@inheritdoc}
*/
public function options(array $responses): ?array {
return [
self::CODECOV => 'Codecov',
self::NONE => 'None',
];
}

/**
* {@inheritdoc}
*/
public function default(array $responses): null|string|bool|array {
return self::NONE;
}

/**
* {@inheritdoc}
*/
public function discover(): null|string|bool|array {
if (!$this->isInstalled()) {
return NULL;
}

$gha_files = glob($this->dstDir . '/.github/workflows/*.{yml,yaml}', GLOB_BRACE) ?: [];
foreach ($gha_files as $gha_file) {
if (is_readable($gha_file) && File::contains($gha_file, 'codecov/codecov-action')) {
return self::CODECOV;
}
}

$circle = $this->dstDir . '/.circleci/config.yml';
if (is_readable($circle) && File::contains($circle, 'codecov -Z -s')) {
return self::CODECOV;
}

return self::NONE;
}

/**
* {@inheritdoc}
*/
public function process(): void {
$v = $this->getResponseAsString();

if ($v === self::CODECOV) {
File::removeTokenAsync('!CODE_COVERAGE_PROVIDER_CODECOV');
}
else {
File::removeTokenAsync('CODE_COVERAGE_PROVIDER_CODECOV');
}
}

}
6 changes: 5 additions & 1 deletion .vortex/installer/src/Prompts/PromptManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use DrevOps\VortexInstaller\Prompts\Handlers\AiCodeInstructions;
use DrevOps\VortexInstaller\Prompts\Handlers\AssignAuthorPr;
use DrevOps\VortexInstaller\Prompts\Handlers\CiProvider;
use DrevOps\VortexInstaller\Prompts\Handlers\CodeCoverageProvider;
use DrevOps\VortexInstaller\Prompts\Handlers\CodeProvider;
use DrevOps\VortexInstaller\Prompts\Handlers\CustomModules;
use DrevOps\VortexInstaller\Prompts\Handlers\DatabaseDownloadSource;
Expand Down Expand Up @@ -66,7 +67,7 @@ class PromptManager {
*
* Used to display the progress of the prompts.
*/
const TOTAL_RESPONSES = 32;
const TOTAL_RESPONSES = 33;

/**
* Array of responses.
Expand Down Expand Up @@ -220,6 +221,7 @@ public function runPrompts(): void {

->intro('Automations')
->add(fn($r, $pr, $n): mixed => $this->prompt(DependencyUpdatesProvider::class), DependencyUpdatesProvider::id())
->add(fn($r, $pr, $n): mixed => $this->prompt(CodeCoverageProvider::class), CodeCoverageProvider::id())
->add(fn($r, $pr, $n): mixed => $this->prompt(AssignAuthorPr::class), AssignAuthorPr::id())
->add(fn($r, $pr, $n): mixed => $this->prompt(LabelMergeConflictsPr::class), LabelMergeConflictsPr::id())

Expand Down Expand Up @@ -300,6 +302,7 @@ public function runProcessors(): void {
PreserveDocsProject::id(),
LabelMergeConflictsPr::id(),
AssignAuthorPr::id(),
CodeCoverageProvider::id(),
DependencyUpdatesProvider::id(),
CiProvider::id(),
MigrationImage::id(),
Expand Down Expand Up @@ -499,6 +502,7 @@ public function getResponsesSummary(): array {

$values['Automations'] = Tui::LIST_SECTION_TITLE;
$values['Dependency updates provider'] = $responses[DependencyUpdatesProvider::id()];
$values['Code coverage provider'] = $responses[CodeCoverageProvider::id()];
$values['Auto-assign PR author'] = Converter::bool($responses[AssignAuthorPr::id()]);
$values['Auto-add a CONFLICT label to PRs'] = Converter::bool($responses[LabelMergeConflictsPr::id()]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,6 @@ jobs:
</details>
hide_and_recreate: true

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@__HASH__ # __VERSION__
if: ${{ (matrix.instance == 0 || strategy.job-total == 1) && env.CODECOV_TOKEN != '' }}
with:
directory: .logs/coverage
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Check code coverage threshold
if: ${{ matrix.instance == 0 || strategy.job-total == 1 }}
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Drupal 11 implementation of star wars for star wars Org
[![Database, Build, Test and Deploy](https://github.com/star_wars_org/star_wars/actions/workflows/build-test-deploy.yml/badge.svg)](https://github.com/star_wars_org/star_wars/actions/workflows/build-test-deploy.yml)

![Drupal 11](https://img.shields.io/badge/Drupal-11-blue.svg)
[![codecov](https://codecov.io/gh/star_wars_org/star_wars/graph/badge.svg)](https://codecov.io/gh/star_wars_org/star_wars)

![Automated updates](https://img.shields.io/badge/Automated%20updates-RenovateBot-brightgreen.svg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,6 @@ jobs:
[ "${VORTEX_CI_CODE_COVERAGE_PR_COMMENT_SKIP:-0}" = "1" ] && exit 0
.circleci/post-coverage-comment.sh /tmp/artifacts/coverage/phpunit/coverage.txt

- run:
name: Upload code coverage reports to Codecov
command: |
[ "${CIRCLE_NODE_TOTAL:-1}" -gt 1 ] && [ "${CIRCLE_NODE_INDEX:-0}" -ne 0 ] && exit 0
if [ -n "${CODECOV_TOKEN}" ] && [ -d /tmp/artifacts/coverage ] && ! echo "${CIRCLE_BRANCH}" | grep -q '^deps/'; then
codecov -Z -s /tmp/artifacts/coverage;
fi

- run:
name: Check code coverage threshold
command: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
+[![CircleCI](https://circleci.com/gh/star_wars_org/star_wars.svg?style=shield)](https://circleci.com/gh/star_wars_org/star_wars)

![Drupal 11](https://img.shields.io/badge/Drupal-11-blue.svg)
[![codecov](https://codecov.io/gh/star_wars_org/star_wars/graph/badge.svg)](https://codecov.io/gh/star_wars_org/star_wars)

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@@ -432,6 +432,16 @@
</details>
hide_and_recreate: true

+ - name: Upload coverage report to Codecov
+ uses: codecov/codecov-action@__HASH__ # __VERSION__
+ if: ${{ (matrix.instance == 0 || strategy.job-total == 1) && env.CODECOV_TOKEN != '' }}
+ with:
+ directory: .logs/coverage
+ fail_ci_if_error: true
+ token: ${{ secrets.CODECOV_TOKEN }}
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+
- name: Check code coverage threshold
if: ${{ matrix.instance == 0 || strategy.job-total == 1 }}
run: |
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@@ -13,6 +13,8 @@

![Drupal 11](https://img.shields.io/badge/Drupal-11-blue.svg)

+[![codecov](https://codecov.io/gh/star_wars_org/star_wars/graph/badge.svg)](https://codecov.io/gh/star_wars_org/star_wars)
+
![Automated updates](https://img.shields.io/badge/Automated%20updates-RenovateBot-brightgreen.svg)

[//]: # (DO NOT REMOVE THE BADGE BELOW. IT IS USED BY VORTEX TO TRACK INTEGRATION)
Loading
Loading