Skip to content

Commit

Permalink
feat: unified CI jobs into one ci.yml (#1608)
Browse files Browse the repository at this point in the history
## PR Checklist

- [x] Addresses an existing open issue: fixes #1099
- [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

Comes with a nice overall reduction in line count too, despite the
addition of `createMultiWorkflowFile.ts`.

💖
  • Loading branch information
JoshuaKGoldberg authored Aug 10, 2024
1 parent 9683e6e commit a10362c
Show file tree
Hide file tree
Showing 24 changed files with 451 additions and 507 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build
- run: node ./lib/index.js
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build
- run: pnpm lint
lint_knip:
name: Lint Knip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm lint:knip
lint_markdown:
name: Lint Markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm lint:md
lint_packages:
name: Lint Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm lint:packages
lint_spelling:
name: Lint Spelling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm lint:spelling
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm format --list-different
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm run test --coverage
- uses: codecov/codecov-action@v3
with:
flags: unit
type_check:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm tsc

name: CI

on:
pull_request: ~
push:
branches:
- main
15 changes: 0 additions & 15 deletions .github/workflows/lint-knip.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/lint-markdown.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/lint-packages.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/lint-spelling.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/lint.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/prettier.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/test.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/tsc.yml

This file was deleted.

1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"apexskier",
"arethetypeswrong",
"automerge",
"codecov",
"codespace",
"contributorsrc",
"execa",
Expand Down
1 change: 1 addition & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions script/__snapshots__/migrate-test-e2e.ts.snap
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`expected file changes > .github/workflows/test.yml 1`] = `
"--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
exports[`expected file changes > .github/workflows/ci.yml 1`] = `
"--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ ... @@ jobs:
- uses: ./.github/actions/prepare
- run: pnpm run test --coverage
- name: Codecov
uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v3
- with:
- flags: unit
name: Test
"
type_check:
name: Type Check
runs-on: ubuntu-latest"
`;

exports[`expected file changes > .gitignore 1`] = `
Expand Down Expand Up @@ -75,6 +75,11 @@ exports[`expected file changes > cspell.json 1`] = `
"node_modules",
"pnpm-lock.yaml"
@@ ... @@
"apexskier",
"arethetypeswrong",
"automerge",
- "codecov",
"codespace",
"contributorsrc",
"execa",
"infile",
Expand Down
2 changes: 1 addition & 1 deletion script/migrate-test-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import packageData from "../package.json" assert { type: "json" };
const filesExpectedToBeChanged = [
"README.md",
"knip.json",
".github/workflows/test.yml",
".github/workflows/ci.yml",
".gitignore",
".prettierignore",
"cspell.json",
Expand Down
24 changes: 12 additions & 12 deletions src/steps/initializeBranchProtectionSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,31 @@ describe("migrateBranchProtectionSettings", () => {
"required_status_checks": {
"checks": [
{
"context": "build",
"context": "Build",
},
{
"context": "lint",
"context": "Compliance",
},
{
"context": "prettier",
"context": "Lint",
},
{
"context": "compliance",
"context": "Lint Knip",
},
{
"context": "lint_knip",
"context": "Lint Markdown",
},
{
"context": "lint_markdown",
"context": "Lint Packages",
},
{
"context": "lint_packages",
"context": "Lint Spelling",
},
{
"context": "lint_spelling",
"context": "Prettier",
},
{
"context": "test",
"context": "Test",
},
],
"strict": false,
Expand Down Expand Up @@ -146,13 +146,13 @@ describe("migrateBranchProtectionSettings", () => {
"required_status_checks": {
"checks": [
{
"context": "build",
"context": "Build",
},
{
"context": "lint",
"context": "Lint",
},
{
"context": "prettier",
"context": "Prettier",
},
],
"strict": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ export async function initializeBranchProtectionSettings(
required_pull_request_reviews: null,
required_status_checks: {
checks: [
{ context: "build" },
{ context: "lint" },
{ context: "prettier" },
...(options.excludeCompliance ? [] : [{ context: "compliance" }]),
...(options.excludeLintKnip ? [] : [{ context: "lint_knip" }]),
...(options.excludeLintMd ? [] : [{ context: "lint_markdown" }]),
{ context: "Build" },
...(options.excludeCompliance ? [] : [{ context: "Compliance" }]),
{ context: "Lint" },
...(options.excludeLintKnip ? [] : [{ context: "Lint Knip" }]),
...(options.excludeLintMd ? [] : [{ context: "Lint Markdown" }]),
...(options.excludeLintPackages
? []
: [{ context: "lint_packages" }]),
: [{ context: "Lint Packages" }]),
...(options.excludeLintSpelling
? []
: [{ context: "lint_spelling" }]),
...(options.excludeTests ? [] : [{ context: "test" }]),
: [{ context: "Lint Spelling" }]),
{ context: "Prettier" },
...(options.excludeTests ? [] : [{ context: "Test" }]),
],
strict: false,
},
Expand Down
Loading

0 comments on commit a10362c

Please sign in to comment.