Jshooks #183
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Node.js CI | |
on: | |
push: | |
branches: [main, 1.x] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-and-lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
node-version: [16.x, 20.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: 'Setup jq' | |
uses: dcarbone/[email protected] | |
with: | |
version: '${{ inputs.version }}' | |
force: '${{ inputs.force }}' | |
- name: 'Check jq' | |
run: | | |
which jq | |
jq --version | |
- name: Setup npm version 7 | |
run: | | |
npm i -g npm@7 --registry=https://registry.npmjs.org | |
- name: Cache node modules | |
id: cache-nodemodules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# caching node_modules | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-deps-${{ matrix.node-version }}- | |
${{ runner.os }}-deps- | |
- name: Install Dependencies | |
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
run: yarn install | |
- run: yarn run lint | |
unit: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
node-version: [16.x, 20.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Setup npm version 7 | |
run: | | |
npm i -g npm@7 --registry=https://registry.npmjs.org | |
- name: Cache node modules | |
id: cache-nodemodules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# caching node_modules | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-deps-${{ matrix.node-version }}- | |
${{ runner.os }}-deps- | |
- name: Install Dependencies | |
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
run: yarn install | |
- run: yarn run test:unit | |
integration: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
node-version: [16.x, 20.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Run docker in background | |
run: | | |
docker run --detach --rm --name rippled-service -p 6006:6006 --health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s transia/xahaudjs:latest | |
- name: Setup npm version 7 | |
run: | | |
npm i -g npm@7 --registry=https://registry.npmjs.org | |
- name: Cache node modules | |
id: cache-nodemodules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# caching node_modules | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-deps-${{ matrix.node-version }}- | |
${{ runner.os }}-deps- | |
- name: Install Dependencies | |
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
run: yarn install | |
- run: npm i -g @transia/hooks-toolkit-cli | |
- run: yarn run build | |
- run: hooks-toolkit-cli compile-c contracts-c build | |
- run: hooks-toolkit-cli compile-js contracts-js/toolbox/base.ts build | |
- run: hooks-toolkit-cli compile-js contracts-js/toolbox/hookOnTT.ts build | |
- run: yarn run test:integration | |
env: | |
HOOKS_COMPILE_HOST: https://hook-buildbox.xrpl.org | |
XRPLD_ENV: standalone | |
- name: Stop docker container | |
if: always() | |
run: docker stop rippled-service |