Skip to content

WIP: windows wasm build issues #356

WIP: windows wasm build issues

WIP: windows wasm build issues #356

Workflow file for this run

name: verify
on:
pull_request:
env:
PKG_NAME: didcomm
PKG_NAME_JS_TMP: didcomm-js
PKG_NAME_NODEJS: didcomm-node
jobs:
release-ready:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'stable'
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Get current version
id: current_version
run: |
version="$(cargo -q metadata --no-deps \
| jq -r '.packages[] | select(.name == "${{ env.PKG_NAME }}") | .version')"
echo "$version"
echo "current_version=$version" >> $GITHUB_OUTPUT
cd wasm
version="$(cargo -q metadata --no-deps \
| jq -r '.packages[] | select(.name == "${{ env.PKG_NAME_JS_TMP }}") | .version')"
echo "$version"
echo "current_wasm_version=$version" >> $GITHUB_OUTPUT
- name: Check version format
run: |
# verify the version has "MAJOR.MINOR.PATCH" parts only
echo "${{ steps.current_version.outputs.current_version }}" | grep -e '^[0-9]\+\.[0-9]\+\.[0-9]\+$'
# TODO improve (DRY): copy-paste from release.yml
- name: Get release info
id: release_info
run: |
release_info="$(curl -s https://api.github.com/repos/${{ github.repository }}/releases \
| jq '.[] | select(.name == "v${{ steps.current_version.outputs.current_version }}")')"
echo "release_info=$release_info" >> $GITHUB_OUTPUT
echo "$release_info"
- name: check version bumped
# TODO check if greater than latest tag / release (?)
if: steps.release_info.outputs.release_info
run: exit 1
- name: check rust and wasm versions are the same
if: steps.current_version.outputs.current_version != steps.current_version.outputs.current_wasm_version
run: exit 1
- name: check it can be packaged (crate)
run: |
cargo package
# TODO verify that it's not more than crates.io limit (10 MB)
ls -la target/package
cargo package --list
- name: check it can be packaged (npm)
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# verify bundler target
make -C wasm build install
# verify nodejs target
WASM_TARGET=nodejs PKG_NAME=${{ env.PKG_NAME_NODEJS }} make -C wasm build install
verify:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set rustup profile & toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
- name: Get timestamp for cache
id: date
run: echo "yearmo=$(date +%Y%m)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{steps.date.outputs.yearmo}}
- name: Cargo fmt
# TODO enable that once https://github.com/rust-lang/rustfmt/issues/4477
# is resolved
if: runner.os != 'Windows'
run: cargo fmt --all -- --check
- name: Debug build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
verify-wasm:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
node: [ 14, 16 ]
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: wasm
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set rustup profile & toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
- name: Get timestamp for cache
id: date
run: echo "yearmo=$(date +%Y%m)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{steps.date.outputs.yearmo}}
- name: Cargo fmt
# TODO enable that once https://github.com/rust-lang/rustfmt/issues/4477
# is resolved
if: runner.os != 'Windows'
run: cargo fmt --all -- --check
- name: Cargo checks
run: cargo check --all-targets
# TODO caching, makes sense for demo and tests-js where lock files are presented
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install wasm-pack
if: runner.os != 'Windows'
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install wasm-pack Windows
if: runner.os == 'Windows'
run: npm install -g wasm-pack@0.12.1
- name: Build pkg (bundler)
run: make
- name: Install tests-js (bundler)
run: cd tests-js && npm install
- name: Lint tests-js
run: cd tests-js && npm run check
- name: Test tests-js (bundler)
if: false # TODO that check is not supported yet for bundler build
run: cd tests-js && npm test
- name: Test tests-js in browser (bundler)
if: false # TODO that check is not supported yet for bundler build
run: cd tests-js && npm run test-puppeteer
- name: Install demo (bundler)
run: cd demo && npm install
- name: Lint demo
run: cd demo && npm run check
- name: Test demo (bundler)
if: false # TODO that check is not supported yet for bundler build
run: cd demo && npm run start
- name: Build pkg (nodejs)
run: WASM_TARGET=nodejs make
- name: Install tests-js (nodejs)
run: cd tests-js && rm -rf node_modules && npm install
- name: Test tests-js (nodejs)
run: cd tests-js && npm test
- name: Test tests-js in browser (nodejs)
run: cd tests-js && npm run test-puppeteer
- name: Install demo (nodejs)
run: cd demo && rm -rf node_modules && npm install
- name: Test demo (nodejs)
run: cd demo && npm run start
verify-uniffi:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: uniffi
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set rustup profile & toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
- name: Get timestamp for cache
id: date
run: echo "yearmo=$(date +%Y%m)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{steps.date.outputs.yearmo}}
- name: Cargo fmt
# TODO enable that once https://github.com/rust-lang/rustfmt/issues/4477
# is resolved
if: runner.os != 'Windows'
run: cargo fmt --all -- --check
- name: Debug build
run: cargo build --verbose
- name: Test
run: cargo test --verbose