Skip to content

Commit

Permalink
feat(actions): simplify workflows and jobs (#1257)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The "commitlint" workflow is unified into the "test" workflow and removed.
  • Loading branch information
ybiquitous authored May 10, 2022
1 parent ee70357 commit 2df37d7
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 50 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/commitlint.yml

This file was deleted.

27 changes: 24 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,37 @@ jobs:
name: "test on node ${{ matrix.node-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["14", "16", "18"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache: npm
- run: npm --global install npm@latest
- run: npm ci
- run: npm test --ignore-scripts

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: npm
- run: npm --global install npm@latest
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run release:dry-run

commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
with:
configFile: package.json
1 change: 0 additions & 1 deletion lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export async function init({ cwd = process.cwd(), logger = defaultLogger } = {})
await cmd.updatePackageFile();
await cmd.writePackageFile(".editorconfig");
await cmd.writePackageFile(".remarkignore");
await cmd.writePackageFile(".github", "workflows", "commitlint.yml");
await cmd.writePackageFile(".github", "workflows", "npm-audit-fix.yml");
await cmd.writePackageFile(".github", "workflows", "npm-diff.yml");
await cmd.writePackageFile(".github", "workflows", "release.yml");
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"types",
".editorconfig",
".remarkignore",
".github/workflows/commitlint.yml",
".github/workflows/npm-audit-fix.yml",
".github/workflows/npm-diff.yml",
".github/workflows/release.yml",
Expand Down
49 changes: 24 additions & 25 deletions test/__snapshots__/init.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -155,28 +155,6 @@ trim_trailing_spaces = false
"
`;

exports[`write ".github/workflows/commitlint.yml" 1`] = `
"name: commitlint
on:
push:
branches: [\\"main\\"]
pull_request:
branches: [\\"**\\"]
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
with:
configFile: package.json
"
`;

exports[`write ".github/workflows/npm-audit-fix.yml" 1`] = `
"name: npm audit fix
Expand Down Expand Up @@ -239,19 +217,40 @@ jobs:
name: \\"test on node \${{ matrix.node-version }}\\"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [\\"14\\", \\"16\\", \\"18\\"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: \${{ matrix.node-version }}
cache: \\"npm\\"
cache: npm
- run: npm --global install npm@latest
- run: npm ci
- run: npm test --ignore-scripts
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: \\"lts/*\\"
cache: npm
- run: npm --global install npm@latest
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run release:dry-run
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
with:
configFile: package.json
"
`;

Expand Down
2 changes: 0 additions & 2 deletions test/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ test('update "package.json" without fields', () =>
[
".editorconfig",
".remarkignore",
".github/workflows/commitlint.yml",
".github/workflows/npm-audit-fix.yml",
".github/workflows/release.yml",
".github/workflows/test.yml",
Expand Down Expand Up @@ -89,7 +88,6 @@ test("End-to-End via CLI", () =>
"=> 'package.json' was updated
=> '.editorconfig' was updated
=> '.remarkignore' was updated
=> '.github/workflows/commitlint.yml' was updated
=> '.github/workflows/npm-audit-fix.yml' was updated
=> '.github/workflows/npm-diff.yml' was updated
=> '.github/workflows/release.yml' was updated
Expand Down

0 comments on commit 2df37d7

Please sign in to comment.