ZenVoich / mops

Package manager for the Motoko programming language
https://mops.one
MIT License
40 stars 5 forks source link

MOPS test library dependent on dfx? #58

Closed Gekctek closed 1 year ago

Gekctek commented 1 year ago

Just wondering if DFX is actually needed for running MOPS tests. Im trying to use it in my github actions and I get this error. Its fine if it is needed, just wanted to make sure

Run make test
mops test
Test files:
• test/Parser.test.mo
• test/Tokenizer.test.mo
--------------------------------------------------
/bin/sh: 1: dfx: not found
node:internal/errors:857
  const err = new Error(message);
              ^

Error: Command failed: dfx cache show
/bin/sh: 1: dfx: not found

    at checkExecSyncError (node:child_process:861:11)
    at execSync (node:child_process:932:15)
    at runAll (file:///opt/hostedtoolcache/node/16.19.1/x6[4](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:5)/lib/node_modules/ic-mops/commands/test.js:82:14)
    at async test (file:///opt/hostedtoolcache/node/16.19.1/x64/lib/node_modules/ic-mops/commands/test.js:4[5](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:6):1[6](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:7))
    at async Command.<anonymous> (file:///opt/hostedtoolcache/node/16.19.1/x64/lib/node_modules/ic-mops/cli.js:162:3) {
  status: 12[7](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:8),
  signal: null,
  output: [
    null,
    Buffer(0) [Uint[8](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:9)Array] [],
    Buffer(27) [Uint8Array] [
       47,  [9](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:10)8, [10](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:11)5, [11](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:12)0,  47, 115, 104,
       58,  32,  49,  58,  32, 100, 102,
      [12](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:13)0,  58,  32, 110, 111, 116,  32,
      102, 111, 117, 110, 100,  10
    ]
  ],
  pid: 1754,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: Buffer(27) [Uint8Array] [
     47,  98, 105, 110,  47, 1[15](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:16), 104,
     58,  32,  49,  58,  32, 100, 102,
    120,  58,  32, 110, 111, 1[16](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:17),  32,
    102, 111, 1[17](https://github.com/edjCase/motoko_xml/actions/runs/4311036418/jobs/7520039853#step:6:18), 110, 100,  10
  ]
}
make: *** [Makefile:6: test] Error 1
Error: Process completed with exit code 2.
Gekctek commented 1 year ago

Well...maybe not. Not sure whats going on here

This is what i get after I add sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" to the build process

mops test
Test files:
• test/Parser.test.mo
• test/Tokenizer.test.mo
--------------------------------------------------
Running test/Parser.test.mo
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/runner/.cache/dfinity/versions/0.13.1/moc ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:28[5](https://github.com/edjCase/motoko_xml/actions/runs/4311120776/jobs/7520213734#step:7:6):19)
    at onErrorNT (node:internal/child_process:485:1[6](https://github.com/edjCase/motoko_xml/actions/runs/4311120776/jobs/7520213734#step:7:7))
    at processTicksAndRejections (node:internal/process/task_queues:[8](https://github.com/edjCase/motoko_xml/actions/runs/4311120776/jobs/7520213734#step:7:9)3:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:2[9](https://github.com/edjCase/motoko_xml/actions/runs/4311120776/jobs/7520213734#step:7:10)1:[12](https://github.com/edjCase/motoko_xml/actions/runs/4311120776/jobs/7520213734#step:7:13))
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /home/runner/.cache/dfinity/versions/0.[13](https://github.com/edjCase/motoko_xml/actions/runs/4311120776/jobs/7520213734#step:7:14).1/moc',
  path: '/home/runner/.cache/dfinity/versions/0.13.1/moc',
  spawnargs: [
    '-r',
    '-wasi-system-api',
    '-ref-system-api',
    '--hide-warnings',
    '--error-detail=2',
    '--package',
    'base',
    '.mops/base@0.8.1/src',
    '--package',
    'xtended-numbers',
    '.mops/xtended-numbers@0.2.0/src',
    '--package',
    'test',
    '.mops/test@1.0.1/src',
    'test/Parser.test.mo'
  ]
}
make: *** [Makefile:6: test] Error 1
Error: Process completed with exit code 2.
ZenVoich commented 1 year ago

Yes, test command depends on dfx

ZenVoich commented 1 year ago

@Gekctek just added example of workflow to run mops test command https://github.com/ZenVoich/mops/blob/master/.github/workflows/mops-test.yml You can just copy/paste)

Gekctek commented 1 year ago

Awesome. TYSM