Skip to content

Commit 12c223b

Browse files
author
Craigory Coppola
committed
feat(repo): enable semantic-release
1 parent e5b1ac5 commit 12c223b

File tree

12 files changed

+2562
-71
lines changed

12 files changed

+2562
-71
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
# Triggers the workflow on push or pull request events but only for the master branch
55
push:
66
branches: [master]
7-
pull_request:
8-
branches: [master]
97

108
env:
119
NX_BRANCH: ${{ github.event.number }}

.github/workflows/pr.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Run PR checks
2+
3+
on:
4+
# Triggers the workflow on push or pull request events but only for the master branch
5+
pull_request:
6+
branches: [master]
7+
8+
env:
9+
NX_BRANCH: ${{ github.event.number }}
10+
NX_RUN_GROUP: ${{ github.run_id }}
11+
12+
jobs:
13+
14+
build:
15+
runs-on: ubuntu-latest
16+
name: Building affected apps
17+
steps:
18+
- uses: actions/checkout@v1
19+
- uses: bahmutov/npm-install@v1.4.5
20+
- run: yarn nx affected -- --target=build --base=origin/master --parallel --with-deps
21+
22+
test:
23+
runs-on: ubuntu-latest
24+
name: Testing affected apps
25+
steps:
26+
- uses: actions/checkout@v1
27+
- uses: bahmutov/npm-install@v1.4.5
28+
- run: yarn nx affected -- --target=test --base=origin/master --parallel
29+
30+
lint:
31+
runs-on: ubuntu-latest
32+
name: Linting affected apps
33+
steps:
34+
- uses: actions/checkout@v1
35+
- uses: bahmutov/npm-install@v1.4.5
36+
- run: yarn nx affected -- --target=lint --base=origin/master --parallel
37+
38+
commitlint:
39+
runs-on: ubuntu-latest
40+
name: Check commit message for consistency
41+
steps:
42+
- uses: actions/checkout@v1
43+
- uses: bahmutov/npm-install@v1.4.5
44+
- run: yarn commitlint --from origin/master --to HEAD --verbose
45+
46+
47+
# e2e:
48+
# runs-on: ubuntu-latest
49+
# name: E2E testing affected apps
50+
# needs: [pre-run, build]
51+
# if: needs.pre-run.outputs.skip == 'false'
52+
# steps:
53+
# - uses: actions/checkout@v1
54+
# - uses: bahmutov/npm-install@v1.4.5
55+
# - name: Download a single artifact
56+
# uses: actions/download-artifact@v2
57+
# with:
58+
# name: dist
59+
# path: dist
60+
# - run: yarn e2e

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit "$1"

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint-staged

commitlint.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const Configuration = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'scope-enum': [1, 'always', ['repo', 'dotnet', 'core', 'typescript']],
5+
},
6+
};
7+
8+
module.exports = Configuration;

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"build": "nx build",
99
"test": "nx test",
1010
"lint": "nx workspace-lint && nx lint",
11+
"prepare": "husky install",
12+
"lint-staged": "lint-staged",
1113
"affected:apps": "nx affected:apps",
1214
"affected:libs": "nx affected:libs",
1315
"affected:build": "nx affected:build",
@@ -26,7 +28,8 @@
2628
"publish-dev": "ts-node tools/scripts/publish-dev",
2729
"e2e-registry": "yarn verdaccio --config ./tools/scripts/local-registry/config.yml --listen 4872",
2830
"e2e-tests": "ts-node -P ./tools/scripts/tsconfig.e2e.json ./tools/scripts/e2e.ts",
29-
"e2e": "run-p -r e2e-registry \"e2e-tests {@}\" --"
31+
"e2e": "run-p -r e2e-registry \"e2e-tests {@}\" --",
32+
"semantic-release": "semantic-release"
3033
},
3134
"private": false,
3235
"dependencies": {
@@ -38,6 +41,9 @@
3841
"xmldoc": "^1.1.2"
3942
},
4043
"devDependencies": {
44+
"@commitlint/cli": "^12.1.1",
45+
"@commitlint/config-conventional": "^12.1.1",
46+
"@commitlint/types": "^12.1.1",
4147
"@nrwl/cli": "12.0.8",
4248
"@nrwl/devkit": "12.0.8",
4349
"@nrwl/eslint-plugin-nx": "12.0.8",
@@ -56,13 +62,25 @@
5662
"dotenv": "8.2.0",
5763
"eslint": "7.22.0",
5864
"eslint-config-prettier": "8.1.0",
65+
"husky": "^6.0.0",
5966
"jest": "26.2.2",
67+
"lint-staged": "^10.5.4",
6068
"prettier": "2.2.1",
6169
"run-p": "*",
70+
"semantic-release": "^17.4.2",
6271
"ts-jest": "26.4.0",
6372
"ts-node": "~9.1.1",
6473
"tslib": "^2.0.0",
6574
"typescript": "4.1.4",
6675
"verdaccio": "^5.0.1"
76+
},
77+
"lint-staged": {
78+
"**/*.{js,ts,md,json}": [
79+
"prettier --write"
80+
]
81+
},
82+
"repository": {
83+
"type": "git",
84+
"url": "https://github.com/nx-dotnet/nx-dotnet.git"
6785
}
68-
}
86+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { TestExecutorSchema } from './schema';
21
import executor from './executor';
2+
import { TestExecutorSchema } from './schema';
33

44
const options: TestExecutorSchema = {};
55

@@ -8,4 +8,4 @@ describe('Test Executor', () => {
88
const output = await executor(options);
99
expect(output.success).toBe(true);
1010
});
11-
});
11+
});

packages/core/src/generators/app/generator.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
33

44
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet';
55

6+
import * as mockedProjectGenerator from '../utils/generate-project';
67
import generator from './generator';
78
import { NxDotnetGeneratorSchema } from './schema';
8-
import * as mockedProjectGenerator from '../utils/generate-project';
99

1010
jest.mock('../utils/generate-project');
1111

@@ -36,6 +36,11 @@ describe('nx-dotnet library generator', () => {
3636
>).GenerateProject;
3737

3838
await generator(appTree, options, dotnetClient);
39-
expect(projectGenerator).toHaveBeenCalledWith(appTree, options, dotnetClient, 'application');
39+
expect(projectGenerator).toHaveBeenCalledWith(
40+
appTree,
41+
options,
42+
dotnetClient,
43+
'application'
44+
);
4045
});
4146
});

packages/core/src/generators/lib/generator.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
33

44
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet';
55

6+
import * as mockedProjectGenerator from '../utils/generate-project';
67
import generator from './generator';
78
import { NxDotnetGeneratorSchema } from './schema';
8-
import * as mockedProjectGenerator from '../utils/generate-project';
99

1010
jest.mock('../utils/generate-project');
1111

@@ -36,6 +36,11 @@ describe('nx-dotnet library generator', () => {
3636
>).GenerateProject;
3737

3838
await generator(appTree, options, dotnetClient);
39-
expect(projectGenerator).toHaveBeenCalledWith(appTree, options, dotnetClient, 'library');
39+
expect(projectGenerator).toHaveBeenCalledWith(
40+
appTree,
41+
options,
42+
dotnetClient,
43+
'library'
44+
);
4045
});
4146
});

0 commit comments

Comments
 (0)