Skip to content

Commit 51a88d1

Browse files
authored
Update dependencies (#62)
* 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
1 parent 3f9d50a commit 51a88d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4566
-6288
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ FROM rust:1.52
44
# https://github.com/EmbarkStudios/cargo-deny/releases
55
ARG CARGO_DENY_VER=0.9.1
66
# https://github.com/rust-lang/mdBook/releases
7-
ARG MDBOOK_VER=v0.4.7
7+
ARG MDBOOK_VER=v0.4.12
88
# https://github.com/rustwasm/wasm-pack/releases
9-
ARG WASM_PACK_VER=v0.8.1
9+
ARG WASM_PACK_VER=v0.10.0
1010
# https://nodejs.org/
1111
ARG NODE_MAJOR_VER=12
1212

.github/workflows/pr-js.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
on:
2+
pull_request:
3+
paths:
4+
- '**.js'
5+
- '**.ts'
6+
- '**.html'
7+
- '**/package.json'
8+
- '**/package-lock.json'
9+
10+
name: Pull Request Javascript
11+
jobs:
12+
create-release:
13+
name: Build guide
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Add Rust toolchain
18+
uses: actions-rs/toolchain@v1
19+
with:
20+
profile: minimal
21+
target: wasm32-unknown-unknown
22+
toolchain: stable
23+
override: true
24+
- name: Add Node.js toolchain
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: 12.x
28+
29+
- name: Build Results Viewer and Book
30+
run: |
31+
set -x
32+
# install mdbook and wasm-pack
33+
mkdir ~/bin
34+
PATH=$PATH:~/bin
35+
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.12/mdbook-v0.4.12-x86_64-unknown-linux-gnu.tar.gz \
36+
| tar -xz -C ~/bin
37+
38+
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 \
39+
| tar -xz --strip-components=1 -C ~/bin --no-anchored wasm-pack
40+
41+
# setup some envs to various paths for convenience
42+
PROJECT_ROOT=$PWD
43+
GUIDE_DIR=$(realpath $PROJECT_ROOT/guide)
44+
RESULTS_VIEWER_DIR=$(realpath $GUIDE_DIR/results-viewer)
45+
WASM_LIB_DIR=$(realpath $PROJECT_ROOT/lib/hdr-histogram-wasm)
46+
WASM_OUTPUT_DIR=$RESULTS_VIEWER_DIR/lib/hdr-histogram-wasm
47+
48+
# build the hdr-histogram-wasm for the results viewer
49+
cd $WASM_LIB_DIR
50+
wasm-pack build --release -t web -d $WASM_OUTPUT_DIR
51+
cd $WASM_OUTPUT_DIR
52+
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
53+
54+
# build the results viewer (which includes putting the output into the book's src)
55+
cd $RESULTS_VIEWER_DIR
56+
npm ci
57+
npm run build
58+
59+
# build the book
60+
cd $GUIDE_DIR
61+
mdbook build

.github/workflows/pr.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,13 @@ jobs:
7878

7979
wasm-pack:
8080
name: Wasm Build
81+
strategy:
82+
matrix:
83+
wasm-dirctory: [config-wasm, hdr-histogram-wasm]
8184
runs-on: ubuntu-latest
8285
env:
83-
working-directory: ./lib/config_wasm
84-
test-directory: ./lib/config_wasm/tests
86+
wasm-directory: ./lib/${{ matrix.wasm-dirctory }}
87+
test-directory: ./lib/${{ matrix.wasm-dirctory }}/tests
8588
steps:
8689
- uses: actions/checkout@v2
8790
- uses: actions-rs/toolchain@v1
@@ -92,14 +95,14 @@ jobs:
9295
- uses: actions-rs/cargo@v1
9396
with:
9497
command: install
95-
args: --version 0.8.1 wasm-pack
98+
args: --version 0.10.0 wasm-pack
9699

97100
- name: Create the Web Assembly
98101
id: wasm_pack
99102
run: |
100103
set -x
101-
wasm-pack build --release -t nodejs
102-
working-directory: ${{env.working-directory}}
104+
wasm-pack build --release -t nodejs --scope fs
105+
working-directory: ${{env.wasm-directory}}
103106
shell: bash
104107

105108
- name: Use Node.js 12.x

.github/workflows/release.yml

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ jobs:
139139
asset_content_type: application/octet-stream
140140

141141

142-
wasm-release:
143-
name: Wasm Pack and Upload
142+
wasm-release-config:
143+
name: Wasm Pack and Upload Config Parser
144144
needs: ['create-release']
145145
runs-on: ubuntu-latest
146146
env:
147-
working-directory: ./lib/config_wasm
147+
working-directory: ./lib/config-wasm
148148
steps:
149149
- uses: actions/checkout@v2
150150
- name: Download artifacts
@@ -181,12 +181,12 @@ jobs:
181181
- uses: actions-rs/cargo@v1
182182
with:
183183
command: install
184-
args: --version 0.8.1 wasm-pack
184+
args: --version 0.10.0 wasm-pack
185185
- name: Create the Web Assembly
186186
id: wasm_pack
187187
run: |
188188
set -x
189-
wasm-pack build --release -t nodejs
189+
wasm-pack build --release -t nodejs --scope fs
190190
working-directory: ${{env.working-directory}}
191191
shell: bash
192192

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

200+
- name: Upload release asset
201+
uses: actions/[email protected]
202+
env:
203+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
204+
with:
205+
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
206+
asset_path: ${{env.working-directory}}/pkg/${{ env.ASSET_NAME }}
207+
asset_name: ${{ env.ASSET_NAME }}
208+
asset_content_type: application/octet-stream
209+
210+
211+
# The hdr-histogram-wasm needs to be build with web rather than nodejs
212+
wasm-release-histogram:
213+
name: Wasm Pack and Upload Histogram
214+
needs: ['create-release']
215+
runs-on: ubuntu-latest
216+
env:
217+
working-directory: ./lib/hdr-histogram-wasm
218+
steps:
219+
- uses: actions/checkout@v2
220+
- name: Download artifacts
221+
uses: actions/download-artifact@v2
222+
with:
223+
name: artifacts
224+
path: artifacts
225+
226+
- name: Get upload data
227+
id: upload_data
228+
shell: bash
229+
run: |
230+
release_upload_url="$(cat artifacts/release-upload-url)"
231+
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
232+
release_version="$(cat artifacts/release-version)"
233+
echo "VERSION=$release_version" >> $GITHUB_ENV
234+
235+
- name: Set Cargo.toml version
236+
id: set_cargo_version
237+
shell: bash
238+
run: |
239+
# remove the leading "v" for subsequent usage
240+
version=${VERSION/v/}
241+
# replace the version value in Cargo.toml with the tag version (so we don't need to create extraneous commits for every preview version)
242+
cp Cargo.toml Cargo2.toml
243+
sed "0,/version = \".*\"/s//version = \"$version\"/" Cargo2.toml > Cargo.toml
244+
working-directory: ${{env.working-directory}}
245+
246+
- uses: actions-rs/toolchain@v1
247+
with:
248+
profile: minimal
249+
toolchain: stable
250+
override: true
251+
- uses: actions-rs/cargo@v1
252+
with:
253+
command: install
254+
args: --version 0.10.0 wasm-pack
255+
- name: Create the Web Assembly
256+
id: wasm_pack
257+
run: |
258+
set -x
259+
wasm-pack build --release -t web --scope fs
260+
working-directory: ${{env.working-directory}}
261+
shell: bash
262+
263+
- name: Compress for Linux
264+
run: |
265+
asset_name="pewpew-$VERSION-hdr-histogram-wasm.tar.xz"
266+
echo "ASSET_NAME=$asset_name" >> $GITHUB_ENV
267+
XZ_OPT=-9 tar -C ./ -cJf $asset_name package.json config*
268+
working-directory: ${{env.working-directory}}/pkg/
269+
200270
- name: Upload release asset
201271
uses: actions/[email protected]
202272
env:

.github/workflows/update-guide.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ jobs:
2424

2525
- name: Build Results Viewer and Book
2626
run: |
27+
set -x
2728
# install mdbook and wasm-pack
2829
mkdir ~/bin
2930
PATH=$PATH:~/bin
30-
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.6/mdbook-v0.4.6-x86_64-unknown-linux-gnu.tar.gz \
31+
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.12/mdbook-v0.4.12-x86_64-unknown-linux-gnu.tar.gz \
3132
| tar -xz -C ~/bin
3233
33-
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 \
34+
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 \
3435
| tar -xz --strip-components=1 -C ~/bin --no-anchored wasm-pack
3536
3637
# setup some envs to various paths for convenience
@@ -42,10 +43,9 @@ jobs:
4243
4344
# build the hdr-histogram-wasm for the results viewer
4445
cd $WASM_LIB_DIR
45-
wasm-pack build --release -t web -d $WASM_OUTPUT_DIR
46+
wasm-pack build --release -t web -d $WASM_OUTPUT_DIR --scope fs
4647
cd $WASM_OUTPUT_DIR
47-
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
48-
mv hdr_histogram_wasm2.js hdr_histogram_wasm.js
48+
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
4949
5050
# build the results viewer (which includes putting the output into the book's src)
5151
cd $RESULTS_VIEWER_DIR

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/*.txt
77
/*.dump
88
/*.log
9-
/*.json
9+
/*.json
10+
node_modules

0 commit comments

Comments
 (0)