rillrate-js 0.19.0

rillrate binding for node.js
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
name: CI

env:
  DEBUG: 'napi:*'
  APP_NAME: 'rillrate'

on:
  push:
  release:
    types: [created]

jobs:
  build:
    if: "!contains(github.event.head_commit.message, 'skip ci')"

    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    name: stable - ${{ matrix.os }} - node@14
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: 14
          check-latest: true

      - name: Install
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Generate Cargo.lock
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: stable-${{ matrix.os }}-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo index
        uses: actions/cache@v1
        with:
          path: ~/.cargo/git
          key: stable-${{ matrix.os }}-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-${{ matrix.os }}-node@14-${{ hashFiles('yarn.lock') }}

      - name: 'Install dependencies'
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: 'Build'
        if: matrix.os != 'macos-latest'
        run: yarn build

      - name: 'Build'
        if: matrix.os == 'macos-latest'
        run: yarn build
        env:
          MACOSX_DEPLOYMENT_TARGET: '10.13'

      - name: Upload artifact
        uses: actions/upload-artifact@v2
        with:
          name: bindings-${{ matrix.os }}
          path: ${{ env.APP_NAME }}.*.node

      - name: Clear the cargo caches
        run: |
          cargo install cargo-cache --no-default-features --features ci-autoclean
          cargo-cache

  build-linux-musl:
    if: "!contains(github.event.head_commit.message, 'skip ci')"
    name: stable - linux-musl - node@10
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Login to registry
        run: |
          docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
        env:
          DOCKER_REGISTRY_URL: docker.pkg.github.com
          DOCKER_USERNAME: ${{ github.actor }}
          DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

      - name: Pull docker image
        run: |
          docker pull docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts
          docker tag docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts builder

      - name: Generate Cargo.lock
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: stable-node-alpine-@10-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo index
        uses: actions/cache@v1
        with:
          path: ~/.cargo/git
          key: stable-node-alpine-@10-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-alpine-node@10-${{ hashFiles('yarn.lock') }}

      - name: 'Install dependencies'
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: 'Build'
        run: |
          docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/${{ env.APP_NAME }} -e DEBUG="napi:*" -w /${{ env.APP_NAME }} builder sh -c "yarn build"

      - name: Upload artifact
        uses: actions/upload-artifact@v2
        with:
          name: bindings-linux-musl
          path: ${{ env.APP_NAME }}.*.node

  build-linux-arm7:
    name: stable - arm7-unknown-linux-gnu - node@14
    runs-on: ubuntu-latest

    steps:
      - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset

      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v1
        with:
          node-version: 14

      - name: Install
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Generate Cargo.lock
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: stable-linux-arm7-gnu-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo index
        uses: actions/cache@v1
        with:
          path: ~/.cargo/git
          key: stable-linux-arm7-gnu-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-linux-arm7-gnu-node@14-${{ hashFiles('yarn.lock') }}

      - name: Install aarch64 toolchain
        run: rustup target add armv7-unknown-linux-gnueabihf

      - name: Install cross compile toolchain
        run: |
          sudo apt-get update
          sudo apt-get install gcc-arm-linux-gnueabihf -y

      - name: Install dependencies
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: Cross build arm7
        run: yarn build --target armv7-unknown-linux-gnueabihf

      - name: Upload artifact
        uses: actions/upload-artifact@v2
        with:
          name: bindings-linux-arm7
          path: ${{ env.APP_NAME }}.*.node

  build-linux-aarch64:
    name: stable - aarch64-unknown-linux-gnu - node@14
    runs-on: ubuntu-latest

    steps:
      - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset

      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: 14
          check-latest: true

      - name: Install
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Install aarch64 toolchain
        run: rustup target add aarch64-unknown-linux-gnu

      - name: Generate Cargo.lock
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: stable-linux-aarch64-gnu-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo index
        uses: actions/cache@v1
        with:
          path: ~/.cargo/git
          key: stable-linux-aarch64-gnu-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-linux-aarch64-gnu-node@14-${{ hashFiles('yarn.lock') }}

      - name: Install cross compile toolchain
        run: |
          sudo apt-get update
          sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y

      - name: Install dependencies
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: Cross build aarch64
        run: yarn build --target aarch64-unknown-linux-gnu

      - name: Upload artifact
        uses: actions/upload-artifact@v2
        with:
          name: bindings-linux-aarch64
          path: ${{ env.APP_NAME }}.*.node

  build-apple-silicon:
    name: nightly - aarch64-apple-darwin - node@14
    if: false
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: 14
          check-latest: true

      - name: Install
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          profile: minimal
          override: true

      - name: Install aarch64 toolchain
        run: rustup target add aarch64-apple-darwin

      - name: Generate Cargo.lock
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: nightly-apple-aarch64-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo index
        uses: actions/cache@v1
        with:
          path: ~/.cargo/git
          key: nightly-apple-aarch64-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-apple-aarch64-node@14-${{ hashFiles('yarn.lock') }}

      - name: Install dependencies
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: Cross build aarch64
        run: yarn build --target aarch64-apple-darwin

      - name: Upload artifact
        uses: actions/upload-artifact@v2
        with:
          name: bindings-apple-aarch64
          path: ${{ env.APP_NAME }}.*.node

  build-android-aarch64:
    name: Build - Android - aarch64
    if: false
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v1
        with:
          node-version: 14

      - name: Install aarch64 toolchain
        run: rustup target add aarch64-linux-android

      - name: Generate Cargo.lock
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Cache cargo registry
        uses: actions/cache@v1
        with:
          path: ~/.cargo/registry
          key: nightly-apple-aarch64-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo index
        uses: actions/cache@v1
        with:
          path: ~/.cargo/git
          key: nightly-apple-aarch64-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-apple-aarch64-node@14-${{ hashFiles('yarn.lock') }}

      - name: Install dependencies
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: Build
        shell: bash
        run: |
          export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang"
          yarn build --target aarch64-linux-android

      - name: Upload artifact
        uses: actions/upload-artifact@v2
        with:
          name: bindings-android-aarch64
          path: ${{ env.APP_NAME }}.*.node

  test:
    name: Test bindings on ${{ matrix.os }} - node@${{ matrix.node }}
    needs:
      - build
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node: ['10', '12', '14', '15']
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: ${{ matrix.node }}
          check-latest: true

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-test-${{ matrix.os }}-node@${{ matrix.node }}-${{ hashFiles('yarn.lock') }}

      - name: 'Install dependencies'
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: Download artifacts
        uses: actions/download-artifact@v2
        with:
          name: bindings-${{ matrix.os }}
          path: .

      - name: List packages
        run: ls -R .
        shell: bash

      - name: Test bindings
        run: yarn test

  test-musl:
    name: Test bindings on alpine - node@${{ matrix.node }}
    if: false
    needs:
      - build-linux-musl
    strategy:
      fail-fast: false
      matrix:
        node: ['10', '12', '14', '15']
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-alpine-node@${{ matrix.node }}-${{ hashFiles('yarn.lock') }}

      - name: 'Install dependencies'
        run: yarn install --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org

      - name: Download artifacts
        uses: actions/download-artifact@v2
        with:
          name: bindings-linux-musl
          path: .

      - name: List files
        run: ls -R .
        shell: bash

      - name: Run tests
        run: docker run --rm -v $(pwd):/${{ env.APP_NAME }} -w /${{ env.APP_NAME }} node:${{ matrix.node }}-alpine sh -c "yarn test"

  test-aarch64:
    name: stable - aarch64-unknown-linux-gnu - node@${{ matrix.node }}
    runs-on: ubuntu-latest

    needs:
      - build-linux-aarch64
    strategy:
      fail-fast: false
      matrix:
        node: ['10', '12', '14', '15']

    steps:
      - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset

      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: ${{ matrix.node }}
          check-latest: true

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-test-linux-aarch64-gnu-node@${{ matrix.node }}-${{ hashFiles('yarn.lock') }}

      - name: 'Install dependencies'
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: Download artifacts
        uses: actions/download-artifact@v2
        with:
          name: bindings-linux-aarch64
          path: .

      - name: List
        run: ls -a

      - name: Run tests
        uses: docker://multiarch/ubuntu-core:arm64-focal
        with:
          args: >
            sh -c "
              apt-get update && \
              apt-get install -y ca-certificates gnupg2 curl && \
              curl -sL https://deb.nodesource.com/setup_${{ matrix.node }}.x | bash - && \
              apt-get install -y nodejs && \
              node ./simple-test.js
            "

  dependabot:
    needs:
      - test
      #- test-musl
      - test-aarch64
      #- build-apple-silicon
      - build-linux-arm7
      #- build-android-aarch64
    runs-on: ubuntu-latest
    steps:
      - name: auto-merge
        uses: ridedott/dependabot-auto-merge-action@master
        with:
          GITHUB_LOGIN: dependabot[bot]
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  publish:
    name: Publish
    if: github.event_name == 'release' && github.event.action == 'created'
    runs-on: ubuntu-latest
    needs:
      - test
      #- test-musl
      - test-aarch64
      #- build-apple-silicon
      - build-linux-arm7
      #- build-android-aarch64

    steps:
      - uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: 14
          check-latest: true

      - name: Cache NPM dependencies
        uses: actions/cache@v1
        with:
          path: node_modules
          key: npm-cache-publish-ubuntu-latest-${{ hashFiles('yarn.lock') }}

      - name: Install dependencies
        run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000

      - name: Download all artifacts
        uses: actions/download-artifact@v2
        with:
          path: artifacts

      - name: Move artifacts
        run: yarn artifacts

      - name: List packages
        run: ls -R npm
        shell: bash

      - name: Publish
        run: |
          echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
          npm publish --access public
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

      - name: Publish never
        if: false
        run: |
          if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
          then
            echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
            npm publish --access public
          elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
          then
            echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
            npm publish --tag next --access public
          else
            echo "Not a release, skipping publish"
          fi