Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build & deploy Wechaty docker image with arm64 multi platform support #2248

Closed
huan opened this issue Sep 8, 2021 · 10 comments
Closed

Build & deploy Wechaty docker image with arm64 multi platform support #2248

huan opened this issue Sep 8, 2021 · 10 comments

Comments

@huan
Copy link
Member

huan commented Sep 8, 2021

From wechaty/puppet-wechat#102 we can see the wechaty-puppet-wechat and wechaty-puppet-whatsapp can support Raspberry Pi.

From the below GitHub action script, we have already know how to build and publish multiple platform docker images:

https://github.com/huan/docker-simple-mail-forwarder/blob/c3b5b30be708b473ab850fdc36c3734be2d4a614/.github/workflows/docker.yml#L68-L73

Wechaty should support it in the future.

Related links

Update Nov 27, 2021

The buildx seems to work perfectly, and the arm arch will take almost 10X times than the x86_64 when we are building:

 => [linux/amd64  6/13] RUN  npm install   && rm -fr /tmp/* ~/.npm      185.1s
 => [linux/arm/v7  6/13] RUN  npm install   && rm -fr /tmp/* ~/.npm     1469.4s
 => [linux/arm64  6/13] RUN  npm install   && rm -fr /tmp/* ~/.npm      1473.2s
@Yc-Chen
Copy link
Contributor

Yc-Chen commented Nov 6, 2021

I tried using https://github.com/wechaty/wechaty/blob/main/Dockerfile to build image on raspberrypi 64bit but got error with installing 'google-chrome-unstable'. In case it helps, im happy to test

@huan
Copy link
Member Author

huan commented Nov 6, 2021

@Yc-Chen Thanks for trying that, I'd like to accept a PR for adding this support!

CC @sososoyoung to see if you can get any help or useful information.

@huan
Copy link
Member Author

huan commented Nov 11, 2021

@Yc-Chen we can use chromium-browser instead.

See:

@Yc-Chen
Copy link
Contributor

Yc-Chen commented Nov 12, 2021

With installing chromium (not chromium-browser, https://stackoverflow.com/a/65586840) I got to the testing step, but then the tests failed. Is it something related to the operating system? The full log is:

$ docker build .
Sending build context to Docker daemon  11.36MB
Step 1/23 : FROM debian:bullseye
 ---> bf33d9a9dfb7
Step 2/23 : LABEL maintainer="Huan LI (李卓桓) <zixia@zixia.net>"
 ---> Using cache
 ---> f8d7f8265ce7
Step 3/23 : ENV DEBIAN_FRONTEND     noninteractive
 ---> Using cache
 ---> 30e1a1852e3e
Step 4/23 : ENV WECHATY_DOCKER      1
 ---> Using cache
 ---> d4578b49e99c
Step 5/23 : ENV LC_ALL              C.UTF-8
 ---> Using cache
 ---> 3b8323a29bf1
Step 6/23 : ENV NODE_ENV            $NODE_ENV
 ---> Using cache
 ---> d853398af782
Step 7/23 : ENV NPM_CONFIG_LOGLEVEL warn
 ---> Using cache
 ---> fb41d8080005
Step 8/23 : RUN apt-get update   && apt-get install -y --no-install-recommends     apt-utils     autoconf     automake     bash     build-essential     ca-certificates     curl     coreutils     ffmpeg     figlet     git     gnupg2     jq     libgconf-2-4     libtool     moreutils     python-dev     shellcheck     sudo     tzdata     vim     wget     libxtst6   && apt-get purge --auto-remove   && rm -rf /tmp/* /var/lib/apt/lists/*
 ---> Using cache
 ---> 07efa95ffb63
Step 9/23 : RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -     && apt-get update && apt-get install -y --no-install-recommends nodejs     && apt-get purge --auto-remove     && rm -rf /tmp/* /var/lib/apt/lists/*
 ---> Using cache
 ---> ef580401a1f8
Step 10/23 : RUN  wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -   && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'   && apt-get update   && apt-get install -y --no-install-recommends     chromium   && apt-get purge --auto-remove   && rm -rf /tmp/* /var/lib/apt/lists/*   && rm -rf /usr/bin/chromium
 ---> Using cache
 ---> 6fae771fe88f
Step 11/23 : WORKDIR /wechaty
 ---> Using cache
 ---> e6937b0cde37
Step 12/23 : COPY package.json .
 ---> 68d8a12cf71a
Step 13/23 : RUN  npm install   && rm -fr /tmp/* ~/.npm
 ---> Running in 5acf9205c3c1
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/pinpoint@1.0.2: Moved to 'npm install @sideway/pinpoint'
npm WARN deprecated @hapi/formula@1.2.0: Moved to 'npm install @sideway/formula'
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @types/dotenv@8.2.0: This is a stub types definition. dotenv provides its own type definitions, so you do not need this installed.
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated @hapi/joi@16.1.8: Switch to 'npm install joi'

added 1274 packages, and audited 1445 packages in 7m

111 packages are looking for funding
  run `npm fund` for details

37 vulnerabilities (26 moderate, 11 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice 
npm notice New patch version of npm available! 8.1.0 -> 8.1.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.3>
npm notice Run `npm install -g npm@8.1.3` to update!
npm notice 
Removing intermediate container 5acf9205c3c1
 ---> 982d97a1bba9
Step 14/23 : COPY . .
 ---> f2546da341c6
Step 15/23 : RUN ./scripts/generate-package-json.sh && rm -f src/package-json.spec.ts
 ---> Running in ffc90ec894ac
Removing intermediate container ffc90ec894ac
 ---> b9d390aab6a2
Step 16/23 : RUN  npm test   && npm run dist   && npm link
 ---> Running in 4ad72ec6c83a

> wechaty@1.5.2 test
> npm run lint && nyc npm run test:unit && npm run sloc


> wechaty@1.5.2 lint
> npm-run-all check-node-version lint:es lint:ts lint:sh lint:md


> wechaty@1.5.2 check-node-version
> check-node-version --node ">= 16"


> wechaty@1.5.2 lint:es
> eslint --ignore-pattern node_modules/ --ignore-pattern fixtures/ "{bin,examples,src,scripts,tests}/**/*.ts"


> wechaty@1.5.2 lint:ts
> tsc --isolatedModules --noEmit


> wechaty@1.5.2 lint:sh
> bash -n bin/*.sh


> wechaty@1.5.2 lint:md
> markdownlint README.md


> wechaty@1.5.2 test:unit
> cross-env NODE_OPTIONS="--no-warnings --loader=ts-node/esm" TAP_TIMEOUT=60 tap "src/**/*.spec.ts" "tests/**/*.spec.ts"

TAP version 13
ok 1 - src/config.spec.ts # time=184.487ms {
    # Subtest: important variables
        ok 1 - should exist `apihost` in Config
        ok 2 - should exist `token` in Config
        ok 3 - should export DEFAULT_PROTOCOL
        ok 4 - should export DEFAULT_APIHOST
        1..4
    ok 1 - important variables # time=59.268ms
    
    # Subtest: validApiHost()
        ok 1 - expected to not throw
        ok 2 - expected to not throw
        ok 3 - expected to throw
        ok 4 - expected to throw
        1..4
    ok 2 - validApiHost() # time=30.594ms
    
    # Subtest: systemPuppetName ()
        ok 1 - should get wechaty-puppet-service as default puppet name
        ok 2 - should get puppet name from process.env
        1..2
    ok 3 - systemPuppetName () # time=8.038ms
    
    1..3
    # time=184.487ms
}

ok 2 - src/io-peer/io-peer.spec.ts # time=101.923ms {
    # Subtest: getPeer()
        ok 1 - should get the right port
        1..1
    ok 1 - getPeer() # time=62.57ms
    
    # Subtest: exec()
        ok 1 - should get the right port from payload
        1..1
    ok 2 - exec() # time=8.11ms
    
    1..2
    # time=101.923ms
}

ok 3 - src/io.spec.ts # time=1383.246ms {
    # Subtest: Io restart without problem
        ok 1 - start/stop-ed at #0
        ok 2 - start/stop-ed at #1
        ok 3 - start/restart successed.
        1..3
    ok 1 - Io restart without problem # time=1363.838ms
    
    1..1
    # time=1383.246ms
}

ok 4 - src/mods/impl.spec.ts # time=331.651ms {
    # Subtest: Export of the Framework
        ok 1 - should export Contact
        ok 2 - should export Friendship
        ok 3 - should export Message
        ok 4 - should export Room
        ok 5 - should export Wechaty
        1..5
    ok 1 - Export of the Framework # time=75.332ms
    
    1..1
    # time=331.651ms
}

not ok 5 - src/mods/mod.spec.ts # time=61094.221ms
  ---
  env: {}
  file: src/mods/mod.spec.ts
  timeout: 60000
  command: /usr/bin/node
  args:
    - src/mods/mod.spec.ts
  stdio:
    - 0
    - pipe
    - 2
  cwd: /wechaty
  ...
{
    
    not ok 1 - timeout!
      ---
      expired: src/mods/mod.spec.ts
      ...
    1..1
    # failed 1 test
}

not ok 6 - src/plugin.spec.ts # time=61011.46ms
  ---
  env: {}
  file: src/plugin.spec.ts
  timeout: 60000
  command: /usr/bin/node
  args:
    - src/plugin.spec.ts
  stdio:
    - 0
    - pipe
    - 2
  cwd: /wechaty
  ...
{
    
    not ok 1 - timeout!
      ---
      expired: src/plugin.spec.ts
      ...
    1..1
    # failed 1 test
}

ok 7 - src/puppet-management/puppet-manager.spec.ts # time=12261.335ms {
    # Subtest: resolve an unsupported puppet name
        ok 1 - reject when options.puppet is unknown
        ok 2 - should allow "wechaty-puppet-mock" as puppet name
        1..2
    ok 1 - resolve an unsupported puppet name # time=9842.436ms
    
    # Subtest: resolveName() for ESM
        ok 1 - should get the puppet class function
        ok 2 - should return a valid puppet name
        1..2
    ok 2 - resolveName() for ESM # time=14.654ms
    
    # Subtest: resolveName() for CJS
        ok 1 - should get the puppet class function
        ok 2 - should return a valid puppet name
        1..2
    ok 3 - resolveName() for CJS # time=2339.163ms
    
    1..3
    # time=12261.335ms
}

ok 8 - src/pure-functions/is-template-string-array.spec.ts # time=110.239ms {
    # Subtest: isTemplateStringArray
        ok 1 - should return true for template string
        ok 2 - should return true for template string with one var
        ok 3 - should return true for template string with one obj
        ok 4 - should return false for (string) call
        1..4
    ok 1 - isTemplateStringArray # time=68.561ms
    
    1..1
    # time=110.239ms
}

ok 9 - src/pure-functions/timestamp-to-date.spec.ts # time=64.147ms {
    # Subtest: timestampToDate() for dealing with seconds
        ok 1 - should parse seconds to right date
        1..1
    ok 1 - timestampToDate() for dealing with seconds # time=30.404ms
    
    # Subtest: timestampToDate() for dealing with milliseconds
        ok 1 - should parse milliseconds to right date
        1..1
    ok 2 - timestampToDate() for dealing with milliseconds # time=9.35ms
    
    1..2
    # time=64.147ms
}

ok 10 - src/pure-functions/xml.spec.ts # time=167.464ms {
    # Subtest: stripHtml()
        ok 1 - should strip html as expected
        1..1
    ok 1 - stripHtml() # time=72.486ms
    
    # Subtest: unescapeHtml()
        ok 1 - should unescape html as expected
        1..1
    ok 2 - unescapeHtml() # time=8.501ms
    
    # Subtest: plainText()
        ok 1 - should convert plain text as expected
        1..1
    ok 3 - plainText() # time=6.367ms
    
    # Subtest: digestEmoji()
        ok 1 - should digest emoji string 0 as expected
        ok 2 - should digest emoji string 1 as expected
        ok 3 - should digest emoji string 2 as expected
        ok 4 - should digest emoji string 3 as expected
        1..4
    ok 4 - digestEmoji() # time=16.9ms
    
    # Subtest: unifyEmoji()
        ok 1 - should convert the emoji xml to the expected unified xml
        ok 2 - should convert the emoji xml to the expected unified xml
        1..2
    ok 5 - unifyEmoji() # time=6.93ms
    
    # Subtest: stripEmoji()
        ok 1 - should strip to the expected str
        ok 2 - should strip to the expected str
        ok 3 - should return empty string for `undefined`
        1..3
    ok 6 - stripEmoji() # time=6.807ms
    
    1..6
    # time=167.464ms
}

ok 11 - src/user-mixins/poolify.spec.ts # time=158.765ms {
    # Subtest: poolifyMixin()
        ok 1 - should get meaning type for class instance
        ok 2 - should get Life type for pool.get()
        ok 3 - should get UserClassTest type for load()
        1..3
    ok 1 - poolifyMixin() # time=78.239ms
    
    # Subtest: poolifyMixin() pool
        ok 1 - should be size 0 for class 1
        ok 2 - should be size 0 for class 2
        ok 3 - should be size 1 for class 1 after class1.load()
        ok 4 - should be size 0 for class 2 after class1.load()
        ok 5 - should be size 1 for class 1 after class2.load()
        ok 6 - should be size 1 for class 2 after class2.load()
        1..6
    ok 2 - poolifyMixin() pool # time=32.169ms
    
    # Subtest: static findAll()
        ok 1 - should return the UserClassTest type
        1..1
    ok 3 - static findAll() # time=5.601ms
    
    1..3
    # time=158.765ms
}

ok 12 - src/user-mixins/validation.spec.ts # time=101.671ms {
    # Subtest: validationMixin() valid()
        ok 1 - should be valid for UserClassImpl "{}"
        ok 2 - should be invalid for Object "{}"
        ok 3 - should be invalid for Array "[]"
        ok 4 - should be invalid for Map "{}"
        ok 5 - should be valid for Object "{"bar":true,"foo":true}"
        ok 6 - should be invalid for Object "{"bar":true}"
        ok 7 - should be invalid for Object "{"foo":true}"
        1..7
    ok 1 - validationMixin() valid() # time=56.801ms
    
    # Subtest: validationMixin() type guard
        ok 1 - should be type `string`
        1..1
    ok 2 - validationMixin() type guard # time=8.732ms
    
    1..2
    # time=101.671ms
}

ok 13 - src/user-mixins/wechatify.spec.ts # time=61.101ms {
    # Subtest: isWechatified()
        ok 1 - should not be wechatified
        ok 2 - should throw before wechatified
        ok 3 - should be wechatified
        ok 4 - should not throw after wechatified
        ok 5 - should be able to assign with the correct typing
        1..5
    ok 1 - isWechatified() # time=35.789ms
    
    1..1
    # time=61.101ms
}

not ok 14 - src/user-modules/contact.spec.ts # time=61012.228ms
  ---
  env: {}
  file: src/user-modules/contact.spec.ts
  timeout: 60000
  command: /usr/bin/node
  args:
    - src/user-modules/contact.spec.ts
  stdio:
    - 0
    - pipe
    - 2
  cwd: /wechaty
  ...
{
    
    not ok 1 - timeout!
      ---
      expired: src/user-modules/contact.spec.ts
      ...
    1..1
    # failed 1 test
}

not ok 15 - src/user-modules/message.spec.ts # time=61027.156ms
  ---
  env: {}
  file: src/user-modules/message.spec.ts
  timeout: 60000
  command: /usr/bin/node
  args:
    - src/user-modules/message.spec.ts
  stdio:
    - 0
    - pipe
    - 2
  cwd: /wechaty
  ...
{
    
    not ok 1 - timeout!
      ---
      expired: src/user-modules/message.spec.ts
      ...
    1..1
    # failed 1 test
}

not ok 16 - src/user-modules/room.spec.ts # time=61013.734ms
  ---
  env: {}
  file: src/user-modules/room.spec.ts
  timeout: 60000
  command: /usr/bin/node
  args:
    - src/user-modules/room.spec.ts
  stdio:
    - 0
    - pipe
    - 2
  cwd: /wechaty
  ...
{
    
    not ok 1 - timeout!
      ---
      expired: src/user-modules/room.spec.ts
      ...
    1..1
    # failed 1 test
}

ok 17 - src/user-modules/url-link.spec.ts # time=5749.492ms {
    # Subtest: UrlLink.create() for wechaty.js.org
        ok 1 - should have title
        ok 2 - should have description
        ok 3 - should have url
        ok 4 - should have thumbnailUrl
        1..4
    ok 1 - UrlLink.create() for wechaty.js.org # time=5628.073ms
    
    # Subtest: UrlLink.valid()
        ok 1 - should pass the validation of UrlLinkImpl
        ok 2 - should not pass the validation of MessageImpl
        1..2
    ok 2 - UrlLink.valid() # time=56.011ms
    
    1..2
    # time=5749.492ms
}

not ok 18 - src/wechaty-builder.spec.ts # time=61011.692ms
  ---
  env: {}
  file: src/wechaty-builder.spec.ts
  timeout: 60000
  command: /usr/bin/node
  args:
    - src/wechaty-builder.spec.ts
  stdio:
    - 0
    - pipe
    - 2
  cwd: /wechaty
  ...
{
    
    not ok 1 - timeout!
      ---
      expired: src/wechaty-builder.spec.ts
      ...
    1..1
    # failed 1 test
}

ok 19 - src/wechaty-mixins/gerror-mixin.spec.ts # time=66.583ms {
    # Subtest: ProtectedPropertyGErrorMixin
        ok 1 - should match Mixin properties for every protected property
        1..1
    ok 1 - ProtectedPropertyGErrorMixin # time=27.096ms
    
    1..1
    # time=66.583ms
}

ok 20 - src/wechaty-mixins/plugin-mixin.spec.ts # time=84.688ms {
    # Subtest: ProtectedPropertyPluginMixin
        ok 1 - should match Mixin properties for every protected property
        1..1
    ok 1 - ProtectedPropertyPluginMixin # time=27.496ms
    
    1..1
    # time=84.688ms
}

ok 21 - src/wechaty-mixins/puppet-mixin.spec.ts # time=50.139ms {
    # Subtest: ProtectedPropertyPuppetMixin
        ok 1 - should match Mixin properties for every protected property
        1..1
    ok 1 - ProtectedPropertyPuppetMixin # time=22.999ms
    
    1..1
    # time=50.139ms
}

ok 22 - src/wechaty-mixins/wechatify-user-module-mixin.spec.ts # time=63.833ms {
    # Subtest: ProtectedPropertyWechatifyUserModuleMixin
        ok 1 - should match Mixin properties for every protected property
        1..1
    ok 1 - ProtectedPropertyWechatifyUserModuleMixin # time=28.239ms
    
    1..1
    # time=63.833ms
}

21:05:44 WARN ServiceCtl<Wechaty> stop() found that is stopping/stopped, wait stable ...
21:05:44 WARN ServiceCtl<Wechaty> stop() found that is stopping/stopped, wait stable ... done
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred...
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred... done
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred...
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred... done
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred...
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred... done
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred...
21:05:44 WARN ServiceCtl<PuppetServiceMixin> start() found that is starting/statred... done
ok 23 - src/wechaty/wechaty-base.spec.ts # time=1123.423ms {
    # Subtest: static VERSION
        ok 1 - Wechaty should has a static VERSION property
        1..1
    ok 1 - static VERSION # time=93.018ms
    
    # Subtest: event:start/stop
        ok 1 - should get event:start once
        ok 2 - should get event:stop once
        1..2
    ok 2 - event:start/stop # time=208.397ms
    
    ok 3 - SKIP DEALING WITH THE LISTENER EXCEPTIONS. on(event, Function) # SKIP
    ok 4 - SKIP DEALING WITH THE LISTENER EXCEPTIONS. test async error # SKIP
    # Subtest: use plugin
        ok 1 - expect truthy value
        1..1
    ok 5 - use plugin # time=13.77ms
    
    # Subtest: wechatifyUserModules()
        ok 1 - should not throw for the 1st time init
        ok 2 - should not throw for the 2nd time init (silence skip)
        1..2
    ok 6 - wechatifyUserModules() # time=7.339ms
    
    # Subtest: Perfect restart
        ok 1 - start/stop-ed at #0
        ok 2 - start/stop-ed at #1
        ok 3 - start/stop-ed at #2
        ok 4 - Wechaty start/restart successed.
        1..4
    ok 7 - Perfect restart # time=19.897ms
    
    # Subtest: @event ready
        ok 1 - should no ready event with new wechaty instance
        ok 2 - should no ready event right start wechaty started
        ok 3 - should fire ready event after puppet ready
        ok 4 - should fire ready event second time after stop/start wechaty
        1..4
    ok 8 - @event ready # time=16.941ms
    
    # Subtest: ready()
        ok 1 - should not ready with new wechaty instance
        ok 2 - should not ready after right start wechaty
        ok 3 - should ready after puppet ready
        ok 4 - should ready again after stop/start wechaty
        1..4
    ok 9 - ready() # time=31.035ms
    
    # Subtest: on/off event listener management
        ok 1 - should no listener after initializing
        ok 2 - should +1 listener after on(message)
        ok 3 - should -1 listener after off(message)
        1..3
    ok 10 - on/off event listener management # time=12.841ms
    
    # Subtest: wrapAsync() async function
        ok 1 - should get sync function return void
        ok 2 - should not emit error when sync function return value
        ok 3 - should not throw when async function throw error
        ok 4 - should emit error when async function throw error
        1..4
    ok 11 - wrapAsync() async function # time=65.115ms
    
    # Subtest: wrapAsync() promise
        ok 1 - should resolve Promise<any> to void
        ok 2 - should be void and not to reject
        ok 3 - should have no error before sleep
        ok 4 - should emit error when promise reject with error
        1..4
    ok 12 - wrapAsync() promise # time=17.791ms
    
    # Subtest: WechatyBaseProtectedProperty
        ok 1 - should match Wechaty properties for every protected property
        1..1
    ok 13 - WechatyBaseProtectedProperty # time=9.987ms
    
    1..13
    # skip: 2
    # time=1123.423ms
}

ok 24 - src/wechaty/wechaty-impl.spec.ts # time=105.018ms {
    # Subtest: Wechaty interface
        ok 1 - should no typing error
        1..1
    ok 1 - Wechaty interface # time=54.388ms
    
    # Subtest: ProtectedProperties
        ok 1 - should match Wechaty properties for every protected property
        1..1
    ok 2 - ProtectedProperties # time=12.865ms
    
    1..2
    # time=105.018ms
}

ok 25 - src/wechaty/wechaty-skelton.spec.ts # time=60.319ms {
    # Subtest: ProtectedPropertyWechatySkeleton
        ok 1 - should match Mixin properties for every protected property
        1..1
    ok 1 - ProtectedPropertyWechatySkeleton # time=23.686ms
    
    1..1
    # time=60.319ms
}

ok 26 - tests/electron.spec.ts # time=62.319ms {
    # Subtest: Electron smoke testing
        ok 1 - test
        1..1
    ok 1 - Electron smoke testing # time=30.524ms
    
    ok 2 - Electron open wx # SKIP
    1..2
    # skip: 1
    # time=62.319ms
}

ok 27 - tests/node.spec.ts # time=63.764ms {
    # Subtest: Node.js function params destructuring behaviour test
        ok 1 - should be equal to default args
        ok 2 - should be equal to default s args
        ok 3 - should be equal to default n args
        1..3
    ok 1 - Node.js function params destructuring behaviour test # time=43.806ms
    
    1..1
    # time=63.764ms
}

1..27
# failed 6 of 27 tests
# time=280036.383ms

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
npm notice 
npm notice New patch version of npm available! 8.1.0 -> 8.1.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.3>
npm notice Run `npm install -g npm@8.1.3` to update!
npm notice 
The command '/bin/sh -c npm test   && npm run dist   && npm link' returned a non-zero code: 1

@huan
Copy link
Member Author

huan commented Nov 13, 2021

Good job, according to the log message I feel you are very close to succeeding!

The unit test fails seems related to TIMEOUT, I guess is because the raspberry pi is slow (the same as the emulator), you can try to increase the TAP_TIMEOUT at the below line from 60 to 180 to see if it helps:

"test:unit": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" TAP_TIMEOUT=60 tap \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\"",

-  "test:unit": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" TAP_TIMEOUT=60 tap \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\"", 
+  "test:unit": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" TAP_TIMEOUT=180 tap \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\"", 

@Yc-Chen
Copy link
Contributor

Yc-Chen commented Nov 20, 2021

Keep trying! I got a new error now:

> wechaty@1.9.7 sloc
> sloc bin examples scripts src tests --details --format cli-table --keys total,source,comment && sloc bin examples scripts src tests

/wechaty/node_modules/cli-table/lib/utils.js:85
  var split = stripped.split("\n");
                       ^

TypeError: stripped.split is not a function
    at Object.exports.strlen (/wechaty/node_modules/cli-table/lib/utils.js:85:24)
    at get_width (/wechaty/node_modules/cli-table/lib/index.js:138:70)
    at /wechaty/node_modules/cli-table/lib/index.js:131:68
    at Array.forEach (<anonymous>)
    at extractColumnWidths (/wechaty/node_modules/cli-table/lib/index.js:130:9)
    at /wechaty/node_modules/cli-table/lib/index.js:104:11
    at Array.forEach (<anonymous>)
    at Table.toString (/wechaty/node_modules/cli-table/lib/index.js:101:16)
    at module.exports (/wechaty/node_modules/sloc/lib/formatters/cli-table.js:56:18)
    at print (/wechaty/node_modules/sloc/lib/cli.js:95:11)
npm notice 
npm notice New patch version of npm available! 8.1.0 -> 8.1.4
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.4>
npm notice Run `npm install -g npm@8.1.4` to update!
npm notice 
The command '/bin/sh -c npm test   && npm run dist   && npm link' returned a non-zero code: 1

@huan
Copy link
Member Author

huan commented Nov 21, 2021

The cli-table crash problem is related to:

@Yc-Chen
Copy link
Contributor

Yc-Chen commented Nov 21, 2021

I see, is it an idea to commit package-lock.json and use npm ci instead of npm install in Dockerfile?

@huan huan pinned this issue Nov 26, 2021
@huan
Copy link
Member Author

huan commented Nov 26, 2021

@Yc-Chen thanks for the suggestion.

However, we do not want to commit to the package-lock.json because we always want to use the latest packages from the npm ecosystem so that we can know the problem as early as possible.

For our users, they are free to use npm ci.

huan added a commit to wechaty/docusaurus that referenced this issue Nov 27, 2021
@huan
Copy link
Member Author

huan commented Nov 29, 2021

@huan huan closed this as completed Nov 29, 2021
@huan huan unpinned this issue Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants