Skip to content

Update node dependencies scripting 2024-11-22 #64

Update node dependencies scripting 2024-11-22

Update node dependencies scripting 2024-11-22 #64

Workflow file for this run

on:
pull_request:
paths:
- 'guide/**.js*'
- 'guide/**.ts*'
- 'guide/**.html'
- 'guide/src/**/*.md'
- 'guide/**/package.json'
- 'guide/**/package-lock.json'
name: Pull Request Guide
jobs:
create-release:
name: Build guide
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add Rust toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- run: rustup target add wasm32-unknown-unknown --toolchain stable
- name: Add Node.js toolchain ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build Results Viewer and Book ${{ matrix.node-version }}
run: |
set -x
# install mdbook and wasm-pack
mkdir ~/bin
PATH=$PATH:~/bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.20/mdbook-v0.4.20-x86_64-unknown-linux-gnu.tar.gz \
| tar -xz -C ~/bin
curl -sSL https://github.com/rustwasm/wasm-pack/releases/download/v0.12.1/wasm-pack-v0.12.1-x86_64-unknown-linux-musl.tar.gz \
| tar -xz --strip-components=1 -C ~/bin --no-anchored wasm-pack
# setup some envs to various paths for convenience
PROJECT_ROOT=$PWD
GUIDE_DIR=$(realpath $PROJECT_ROOT/guide)
RESULTS_VIEWER_REACT_DIR=$(realpath $GUIDE_DIR/results-viewer-react)
WASM_LIB_DIR=$(realpath $PROJECT_ROOT/lib/hdr-histogram-wasm)
WASM_OUTPUT_REACT_DIR=$RESULTS_VIEWER_REACT_DIR/lib/hdr-histogram-wasm
CFG_GEN_DIR=$(realpath $PROJECT_ROOT/lib/config-gen)
mkdir -p "$RESULTS_VIEWER_REACT_DIR/lib/config-gen"
CFG_GEN_OUTPUT_REACT_DIR=$RESULTS_VIEWER_REACT_DIR/lib/config-gen
# build the hdr-histogram-wasm for the results viewer
cd $WASM_LIB_DIR
wasm-pack build --release -t bundler -d $WASM_OUTPUT_REACT_DIR --scope fs
# build the config-gen library for the HAR to YAML converter
cd $CFG_GEN_DIR
wasm-pack build --release -t bundler -d $CFG_GEN_OUTPUT_REACT_DIR --scope fs
cd $RESULTS_VIEWER_REACT_DIR
npm ci
npm run linterror
npm run build
# build the book
cd $GUIDE_DIR
mdbook build