tools: add @reporters/github to tools

PR-URL: https://github.com/nodejs/node/pull/49129
Refs: https://github.com/nodejs/node/issues/49120
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Moshe Atlow 2023-08-13 09:32:53 +03:00 committed by Node.js GitHub Bot
parent 802c52fb8b
commit 8972f9beed
5 changed files with 2672 additions and 0 deletions

View File

@ -5,6 +5,7 @@ test/fixtures
test/message/esm_display_syntax_error.mjs
tools/icu
tools/lint-md/lint-md.mjs
tools/github_reporter
benchmark/tmp
benchmark/fixtures
doc/**/*.js

View File

@ -140,6 +140,14 @@ jobs:
cat temp-output
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
rm temp-output
- id: github_reporter
subsystem: tools
label: tools
run: |
./tools/dep_updaters/update-github-reporter.sh > temp-output
cat temp-output
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
rm temp-output
- id: googletest
subsystem: deps
label: dependencies, test

View File

@ -0,0 +1,44 @@
#!/bin/sh
# Shell script to update @reporters/github in the source tree to the latest release.
# This script must be in the tools directory when it runs because it uses the
# script source file path to determine directories to work in.
set -ex
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)
NPM="$ROOT/deps/npm/bin/npm-cli.js"
# shellcheck disable=SC1091
. "$ROOT/tools/dep_updaters/utils.sh"
NEW_VERSION=$("$NODE" "$NPM" view @reporters/github dist-tags.latest)
CURRENT_VERSION=$("$NODE" -p "require('./tools/github_reporter/package.json').version")
# This function exit with 0 if new version and current version are the same
compare_dependency_version "@reporters/github" "$NEW_VERSION" "$CURRENT_VERSION"
cd "$( dirname "$0" )/../.." || exit
rm -rf tools/github_reporter
(
rm -rf github-reporter-tmp
mkdir github-reporter-tmp
cd github-reporter-tmp || exit
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "@reporters/github@$NEW_VERSION"
"$NODE" "$NPM" exec --package=esbuild@0.17.15 --yes -- esbuild ./node_modules/@reporters/github --bundle --platform=node --outfile=bundle.js
)
mkdir tools/github_reporter
mv github-reporter-tmp/bundle.js tools/github_reporter/index.js
mv github-reporter-tmp/node_modules/@reporters/github/package.json tools/github_reporter/package.json
rm -rf github-reporter-tmp/
# The last line of the script should always print the new version,
# as we need to add it to $GITHUB_ENV variable.
echo "NEW_VERSION=$NEW_VERSION"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
{
"name": "@reporters/github",
"version": "1.5.2",
"description": "A github actions reporter for `node:test`",
"keywords": [
"github actions",
"node:test",
"test",
"reporter",
"reporters"
],
"dependencies": {
"@actions/core": "^1.10.0",
"stack-utils": "^2.0.6"
},
"files": [
"./index.js"
],
"scripts": {
"test": "node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./index.js --test-reporter-destination=stdout --test"
},
"bugs": {
"url": "https://github.com/MoLow/reporters/issues"
},
"main": "index.js",
"homepage": "https://github.com/MoLow/reporters/tree/main/packages/github",
"repository": "https://github.com/MoLow/reporters.git",
"author": "Moshe Atlow",
"license": "MIT"
}