Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit e1c687d

Browse files
committed
move sources to src/ directory
1 parent d54c8a9 commit e1c687d

19 files changed

+34
-31
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/node_modules
2-
/*.js
3-
/*.js.map
2+
/src/*.js
3+
/src/*.js.map
44
/examples/rust/Cargo.lock
55
/examples/rust/target
66
/test/*.js

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Development
55

66
Adding support for new benchmaking tools is welcome!
77

8-
1. Add your tool name in `config.ts`
9-
2. Implement the logic to extract benchmark results from output in `extract.ts`
8+
1. Add your tool name in `src/config.ts`
9+
2. Implement the logic to extract benchmark results from output in `src/extract.ts`
1010
3. Add tests for your tool under `test/*.ts`
1111
4. Add your tool's color in `default_index_html.ts`
1212
5. Add example project under `examples/` directory
@@ -34,4 +34,4 @@ And for another example, here are commits to add support for `pytest-benchmark`:
3434
1. Run `$ bash scripts/prepare-release.sh v1`
3535
2. Check changes with `git diff --cached`
3636
3. If ok, create a new commit and tag it with `v1.x.y`
37-
4. Push to `v1` remote repository and make a release on GitHub
37+
4. Push the commit and tag to `v1` remote repository and make a release on GitHub

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ inputs:
6161

6262
runs:
6363
using: 'node12'
64-
main: 'index.js'
64+
main: 'src/index.js'

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"private": true,
55
"description": "",
6-
"main": "index.js",
6+
"main": "src/index.js",
77
"scripts": {
88
"build": "tsc -p .",
99
"watch:tsc": "tsc -p . --watch --preserveWatchOutput",

scripts/ci_validate_modification.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as path from 'path';
22
import { promises as fs } from 'fs';
33
import * as cp from 'child_process';
4-
import { DataJson, BenchmarkSuites, SCRIPT_PREFIX } from '../write';
5-
import { VALID_TOOLS } from '../config';
6-
import { Benchmark } from '../extract';
4+
import { DataJson, BenchmarkSuites, SCRIPT_PREFIX } from '../src/write';
5+
import { VALID_TOOLS } from '../src/config';
6+
import { Benchmark } from '../src/extract';
77
import { diff, Diff, DiffNew, DiffEdit, DiffArray } from 'deep-diff';
88
import deepEq = require('deep-equal');
99

scripts/prepare-release.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@ npm prune --production
4242
rm -rf .release
4343
mkdir -p .release
4444

45-
cp action.yml *.js package.json package-lock.json .release/
45+
cp action.yml src/*.js package.json package-lock.json .release/
4646
cp -R node_modules .release/node_modules
4747

4848
git checkout "$version"
4949
git pull
50-
rm -rf node_modules
50+
git rm -rf node_modules
51+
rm -rf node_modules # remove node_modules/.cache
52+
mkdir -p src
53+
5154
mv .release/action.yml .
52-
mv .release/*.js .
55+
mv .release/*.js ./src/
5356
mv .release/*.json .
5457
mv .release/node_modules .
5558

56-
git add action.yml *.js *.json node_modules
59+
git add action.yml ./src/*.js package.json package-lock.json node_modules
5760
set +x
5861

5962
echo "Done. Please check 'git diff --cached' to verify changes. If ok, add version tag and push it to remote"

config.ts src/config.ts

File renamed without changes.
File renamed without changes.

extract.ts src/extract.ts

File renamed without changes.

git.ts src/git.ts

File renamed without changes.

index.ts src/index.ts

File renamed without changes.
File renamed without changes.

write.ts src/write.ts

File renamed without changes.

test/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mock('@actions/core', {
1818
});
1919

2020
// This line must be called after mocking
21-
const { configFromJobInput, VALID_TOOLS } = require('../config');
21+
const { configFromJobInput, VALID_TOOLS } = require('../src/config');
2222

2323
describe('configFromJobInput()', function() {
2424
const cwd = process.cwd();

test/default_index_html.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { strict as A } from 'assert';
22
import * as cheerio from 'cheerio';
33
import { Parser as JsParser } from 'acorn';
4-
import { DEFAULT_INDEX_HTML } from '../default_index_html';
4+
import { DEFAULT_INDEX_HTML } from '../src/default_index_html';
55

66
describe('DEFAULT_INDEX_HTML', function() {
77
it('is valid HTML and its script is valid as JavaScript', function() {

test/extract.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from 'path';
22
import { strict as A } from 'assert';
33
import mock = require('mock-require');
4-
import { BenchmarkResult } from '../extract';
4+
import { BenchmarkResult } from '../src/extract';
55

66
mock('@actions/github', {
77
context: {
@@ -12,7 +12,7 @@ mock('@actions/github', {
1212
},
1313
});
1414

15-
const { extractResult } = require('../extract');
15+
const { extractResult } = require('../src/extract');
1616

1717
describe('extractResult()', function() {
1818
after(function() {

test/git.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ mock('@actions/github', {
4141
context: gitHubContext,
4242
});
4343

44-
const git = require('../git');
44+
const git = require('../src/git');
4545
const ok: (x: any) => asserts x = A.ok;
4646
const userArgs = ['-c', 'user.name=github-action-benchmark', '-c', '[email protected]'];
4747

test/write.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { promises as fs } from 'fs';
44
import * as cheerio from 'cheerio';
55
import markdownit = require('markdown-it');
66
import mock = require('mock-require');
7-
import { Config } from '../config';
8-
import { Benchmark } from '../extract';
9-
import { DataJson } from '../write';
7+
import { Config } from '../src/config';
8+
import { Benchmark } from '../src/extract';
9+
import { DataJson } from '../src/write';
1010

1111
const ok: (x: any, msg?: string) => asserts x = assertOk;
1212

@@ -79,7 +79,7 @@ mock('@actions/core', {
7979
mock('@actions/github', { context: gitHubContext });
8080
mock('@octokit/rest', FakedOctokit);
8181

82-
const writeBenchmark: (b: Benchmark, c: Config) => Promise<any> = require('../write').writeBenchmark;
82+
const writeBenchmark: (b: Benchmark, c: Config) => Promise<any> = require('../src/write').writeBenchmark;
8383

8484
describe('writeBenchmark()', function() {
8585
const savedCwd = process.cwd();

tsconfig.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
"resolveJsonModule": true
2121
},
2222
"files": [
23-
"index.ts",
24-
"config.ts",
25-
"test/config.ts",
26-
"extract.ts",
23+
"src/index.ts",
24+
"src/config.ts",
25+
"src/extract.ts",
26+
"src/git.ts",
27+
"src/write.ts",
28+
"src/default_index_html.ts",
29+
"src/octokit_graphql.d.ts",
2730
"test/extract.ts",
28-
"git.ts",
31+
"test/config.ts",
2932
"test/git.ts",
30-
"write.ts",
3133
"test/write.ts",
32-
"default_index_html.ts",
3334
"test/default_index_html.ts",
34-
"octokit_graphql.d.ts",
3535
"scripts/ci_validate_modification.ts"
3636
]
3737
}

0 commit comments

Comments
 (0)