Skip to content

Commit

Permalink
Debugging CI
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya committed Jul 20, 2023
1 parent 834793a commit 76d38ef
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 49 deletions.
66 changes: 34 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,35 +178,37 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "wasm32-unknown-unknown"

- name: Installing required crates
run: cargo install wasm-bindgen-cli wasm-opt

- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8.6.9

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18.14.1
node-version-file: ".npm/package.json"
cache-dependency-path: ".npm/pnpm-lock.yaml"

- name: Build and Test packages
run: |
pnpm -C .npm install
pnpm -C .npm all
- name: Publish
run: |
npm whoami
pnpm -C .npm publish -r --tag --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Debugging
run: .npm/.scripts/assemble-package.sh
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ env.RUST_VERSION }}
# targets: "wasm32-unknown-unknown"

# - name: Installing required crates
# run: cargo install wasm-bindgen-cli wasm-opt

# - name: Setup PNPM
# uses: pnpm/action-setup@v2
# with:
# version: 8.6.9

# - name: Setup Node
# uses: actions/setup-node@v3
# with:
# cache: "pnpm"
# node-version: 18.14.1
# node-version-file: ".npm/package.json"
# cache-dependency-path: ".npm/pnpm-lock.yaml"

# - name: Build and Test packages
# run: |
# pnpm -C .npm install
# pnpm -C .npm all

# - name: Publish
# run: |
# npm whoami
# pnpm -C .npm publish -r --tag --dry-run
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37 changes: 20 additions & 17 deletions .npm/.scripts/assemble-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,31 @@ build_wasm_npm_pkg_for ()
NAME_DASHED=$1
NAME_UNDERSCORED=$(echo "${NAME_DASHED}" | sed -r 's/-/_/g')

PKG_DIR=${PKGS_DIR}/${NAME_DASHED}
echo "NAME_DASHED=${NAME_DASHED}"
echo "NAME_UNDERSCORED=${NAME_UNDERSCORED}"

# PKG_DIR=${PKGS_DIR}/${NAME_DASHED}

rm -rf ${PKG_DIR}/{src,dist}
# rm -rf ${PKG_DIR}/{src,dist}

cd ${ROOT_DIR}
cargo rustc -p ${NAME_DASHED} --target wasm32-unknown-unknown --features typescript --crate-type=cdylib --release
wasm-bindgen --target web ./target/wasm32-unknown-unknown/release/${NAME_UNDERSCORED}.wasm --out-dir ${PKG_DIR}/src
wasm-opt ${PKG_DIR}/src/${NAME_UNDERSCORED}_bg.wasm -o ${PKG_DIR}/src/${NAME_UNDERSCORED}_bg.wasm -Oz
cd ~-
# cd ${ROOT_DIR}
# cargo rustc -p ${NAME_DASHED} --target wasm32-unknown-unknown --features typescript --crate-type=cdylib --release
# wasm-bindgen --target web ./target/wasm32-unknown-unknown/release/${NAME_UNDERSCORED}.wasm --out-dir ${PKG_DIR}/src
# wasm-opt ${PKG_DIR}/src/${NAME_UNDERSCORED}_bg.wasm -o ${PKG_DIR}/src/${NAME_UNDERSCORED}_bg.wasm -Oz
# cd ~-

write_template ${NAME_DASHED} ${NAME_UNDERSCORED} README.md
write_template ${NAME_DASHED} ${NAME_UNDERSCORED} package.json
# write_template ${NAME_DASHED} ${NAME_UNDERSCORED} pnpm-lock.yaml
write_template ${NAME_DASHED} ${NAME_UNDERSCORED} rollup.config.mjs
write_template ${NAME_DASHED} ${NAME_UNDERSCORED} src/index.js
# write_template ${NAME_DASHED} ${NAME_UNDERSCORED} README.md
# write_template ${NAME_DASHED} ${NAME_UNDERSCORED} package.json
# # write_template ${NAME_DASHED} ${NAME_UNDERSCORED} pnpm-lock.yaml
# write_template ${NAME_DASHED} ${NAME_UNDERSCORED} rollup.config.mjs
# write_template ${NAME_DASHED} ${NAME_UNDERSCORED} src/index.js

# commenting out all `new URL()` and `fetch()` calls for great compatibility with JS bundlers
sed -i.bkp -r 's;(input = new URL.+);//\1;g' ${PKG_DIR}/src/${NAME_UNDERSCORED}.js
sed -i.bkp -r 's;(input = fetch.+);//\1;g' ${PKG_DIR}/src/${NAME_UNDERSCORED}.js
rm ${PKG_DIR}/src/${NAME_UNDERSCORED}.js.bkp
# # commenting out all `new URL()` and `fetch()` calls for great compatibility with JS bundlers
# sed -i.bkp -r 's;(input = new URL.+);//\1;g' ${PKG_DIR}/src/${NAME_UNDERSCORED}.js
# sed -i.bkp -r 's;(input = fetch.+);//\1;g' ${PKG_DIR}/src/${NAME_UNDERSCORED}.js
# rm ${PKG_DIR}/src/${NAME_UNDERSCORED}.js.bkp
}


build_wasm_npm_pkg_for "fuel-asm"
build_wasm_npm_pkg_for "fuel-types"
# build_wasm_npm_pkg_for "fuel-types"

0 comments on commit 76d38ef

Please sign in to comment.