-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ jobs: | |
restore-keys: | | ||
yarn-${{ matrix.case }}- | ||
yarn- | ||
- run: yarn | ||
- uses: nick-invision/[email protected] | ||
with: | ||
max_attempts: 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Measure date | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
date: | ||
description: "Date to measure (yyyy-mm-dd)" | ||
default: "2021-01-01" | ||
required: true | ||
jobs: | ||
bench: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
case: | ||
- common-libs | ||
- esbuild-three | ||
scenario: | ||
- development-build | ||
- development-build+persistent-cache | ||
- development-build+pnp | ||
- development-rebuild | ||
- production-build | ||
- production-build+source-map | ||
- production-build+no-minimize | ||
- production-build+no-minimize+no-concatenation | ||
- production-build+persistent-cache | ||
- production-build+source-map+persistent-cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo ${{ github.event.inputs.date }} | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: yarn-${{ matrix.case }}-${{ github.event.inputs.date }} | ||
restore-keys: | | ||
yarn-${{ matrix.case }}- | ||
yarn- | ||
- run: yarn | ||
- run: node bin/measure-mean.js ${{ matrix.case }} ${{ matrix.scenario }} ${{ github.event.inputs.date }} | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: measure-results | ||
path: output | ||
upload: | ||
needs: [bench] | ||
if: ${{ always() }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo ${{ github.event.inputs.date }} | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: yarn-upload-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
yarn-upload- | ||
yarn- | ||
- run: yarn | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: measure-results | ||
path: output | ||
- run: node bin/upload.js ${{ github.event.inputs.date }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ jobs: | |
restore-keys: | | ||
yarn-${{ matrix.case }}- | ||
yarn- | ||
- run: yarn | ||
- uses: nick-invision/[email protected] | ||
with: | ||
max_attempts: 3 | ||
|
@@ -76,6 +77,7 @@ jobs: | |
restore-keys: | | ||
yarn-${{ matrix.case }}- | ||
yarn- | ||
- run: yarn | ||
- uses: nick-invision/[email protected] | ||
with: | ||
max_attempts: 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ cases/**/yarn.lock | |
.yarnrc.yml | ||
.pnp.js | ||
/output | ||
.gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { readFile, writeFile, stat } from "fs/promises"; | ||
import { resolve, relative } from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { runCommand } from "../lib/utils.js"; | ||
import ncpCallback from "ncp"; | ||
import { promisify } from "util"; | ||
|
||
const ncp = promisify(ncpCallback); | ||
|
||
const [, , name] = process.argv; | ||
|
||
if (!name) throw new Error("name argument missing"); | ||
|
||
const rootDir = resolve(fileURLToPath(import.meta.url), "../.."); | ||
|
||
const run = (command, args) => runCommand(command, args, true); | ||
|
||
const dirExist = async (p) => { | ||
try { | ||
if ((await stat(p)).isDirectory()) return true; | ||
} catch { | ||
return false; | ||
} | ||
}; | ||
|
||
(async () => { | ||
const targetDir = resolve(rootDir, ".gh-pages"); | ||
if (!(await dirExist(targetDir))) { | ||
await run("git", [ | ||
"clone", | ||
"--branch", | ||
"gh-pages", | ||
"--single-branch", | ||
"--depth", | ||
"1", | ||
"https://github.com/webpack/benchmark", | ||
".gh-pages", | ||
]); | ||
} | ||
process.chdir(targetDir); | ||
for (let i = 0; i < 2; i++) { | ||
await run("git", ["reset", "--hard"]); | ||
await run("git", ["pull"]); | ||
|
||
console.log("== copy output files =="); | ||
const indexFile = resolve(targetDir, "results", "index.txt"); | ||
const files = new Set((await readFile(indexFile, "utf-8")).split("\n")); | ||
files.delete(""); | ||
await ncp(resolve(rootDir, "output"), resolve(targetDir, "results", name), { | ||
filter: (filename) => { | ||
if (filename.endsWith(".json")) { | ||
files.add( | ||
`${name}/${relative(resolve(rootDir, "output"), filename).replace( | ||
/\\/g, | ||
"/" | ||
)}` | ||
); | ||
} | ||
return true; | ||
}, | ||
}); | ||
|
||
console.log("== update index.txt =="); | ||
await writeFile( | ||
indexFile, | ||
Array.from(files, (f) => `${f}\n`).join("") + "\n" | ||
); | ||
|
||
console.log("== commit =="); | ||
await run("git", ["add", `results/${name}/*.json`, "results/index.txt"]); | ||
try { | ||
await run("git", ["commit", "-m", `"add ${name} results"`]); | ||
} catch { | ||
break; | ||
} | ||
|
||
console.log("== push =="); | ||
await run("git", ["push"]); | ||
break; | ||
} | ||
})().catch((err) => { | ||
process.exitCode = 1; | ||
console.error(err.stack); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
"license": "MIT", | ||
"private": true, | ||
"dependencies": { | ||
"ncp": "^2.0.0", | ||
"ssl-root-cas": "^1.3.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters