Skip to content

Commit a557497

Browse files
committed
#1 - Added more tests and test coverage
Signed-off-by: Gregor Anders <gregor.anders@gmail.com>
1 parent 2af02fe commit a557497

File tree

19 files changed

+180
-35
lines changed

19 files changed

+180
-35
lines changed

.github/actions/build-info/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"esModuleInterop": true,
77
"noImplicitAny": true,
88
"sourceMap": true,
9+
"strict": true,
910
"outDir": "./",
1011
},
1112
"include": [

.github/actions/create-release/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ async function run(): Promise<void> {
1313

1414
const { owner, repo } = context.repo;
1515

16+
if (!process.env.GITHUB_TOKEN) {
17+
core.setFailed("Missing GitHub token");
18+
return;
19+
}
20+
1621
const github: GitHub = new GitHub(process.env.GITHUB_TOKEN);
1722

1823
let releaseID: number = -1;

.github/actions/create-release/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"esModuleInterop": true,
77
"noImplicitAny": true,
88
"sourceMap": true,
9+
"strict": true,
910
"outDir": "./",
1011
},
1112
"include": [

.github/actions/gulpfile.ts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,16 @@ import * as ncc from "@zeit/ncc";
1010

1111
const basePath: fs.PathLike = fs.realpathSync(path.resolve(__dirname, "../.."));
1212

13-
interface INCCCompileOptions {
14-
cache?: boolean;
15-
debugLog?: boolean;
16-
externals?: string[];
17-
filterAssetBase?: string;
18-
minify?: boolean;
19-
quiet?: boolean;
20-
v8cache?: boolean;
21-
}
22-
23-
function nccCompile(options?: INCCCompileOptions): any {
13+
function nccCompile(): any {
2414
return through.obj((chunk: any, encoding: string, callback: through.TransformCallback): any => {
2515
if (chunk.isBuffer()) {
26-
ncc(chunk.path, Object.assign(options, {
16+
ncc(chunk.path, {
17+
cache: false,
18+
minify: false,
19+
quiet: false,
2720
sourceMap: false,
2821
sourceMapRegister: false,
29-
})).then((result: any): void => {
22+
}).then((result: any): void => {
3023
chunk.path = chunk.path.replace(".ts", ".js");
3124
chunk.contents = Buffer.from(result.code);
3225
callback(undefined, chunk);
@@ -38,11 +31,7 @@ function nccCompile(options?: INCCCompileOptions): any {
3831
}
3932

4033
gulp.task("default", (): NodeJS.ReadWriteStream => {
41-
return gulp.src(path.join(basePath, ".github/actions/**/*.ts"))
42-
.pipe(nccCompile({
43-
cache: false,
44-
minify: false,
45-
quiet: false,
46-
}))
34+
return gulp.src(path.join(basePath, ".github/actions/**/index.ts"))
35+
.pipe(nccCompile())
4736
.pipe(gulp.dest(path.resolve(basePath, ".github/actions/")));
4837
});

.github/actions/prepare-release/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"esModuleInterop": true,
77
"noImplicitAny": true,
88
"sourceMap": true,
9+
"strict": true,
910
"outDir": "./",
1011
},
1112
"include": [

.github/actions/upload-asset/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ async function run(): Promise<void> {
1212
const assetName: string = core.getInput("name", {required: true});
1313
const assetPath: string = core.getInput("path", {required: true});
1414

15+
if (!process.env.GITHUB_TOKEN) {
16+
core.setFailed("Missing GitHub token");
17+
return;
18+
}
19+
1520
const github: GitHub = new GitHub(process.env.GITHUB_TOKEN);
1621

1722
const fullPathChecked: fs.PathLike = path.resolve(fs.realpathSync(assetPath));
@@ -23,7 +28,7 @@ async function run(): Promise<void> {
2328
try {
2429
const headers: Octokit.ReposUploadReleaseAssetParamsHeaders = {
2530
"content-length": fs.statSync(fullPathChecked).size,
26-
"content-type": getType(fullPathChecked),
31+
"content-type": getType(fullPathChecked) || "application/zip",
2732
};
2833

2934
const response: Octokit.Response<Octokit.ReposUploadReleaseAssetResponse> = await github.repos.uploadReleaseAsset({
@@ -33,9 +38,9 @@ async function run(): Promise<void> {
3338
url: assetUploadURL,
3439
});
3540

36-
console.log(response.data);
41+
const data: Octokit.ReposUploadReleaseAssetResponseValue = response.data as any;
3742

38-
core.setOutput("url", "abc");
43+
core.setOutput("url", data.browser_download_url);
3944
} catch (error) {
4045
core.setFailed("Error");
4146
return;

.github/actions/upload-asset/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"esModuleInterop": true,
77
"noImplicitAny": true,
88
"sourceMap": true,
9+
"strict": true,
910
"outDir": "./",
1011
},
1112
"include": [

.github/workflows/development.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ jobs:
3939
npm run build
4040
npm test
4141
npm run dist
42+
- name: test coverage
43+
uses: coverallsapp/github-action@master
44+
with:
45+
github-token: ${{ secrets.GITHUB_TOKEN }}
46+
path-to-lcov: ./coverage/lcov.info
4247
env:
4348
CI: true
4449
GITHUB_CONTEXT: ${{ toJson(github) }}

.github/workflows/master.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646
GITHUB_HEAD_REF: ${{ github.head_ref }}
4747
GITHUB_BASE_REF: ${{ github.base_ref }}
4848
GITHUB_COMMIT: ${{ github.sha }}
49+
- name: test coverage
50+
uses: coverallsapp/github-action@master
51+
with:
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
path-to-lcov: ./coverage/lcov.info
4954
- name: release
5055
id: release
5156
uses: ./.github/actions/create-release

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646
GITHUB_HEAD_REF: ${{ github.head_ref }}
4747
GITHUB_BASE_REF: ${{ github.base_ref }}
4848
GITHUB_COMMIT: ${{ github.sha }}
49+
- name: test coverage
50+
uses: coverallsapp/github-action@master
51+
with:
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
path-to-lcov: ./coverage/lcov.info
4954
- name: prepare release
5055
id: prepare
5156
uses: ./.github/actions/prepare-release

0 commit comments

Comments
 (0)