Skip to content

Commit

Permalink
Update dependencies (#62)
Browse files Browse the repository at this point in the history
* Updated results viewer dependencies and fixed sed command

* Added sed fix to update-guild.yml

* Added tests for the hdr-histogram-wasm

* Updated dependencies for config-wasm tests

* Updated the comment to show that wasm-pack v0.10.0 works

* Renamed tests directory to match config directory

* Renamed config_wasm to config-wasm to match hdr-histogram-wasm

* Updated the mdbook and wasm-pack versions in the Dockerfile

* Updated the workflows

- Updated the mdbook and wasm-pack versions
- Updated pr and release to build both config-wasm and hdr-histogram-wasm and run tests

* Updated the lock file to the latest dependencies

* Fixed warning in latest version of Rust

rust-lang/rust#79202

* Changed the config-wasm and hdr-histogram-wasm to be scoped '@fs'

* extraneous spaces from empty lines

* Fixed the names in the Javascript PR workflow

* Initial fixes for clippy (failing tests)

* Updated babel version
  • Loading branch information
tkmcmaster authored Sep 3, 2021
1 parent b0536ea commit d87c7e0
Show file tree
Hide file tree
Showing 44 changed files with 4,566 additions and 6,288 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ FROM rust:1.52
# https://github.com/EmbarkStudios/cargo-deny/releases
ARG CARGO_DENY_VER=0.9.1
# https://github.com/rust-lang/mdBook/releases
ARG MDBOOK_VER=v0.4.7
ARG MDBOOK_VER=v0.4.12
# https://github.com/rustwasm/wasm-pack/releases
ARG WASM_PACK_VER=v0.8.1
ARG WASM_PACK_VER=v0.10.0
# https://nodejs.org/
ARG NODE_MAJOR_VER=12

Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/pr-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
on:
pull_request:
paths:
- '**.js'
- '**.ts'
- '**.html'
- '**/package.json'
- '**/package-lock.json'

name: Pull Request Javascript
jobs:
create-release:
name: Build guide
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Add Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
toolchain: stable
override: true
- name: Add Node.js toolchain
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Build Results Viewer and Book
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.12/mdbook-v0.4.12-x86_64-unknown-linux-gnu.tar.gz \
| tar -xz -C ~/bin
curl -sSL https://github.com/rustwasm/wasm-pack/releases/download/v0.10.0/wasm-pack-v0.10.0-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_DIR=$(realpath $GUIDE_DIR/results-viewer)
WASM_LIB_DIR=$(realpath $PROJECT_ROOT/lib/hdr-histogram-wasm)
WASM_OUTPUT_DIR=$RESULTS_VIEWER_DIR/lib/hdr-histogram-wasm
# build the hdr-histogram-wasm for the results viewer
cd $WASM_LIB_DIR
wasm-pack build --release -t web -d $WASM_OUTPUT_DIR
cd $WASM_OUTPUT_DIR
sed -i 's/input = .*import\.meta\.url.*/import(".\/hdr_histogram_wasm_bg.wasm");\ninput = require.resolve(".\/hdr_histogram_wasm_bg.wasm")[0][0];/' hdr_histogram_wasm.js
# build the results viewer (which includes putting the output into the book's src)
cd $RESULTS_VIEWER_DIR
npm ci
npm run build
# build the book
cd $GUIDE_DIR
mdbook build
13 changes: 8 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ jobs:

wasm-pack:
name: Wasm Build
strategy:
matrix:
wasm-dirctory: [config-wasm, hdr-histogram-wasm]
runs-on: ubuntu-latest
env:
working-directory: ./lib/config_wasm
test-directory: ./lib/config_wasm/tests
wasm-directory: ./lib/${{ matrix.wasm-dirctory }}
test-directory: ./lib/${{ matrix.wasm-dirctory }}/tests
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand All @@ -92,14 +95,14 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: install
args: --version 0.8.1 wasm-pack
args: --version 0.10.0 wasm-pack

- name: Create the Web Assembly
id: wasm_pack
run: |
set -x
wasm-pack build --release -t nodejs
working-directory: ${{env.working-directory}}
wasm-pack build --release -t nodejs --scope fs
working-directory: ${{env.wasm-directory}}
shell: bash

- name: Use Node.js 12.x
Expand Down
80 changes: 75 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ jobs:
asset_content_type: application/octet-stream


wasm-release:
name: Wasm Pack and Upload
wasm-release-config:
name: Wasm Pack and Upload Config Parser
needs: ['create-release']
runs-on: ubuntu-latest
env:
working-directory: ./lib/config_wasm
working-directory: ./lib/config-wasm
steps:
- uses: actions/checkout@v2
- name: Download artifacts
Expand Down Expand Up @@ -181,12 +181,12 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: install
args: --version 0.8.1 wasm-pack
args: --version 0.10.0 wasm-pack
- name: Create the Web Assembly
id: wasm_pack
run: |
set -x
wasm-pack build --release -t nodejs
wasm-pack build --release -t nodejs --scope fs
working-directory: ${{env.working-directory}}
shell: bash

Expand All @@ -197,6 +197,76 @@ jobs:
XZ_OPT=-9 tar -C ./ -cJf $asset_name package.json config*
working-directory: ${{env.working-directory}}/pkg/

- name: Upload release asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
asset_path: ${{env.working-directory}}/pkg/${{ env.ASSET_NAME }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: application/octet-stream


# The hdr-histogram-wasm needs to be build with web rather than nodejs
wasm-release-histogram:
name: Wasm Pack and Upload Histogram
needs: ['create-release']
runs-on: ubuntu-latest
env:
working-directory: ./lib/hdr-histogram-wasm
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: artifacts
path: artifacts

- name: Get upload data
id: upload_data
shell: bash
run: |
release_upload_url="$(cat artifacts/release-upload-url)"
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
release_version="$(cat artifacts/release-version)"
echo "VERSION=$release_version" >> $GITHUB_ENV
- name: Set Cargo.toml version
id: set_cargo_version
shell: bash
run: |
# remove the leading "v" for subsequent usage
version=${VERSION/v/}
# replace the version value in Cargo.toml with the tag version (so we don't need to create extraneous commits for every preview version)
cp Cargo.toml Cargo2.toml
sed "0,/version = \".*\"/s//version = \"$version\"/" Cargo2.toml > Cargo.toml
working-directory: ${{env.working-directory}}

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: install
args: --version 0.10.0 wasm-pack
- name: Create the Web Assembly
id: wasm_pack
run: |
set -x
wasm-pack build --release -t web --scope fs
working-directory: ${{env.working-directory}}
shell: bash

- name: Compress for Linux
run: |
asset_name="pewpew-$VERSION-hdr-histogram-wasm.tar.xz"
echo "ASSET_NAME=$asset_name" >> $GITHUB_ENV
XZ_OPT=-9 tar -C ./ -cJf $asset_name package.json config*
working-directory: ${{env.working-directory}}/pkg/

- name: Upload release asset
uses: actions/[email protected]
env:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update-guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ jobs:

- name: Build Results Viewer and Book
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.6/mdbook-v0.4.6-x86_64-unknown-linux-gnu.tar.gz \
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.12/mdbook-v0.4.12-x86_64-unknown-linux-gnu.tar.gz \
| tar -xz -C ~/bin
curl -sSL https://github.com/rustwasm/wasm-pack/releases/download/v0.8.1/wasm-pack-v0.8.1-x86_64-unknown-linux-musl.tar.gz \
curl -sSL https://github.com/rustwasm/wasm-pack/releases/download/v0.10.0/wasm-pack-v0.10.0-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
Expand All @@ -42,10 +43,9 @@ jobs:
# build the hdr-histogram-wasm for the results viewer
cd $WASM_LIB_DIR
wasm-pack build --release -t web -d $WASM_OUTPUT_DIR
wasm-pack build --release -t web -d $WASM_OUTPUT_DIR --scope fs
cd $WASM_OUTPUT_DIR
sed 's/input = import\.meta\.url.*/import(".\/hdr_histogram_wasm_bg.wasm");\ninput = require.resolve(".\/hdr_histogram_wasm_bg.wasm")[0][0];/' hdr_histogram_wasm.js > hdr_histogram_wasm2.js
mv hdr_histogram_wasm2.js hdr_histogram_wasm.js
sed -i 's/input = .*import\.meta\.url.*/import(".\/hdr_histogram_wasm_bg.wasm");\ninput = require.resolve(".\/hdr_histogram_wasm_bg.wasm")[0][0];/' hdr_histogram_wasm.js
# build the results viewer (which includes putting the output into the book's src)
cd $RESULTS_VIEWER_DIR
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
/*.txt
/*.dump
/*.log
/*.json
/*.json
node_modules
Loading

0 comments on commit d87c7e0

Please sign in to comment.