Skip to content

Commit 1094f0f

Browse files
chore: move e2e migration scripts into ci.yml (#1733)
## 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 💖
1 parent 2cec803 commit 1094f0f

File tree

6 files changed

+92
-9
lines changed

6 files changed

+92
-9
lines changed

.github/DEVELOPMENT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ That end-to-end test executes `script/create-test-e2e.ts`, which:
152152
2. Asserts that commands such as `build` and `lint` each pass
153153

154154
The `pnpm run test:create` script is run in CI to ensure that templating changes are in sync with the template's actual files.
155-
See `.github/workflows/test-create.yml`.
155+
See `.github/workflows/ci.yml`'s `test_creation_script` job.
156156

157157
### The Initialization Script
158158

@@ -184,7 +184,7 @@ That end-to-end test executes `script/initialize-test-e2e.ts`, which:
184184
5. Runs initialization a second time, capturing test coverage
185185

186186
The `pnpm run test:initialize` script is run in CI to ensure that templating changes are in sync with the template's actual files.
187-
See `.github/workflows/test-initialize.yml`.
187+
See `.github/workflows/ci.yml`'s `test_initialization_script` job.
188188

189189
### The Migration Script
190190

@@ -228,7 +228,7 @@ That end-to-end test executes `script/migrate-test-e2e.ts`, which:
228228
3. Checks that the local repository's files were changed correctly (e.g. removed initialization-only files)
229229

230230
The `pnpm run test:migrate` script is run in CI to ensure that templating changes are in sync with the template's actual files.
231-
See `.github/workflows/test-migrate.yml`.
231+
See `.github/workflows/ci.yml`'s `test_migration_script` job.
232232

233233
> 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).
234234

.github/workflows/ci.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,49 @@ jobs:
6565
- uses: actions/checkout@v4
6666
- uses: ./.github/actions/prepare
6767
- run: pnpm run test --coverage
68-
- uses: codecov/codecov-action@v3
68+
- if: always()
69+
uses: codecov/codecov-action@v3
6970
with:
7071
flags: unit
72+
test_creation_script:
73+
name: Test Creation Script
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
77+
- uses: ./.github/actions/prepare
78+
- run: pnpm run build
79+
- run: pnpm run test:create
80+
- if: always()
81+
uses: codecov/codecov-action@v3
82+
with:
83+
files: coverage-create/lcov.info
84+
flags: create
85+
test_initialization_script:
86+
name: Test Initialization Script
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
90+
- uses: ./.github/actions/prepare
91+
- run: pnpm run build
92+
- run: pnpm run test:initialize
93+
- if: always()
94+
uses: codecov/codecov-action@v3
95+
with:
96+
files: coverage-initialize/lcov.info
97+
flags: initialize
98+
test_migration_script:
99+
name: Test Migration Script
100+
runs-on: ubuntu-latest
101+
steps:
102+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
103+
- uses: ./.github/actions/prepare
104+
- run: pnpm run build
105+
- run: pnpm run test:migrate
106+
- if: always()
107+
uses: codecov/codecov-action@v3
108+
with:
109+
files: coverage-migrate/lcov.info
110+
flags: migrate
71111
type_check:
72112
name: Type Check
73113
runs-on: ubuntu-latest

script/__snapshots__/migrate-test-e2e.ts.snap

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,50 @@ exports[`expected file changes > .github/workflows/ci.yml 1`] = `
1717
name: Build
1818
runs-on: ubuntu-latest
1919
@@ ... @@ jobs:
20-
- uses: ./.github/actions/prepare
2120
- run: pnpm run test --coverage
22-
- uses: codecov/codecov-action@v3
21+
- if: always()
22+
uses: codecov/codecov-action@v3
2323
- with:
2424
- flags: unit
25+
- test_creation_script:
26+
- name: Test Creation Script
27+
- runs-on: ubuntu-latest
28+
- steps:
29+
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
30+
- - uses: ./.github/actions/prepare
31+
- - run: pnpm run build
32+
- - run: pnpm run test:create
33+
- - if: always()
34+
- uses: codecov/codecov-action@v3
35+
- with:
36+
- files: coverage-create/lcov.info
37+
- flags: create
38+
- test_initialization_script:
39+
- name: Test Initialization Script
40+
- runs-on: ubuntu-latest
41+
- steps:
42+
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
43+
- - uses: ./.github/actions/prepare
44+
- - run: pnpm run build
45+
- - run: pnpm run test:initialize
46+
- - if: always()
47+
- uses: codecov/codecov-action@v3
48+
- with:
49+
- files: coverage-initialize/lcov.info
50+
- flags: initialize
51+
- test_migration_script:
52+
- name: Test Migration Script
53+
- runs-on: ubuntu-latest
54+
- steps:
55+
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
56+
- - uses: ./.github/actions/prepare
57+
- - run: pnpm run build
58+
- - run: pnpm run test:migrate
59+
- - if: always()
60+
- uses: codecov/codecov-action@v3
61+
- with:
62+
- files: coverage-migrate/lcov.info
63+
- flags: migrate
2564
type_check:
2665
name: Type Check
2766
runs-on: ubuntu-latest"

src/steps/writing/creation/dotGitHub/createMultiWorkflowFile.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export interface MultiWorkflowJobOptions {
1010
steps: MultiWorkflowJobStep[];
1111
}
1212

13-
export type MultiWorkflowJobStep = { run: string } | { uses: string };
13+
export type MultiWorkflowJobStep = { if?: string } & (
14+
| { run: string }
15+
| { uses: string }
16+
);
1417

1518
export function createMultiWorkflowFile({
1619
jobs,

src/steps/writing/creation/dotGitHub/createWorkflows.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ describe("createWorkflows", () => {
126126
- uses: actions/checkout@v4
127127
- uses: ./.github/actions/prepare
128128
- run: pnpm run test --coverage
129-
- uses: codecov/codecov-action@v3
129+
- if: always()
130+
uses: codecov/codecov-action@v3
130131
type_check:
131132
name: Type Check
132133
runs-on: ubuntu-latest

src/steps/writing/creation/dotGitHub/createWorkflows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function createWorkflows(options: Options) {
8888
name: "Test",
8989
steps: [
9090
{ run: "pnpm run test --coverage" },
91-
{ uses: "codecov/codecov-action@v3" },
91+
{ if: "always()", uses: "codecov/codecov-action@v3" },
9292
],
9393
},
9494
]),

0 commit comments

Comments
 (0)