Repository: JoshuaKGoldberg/create-typescript-app (ts)

Issue:
🛠 Tooling: Move test_*_script CI jobs into ci.yml
### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aissue) and found none that matched my issue.

### Overview

Right now, there are four separate `.github/workflows/*.yml` files that in some way cause tests to be run in CI:

* `ci.yml`: along with other CI jobs
* `test-create.yml`
* `test-initialize.yml`
* `test-migrate.yml`

`ci.yml`'s jobs used to be all on their own. Now they're merged together into one IMO cleaner `ci.yml`. I'll do the same for this repo's specific `test-*.yml` end-to-end tests.

### Additional Info

Split out of #1670.

💖 

Pull request:
chore: move e2e migration scripts into ci.yml
## PR Checklist

- [x] Addresses an existing open issue: fixes #1711
- [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken

## Overview

💖 

Patch:
diff --git a/.github/DEVELOPMENT.md b/.github/DEVELOPMENT.md
index 30091f4..71ae453 100644
--- a/.github/DEVELOPMENT.md
+++ b/.github/DEVELOPMENT.md
@@ -152,7 +152,7 @@ That end-to-end test executes `script/create-test-e2e.ts`, which:
 2. Asserts that commands such as `build` and `lint` each pass
 
 The `pnpm run test:create` script is run in CI to ensure that templating changes are in sync with the template's actual files.
-See `.github/workflows/test-create.yml`.
+See `.github/workflows/ci.yml`'s `test_creation_script` job.
 
 ### The Initialization Script
 
@@ -184,7 +184,7 @@ That end-to-end test executes `script/initialize-test-e2e.ts`, which:
 5. Runs initialization a second time, capturing test coverage
 
 The `pnpm run test:initialize` script is run in CI to ensure that templating changes are in sync with the template's actual files.
-See `.github/workflows/test-initialize.yml`.
+See `.github/workflows/ci.yml`'s `test_initialization_script` job.
 
 ### The Migration Script
 
@@ -228,7 +228,7 @@ That end-to-end test executes `script/migrate-test-e2e.ts`, which:
 3. Checks that the local repository's files were changed correctly (e.g. removed initialization-only files)
 
 The `pnpm run test:migrate` script is run in CI to ensure that templating changes are in sync with the template's actual files.
-See `.github/workflows/test-migrate.yml`.
+See `.github/workflows/ci.yml`'s `test_migration_script` job.
 
 > Tip: if the migration test is failing in CI and you don't see any errors, try [downloading the full logs](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#downloading-logs).
 
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d831a4c..5256324 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -65,9 +65,49 @@ jobs:
       - uses: actions/checkout@v4
       - uses: ./.github/actions/prepare
       - run: pnpm run test --coverage
-      - uses: codecov/codecov-action@v3
+      - if: always()
+        uses: codecov/codecov-action@v3
         with:
           flags: unit
+  test_creation_script:
+    name: Test Creation Script
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+      - uses: ./.github/actions/prepare
+      - run: pnpm run build
+      - run: pnpm run test:create
+      - if: always()
+        uses: codecov/codecov-action@v3
+        with:
+          files: coverage-create/lcov.info
+          flags: create
+  test_initialization_script:
+    name: Test Initialization Script
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+      - uses: ./.github/actions/prepare
+      - run: pnpm run build
+      - run: pnpm run test:initialize
+      - if: always()
+        uses: codecov/codecov-action@v3
+        with:
+          files: coverage-initialize/lcov.info
+          flags: initialize
+  test_migration_script:
+    name: Test Migration Script
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+      - uses: ./.github/actions/prepare
+      - run: pnpm run build
+      - run: pnpm run test:migrate
+      - if: always()
+        uses: codecov/codecov-action@v3
+        with:
+          files: coverage-migrate/lcov.info
+          flags: migrate
   type_check:
     name: Type Check
     runs-on: ubuntu-latest
diff --git a/src/steps/writing/creation/dotGitHub/createMultiWorkflowFile.ts b/src/steps/writing/creation/dotGitHub/createMultiWorkflowFile.ts
index 1673210..0d38bef 100644
--- a/src/steps/writing/creation/dotGitHub/createMultiWorkflowFile.ts
+++ b/src/steps/writing/creation/dotGitHub/createMultiWorkflowFile.ts
@@ -10,7 +10,10 @@ export interface MultiWorkflowJobOptions {
 	steps: MultiWorkflowJobStep[];
 }
 
-export type MultiWorkflowJobStep = { run: string } | { uses: string };
+export type MultiWorkflowJobStep = { if?: string } & (
+	| { run: string }
+	| { uses: string }
+);
 
 export function createMultiWorkflowFile({
 	jobs,
diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.ts
index 064a6a1..72ecc78 100644
--- a/src/steps/writing/creation/dotGitHub/createWorkflows.ts
+++ b/src/steps/writing/creation/dotGitHub/createWorkflows.ts
@@ -88,7 +88,7 @@ export function createWorkflows(options: Options) {
 								name: "Test",
 								steps: [
 									{ run: "pnpm run test --coverage" },
-									{ uses: "codecov/codecov-action@v3" },
+									{ if: "always()", uses: "codecov/codecov-action@v3" },
 								],
 							},
 						]),


Test patch:
diff --git a/script/__snapshots__/migrate-test-e2e.ts.snap b/script/__snapshots__/migrate-test-e2e.ts.snap
index 8fe95da..06937d5 100644
--- a/script/__snapshots__/migrate-test-e2e.ts.snap
+++ b/script/__snapshots__/migrate-test-e2e.ts.snap
@@ -17,11 +17,50 @@ exports[`expected file changes > .github/workflows/ci.yml 1`] = `
      name: Build
      runs-on: ubuntu-latest
 @@ ... @@ jobs:
-       - uses: ./.github/actions/prepare
        - run: pnpm run test --coverage
-       - uses: codecov/codecov-action@v3
+       - if: always()
+         uses: codecov/codecov-action@v3
 -        with:
 -          flags: unit
+-  test_creation_script:
+-    name: Test Creation Script
+-    runs-on: ubuntu-latest
+-    steps:
+-      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+-      - uses: ./.github/actions/prepare
+-      - run: pnpm run build
+-      - run: pnpm run test:create
+-      - if: always()
+-        uses: codecov/codecov-action@v3
+-        with:
+-          files: coverage-create/lcov.info
+-          flags: create
+-  test_initialization_script:
+-    name: Test Initialization Script
+-    runs-on: ubuntu-latest
+-    steps:
+-      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+-      - uses: ./.github/actions/prepare
+-      - run: pnpm run build
+-      - run: pnpm run test:initialize
+-      - if: always()
+-        uses: codecov/codecov-action@v3
+-        with:
+-          files: coverage-initialize/lcov.info
+-          flags: initialize
+-  test_migration_script:
+-    name: Test Migration Script
+-    runs-on: ubuntu-latest
+-    steps:
+-      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+-      - uses: ./.github/actions/prepare
+-      - run: pnpm run build
+-      - run: pnpm run test:migrate
+-      - if: always()
+-        uses: codecov/codecov-action@v3
+-        with:
+-          files: coverage-migrate/lcov.info
+-          flags: migrate
    type_check:
      name: Type Check
      runs-on: ubuntu-latest"
diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts
index d348abd..2f5356d 100644
--- a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts
+++ b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts
@@ -126,7 +126,8 @@ describe("createWorkflows", () => {
 			      - uses: actions/checkout@v4
 			      - uses: ./.github/actions/prepare
 			      - run: pnpm run test --coverage
-			      - uses: codecov/codecov-action@v3
+			      - if: always()
+			        uses: codecov/codecov-action@v3
 			  type_check:
 			    name: Type Check
 			    runs-on: ubuntu-latest