try env #372
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-wasm: | ||
strategy: | ||
matrix: | ||
os: [ windows-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: List npm version | ||
run: npm --version | ||
- name: Find node | ||
if: runner.os == 'Windows' | ||
run: | | ||
echo %VCINSTALLDIR% | ||
set VCINSTALLDIR="C:\Program Files\Microsoft Visual Studio\2022\Community\VC" | ||
echo %VCINSTALLDIR% | ||
where node | ||
echo ====== | ||
ls "C:\Program Files" | ||
echo ====== | ||
ls "C:\Program Files\Microsoft Visual Studio" | ||
echo ====== | ||
ls "C:\Program Files\Microsoft Visual Studio\2022" | ||
echo ====== | ||
ls "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" | ||
echo ====== | ||
ls "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC" | ||
echo ====== | ||
ls "C:\Program Files\Microsoft Visual Studio 14.0" | ||
- name: Upgrade gyp | ||
if: runner.os == 'Windows' | ||
run: cd "C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script" && npm install node-gyp@latest && cd - | ||
# - name: Install Windows Build tools | ||
# if: runner.os == 'Windows' | ||
# run: npm config set msvs_version 2017 && npm install --global --production windows-build-tools@4.0.0 | ||
- 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) | ||
env: | ||
VCINSTALLDIR: "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC" | ||
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 | ||