Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move e2e migration scripts into ci.yml #1733

Merged
merged 3 commits into from
Dec 3, 2024
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
6 changes: 3 additions & 3 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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).

Expand Down
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 41 additions & 2 deletions script/__snapshots__/migrate-test-e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/steps/writing/creation/dotGitHub/createWorkflows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/steps/writing/creation/dotGitHub/createWorkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
],
},
]),
Expand Down
Loading