1+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+ name : Node.js CI
5+
6+ on :
7+ push :
8+ branches : [main, 1.x]
9+ pull_request :
10+ workflow_dispatch :
11+
12+ jobs :
13+ build-and-lint :
14+ runs-on : ubuntu-latest
15+ timeout-minutes : 10
16+
17+ strategy :
18+ matrix :
19+ node-version : [18.x, 20.x]
20+
21+ steps :
22+ - uses : actions/checkout@v3
23+ - name : Use Node.js ${{ matrix.node-version }}
24+ uses : actions/setup-node@v3
25+ with :
26+ node-version : ${{ matrix.node-version }}
27+
28+ - name : ' Setup jq'
29+ 30+ with :
31+ version : ' ${{ inputs.version }}'
32+ force : ' ${{ inputs.force }}'
33+ - name : ' Check jq'
34+ run : |
35+ which jq
36+ jq --version
37+
38+ - name : Setup npm version 7
39+ run : |
40+ npm i -g npm@7 --registry=https://registry.npmjs.org
41+
42+ - name : Cache node modules
43+ id : cache-nodemodules
44+ uses : actions/cache@v3
45+ env :
46+ cache-name : cache-node-modules
47+ with :
48+ # caching node_modules
49+ path : |
50+ node_modules
51+ */*/node_modules
52+ key : ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
53+ restore-keys : |
54+ ${{ runner.os }}-deps-${{ matrix.node-version }}-
55+ ${{ runner.os }}-deps-
56+
57+ - name : Install Dependencies
58+ if : steps.cache-nodemodules.outputs.cache-hit != 'true'
59+ run : yarn install
60+
61+ - run : yarn run lint
62+
63+ integration-c :
64+ runs-on : ubuntu-latest
65+ timeout-minutes : 10
66+
67+ strategy :
68+ matrix :
69+ node-version : [18.x, 20.x]
70+
71+ steps :
72+ - uses : actions/checkout@v3
73+ - name : Use Node.js ${{ matrix.node-version }}
74+ uses : actions/setup-node@v3
75+ with :
76+ node-version : ${{ matrix.node-version }}
77+
78+ - name : Run docker in background
79+ run : |
80+ 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
81+
82+ - name : Setup npm version 7
83+ run : |
84+ npm i -g npm@7 --registry=https://registry.npmjs.org
85+
86+ - name : Cache node modules
87+ id : cache-nodemodules
88+ uses : actions/cache@v3
89+ env :
90+ cache-name : cache-node-modules
91+ with :
92+ # caching node_modules
93+ path : |
94+ node_modules
95+ */*/node_modules
96+ key : ${{ runner.os }}-deps-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
97+ restore-keys : |
98+ ${{ runner.os }}-deps-${{ matrix.node-version }}-
99+ ${{ runner.os }}-deps-
100+
101+ - name : Install Dependencies
102+ if : steps.cache-nodemodules.outputs.cache-hit != 'true'
103+ run : yarn install
104+
105+ - run : npm i -g @xahau/hooks-cli
106+ - run : yarn run build
107+ - run : hooks-cli compile-c contracts-c/toolbox build
108+ - run : hooks-cli compile-c contracts-c/txns build
109+ - run : yarn run test:integration-c
110+ env :
111+ HOOKS_COMPILE_HOST : https://hook-buildbox.xrpl.org
112+ XAHAU_ENV : standalone
113+
114+ - name : Stop docker container
115+ if : always()
116+ run : docker stop rippled-service
0 commit comments