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

CI fails for new repo [BUG] #800

Closed
djbpitt opened this issue Apr 25, 2022 · 9 comments · Fixed by #841
Closed

CI fails for new repo [BUG] #800

djbpitt opened this issue Apr 25, 2022 · 9 comments · Fixed by #841
Labels
bug CI / Testing Issues related to CI and testing setup released

Comments

@djbpitt
Copy link

djbpitt commented Apr 25, 2022

Describe the bug

I create a new local exist-db repo for Yeoman (choosing the "empty" option), add an XQSuite test, and push. CI fails; see https://github.com/djbpitt/tmp/actions/runs/2221082865 for CI output.

Expected behavior

I expect CI to succeed.

To Reproduce

-

Logs, error messages

Output of npm test is:

> [email protected] test /Users/djb/repos/tmp
> mocha test/mocha/ --recursive --exit && mocha test/xqs/*.js



  file system checks
    markup files are well-formed
      ✔ *.html is xhtml
      ✔ *.xml
      ✔ *.xconf
      ✔ *.odd
    Consistent data in aux files
      ✔ should contain identical descriptions
      ✔ should contain identical versions
      ✔ should contain identical licenses
      ✔ should contain identical titles
      1) Readme should have latest meta-data

  rest api returns
    ✔ 404 from random page
    ✔ 200 from default rest endpoint
    - file index.html exists in application root


  10 passing (66ms)
  1 pending
  1 failing

  1) file system checks
       Consistent data in aux files
         Readme should have latest meta-data:

      AssertionError [ERR_ASSERTION]: README.md did not match '# tmp'. Contained:

[![License][license-img]][license-url]
[![GitHub release][release-img]][release-url]
![exist-db CI](https://github.com/djbpitt/tmp/workflows/exist-db%20CI/badge.svg)

<img src="icon.png" align="left" width="25%"/>

My amazing tmp application

## Requirements

*   [exist-db](http://exist-db.org/exist/apps/homepage/index.html) version: `5.x` or greater

*   [ant](http://ant.apache.org) version: `1.10.7` \(for building from source\)

*   [node](http://nodejs.org) version: `12.x` \(for building from source\)
    

## Installation

1.  Download  the `tmp-1.0.0.xar` file from GitHub [releases](https://github.com/djbpitt/tmp/releases) page.

2.  Open the [dashboard](http://localhost:8080/exist/apps/dashboard/index.html) of your eXist-db instance and click on `package manager`.

    1.  Click on the `add package` symbol in the upper left corner and select the `.xar` file you just downloaded.

3.  You have successfully installed tmp into exist.

### Building from source

1.  Download, fork or clone this GitHub repository
2.  There are two default build targets in `build.xml`:
    *   `dev` including *all* files from the source folder including those with potentially sensitive information.
  
    *   `deploy` is the official release. It excludes files necessary for development but that have no effect upon deployment.
  
3.  Calling `ant`in your CLI will build both files:
  
bash
cd tmp
ant


   1. to only build a specific target call either `dev` or `deploy` like this:
   bash   
   ant dev
      

If you see `BUILD SUCCESSFUL` ant has generated a `tmp-1.0.0.xar` file in the `build/` folder. To install it, follow the instructions [above](#installation).



## Running Tests

To run tests locally your app needs to be installed in a running exist-db instance at the default port `8080` and with the default dba user `admin` with the default empty password.

A quick way to set this up for docker users is to simply issue:

bash
docker run -dit -p 8080:8080 existdb/existdb:release

After you finished installing the application, you can run the full testsuite locally.

### Unit-tests

This app uses [mochajs](https://mochajs.org) as a test-runner. To run both xquery and javascript unit-tests type:

bash
npm test

### Integration-tests

This app uses [cypress](https://www.cypress.io) for integration tests, just type:

bash
npm run cypress


Alternatively, use npx:

bash
npx cypress open


## Contributing

You can take a look at the [Contribution guidelines for this project](.github/CONTRIBUTING.md)

## License

MIT © [djb](http://www.obdurodon.org)

[license-img]: https://img.shields.io/badge/license-MIT-blue.svg
[license-url]: https://opensource.org/licenses/MIT
[release-img]: https://img.shields.io/badge/release-1.0.0-green.svg
[release-url]: https://github.com/djbpitt/tmp/releases/latest

      + expected - actual

      -false
      +true
      
      at /Users/djb/repos/tmp/node_modules/yeoman-assert/index.js:115:5
      at Array.forEach (<anonymous>)
      at Function.assert.fileContent (node_modules/yeoman-assert/index.js:102:26)
      at Context.<anonymous> (test/mocha/app_spec.js:186:16)
      at processImmediate (internal/timers.js:464:21)

Context (please always complete the following information):

  • node version: v14.19.1
  • eXist-db version: 6.0.1
  • generator version: 6.0.0
  • install method: npm
@duncdrum
Copy link
Collaborator

Thanks @djbpitt this should be a very simple fix. I admit that I rarely use the empty template.

@djbpitt
Copy link
Author

djbpitt commented Apr 25, 2022

Thank you, @duncdrum ! I’d be grateful if you could please continue to support the empty template. I understand that it may not meet everyone’s needs, but starting with only the barest necessities helps me enable the functionality I need without being distracted by features I don’t use. I’ll be happy to keep testing and reporting any issues I notice.

I understand that once you’ve had a chance to release a fix the issue won’t come up with new projects. Is there also an easy fix for projects I’ve already started developing?

@duncdrum
Copy link
Collaborator

Yes, I ll keep you posted. I expect the fix to land before Wednesday.

@duncdrum duncdrum added bug CI / Testing Issues related to CI and testing setup labels Apr 26, 2022
@duncdrum
Copy link
Collaborator

@djbpitt the test failure you are seeing is due to a modification of the Readme. The test expects the app title to be a level 1 heading on the readme, as well as the app description to be present, e.g.:

# tmp

my amazing tmp app

the second error hidde by this failure was due to an invalid reuse of function names within the same module, there were two tests:tautology() functions on test-suite.xqm

In both instances the template was basically working as intended. However when looking into this bug report i found other a severe regression with the yeoman parent library that ll take me some time to work around / fix.

duncdrum added a commit to duncdrum/generator-exist that referenced this issue Apr 26, 2022
invalid testsuites no longer produce cryptic failures

see eXist-db#800
@djbpitt
Copy link
Author

djbpitt commented Apr 27, 2022

@duncdrum I just merged your PR into my tmp repo and I'm experimenting now. If I've understood correctly, my reusing a function name in the test suite was an XQuery mistake, but should I consider modifying the Readme an error on my part? I don't have enough GitHub experience to know whether the test expectations you describe (app title as level 1 header, app description present) are 1) standard for GitHub reps, 2) not standard but generally accepted as Best Practice, or 3) a local convention. If it's a local convention I would feel comfortable disabling that part of the testing, following the pointer you provide. If, though, my edits to the Readme are inconsistent with generally accepted Best Practice recommendations, I should instead bring my Readme into conformance.

duncdrum added a commit to duncdrum/generator-exist that referenced this issue Apr 27, 2022
invalid testsuites no longer produce cryptic failures

see eXist-db#800
@djbpitt
Copy link
Author

djbpitt commented Apr 27, 2022

@duncdrum I merged your PR and verified (I think!) that the Readme and test function names now conform to your recommendations. CI is still failing. Sample test output:


Run npm test

> [email protected] test /home/runner/work/tmp/tmp
> mocha test/mocha/ --recursive --exit && mocha test/xqs/*.js



  file system checks
    markup files are well-formed
      ✔ *.html is xhtml
      ✔ *.xml
      ✔ *.xconf
      ✔ *.odd
    Consistent data in aux files
      ✔ should contain identical descriptions
      ✔ should contain identical versions
      ✔ should contain identical licenses
      ✔ should contain identical titles
      ✔ Readme should have latest meta-data

  rest api returns
    ✔ 404 from random page (95ms)
    ✔ 200 from default rest endpoint (93ms)
    - file index.html exists in application root


  11 passing (221ms)
  1 pending



  0 passing (1ms)

/home/runner/work/tmp/tmp/node_modules/mocha/lib/runner.js:962
    throw err;
    ^

Error: Non-whitespace before first tag.
Line: 0
Column: 1
Char: {
    at error (/home/runner/work/tmp/tmp/node_modules/sax/lib/sax.js:651:10)
    at strictFail (/home/runner/work/tmp/tmp/node_modules/sax/lib/sax.js:677:7)
    at beginWhiteSpace (/home/runner/work/tmp/tmp/node_modules/sax/lib/sax.js:951:7)
    at SAXParser.write (/home/runner/work/tmp/tmp/node_modules/sax/lib/sax.js:1006:11)
    at new XmlDocument (/home/runner/work/tmp/tmp/node_modules/xmldoc/lib/xmldoc.js:261:15)
    at IncomingMessage.<anonymous> (/home/runner/work/tmp/tmp/test/xqs/xqSuite.js:54:17)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:[8](https://github.com/djbpitt/tmp/runs/6195019985?check_suite_focus=true#step:12:8)4:[21](https://github.com/djbpitt/tmp/runs/6195019985?check_suite_focus=true#step:12:21))
npm ERR! Test failed.  See above for more details.
Error: Process completed with exit code 1.

@duncdrum
Copy link
Collaborator

hi david, i ve already added a commit in #801 that gracefully deals with the error you are now seeing. This one is coming from exist, being inconsistent in its response.

The commit is cd41d92 you can simply apply these changes to your xqSuite.js file and it should work. Otherwise once the PR is merged there ll be a new automatic release.

@djbpitt
Copy link
Author

djbpitt commented Jun 17, 2022

@duncdrum I'm embarrassed to show up with more of the same issues, but I am still unable to complete CI successfully. My latest experiment involved creating a completely new repo using Yeoman and pushing it to https://github.com/djbpitt/tmp (I deleted the old repo that was using that name before I began, so there is no old code at that location). I did not write any tests or otherwise configure the test harness; I just followed the prompts to create the new Yeoman project and then pushed it to GitHub. When I click on the little "x" next to the commit number at the top, I see that three checks were cancelled and one failed. I didn't cancel anything myself; so the cancelled ones were apparently cancelled automatically as a consequence of the failing one. The unit test that is created when I let Yeoman initialize a new repo passed, and it looks as if the error arose in the integration testing. I think the report is publicly accessible (that is, I think you can see the same thing I can if you click on the "x"), but just in case, here is what I think is the relevant part:

Run npm run cypress
> [email protected] cypress /home/runner/work/tmp/tmp
> cypress run
It looks like this is your first time using Cypress: 10.1.0
[STARTED] Task without title.
[SUCCESS] Task without title.
Opening Cypress...
[2540:0617/003016.501[8](https://github.com/djbpitt/tmp/runs/6928414740?check_suite_focus=true#step:13:9)81:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[2540:0617/003016.505728:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
There is a cypress.json file at the path: /home/runner/work/tmp/tmp
Cypress version [10](https://github.com/djbpitt/tmp/runs/6928414740?check_suite_focus=true#step:13:11).0.0 no longer supports cypress.json.
Please run cypress open to launch the migration tool to migrate to cypress.config.{js,ts,mjs,cjs}.
https://on.cypress.io/migration-guide
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cypress: `cypress run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] cypress script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-06-[17](https://github.com/djbpitt/tmp/runs/6928414740?check_suite_focus=true#step:13:18)T00_30_17_256Z-debug.log
Error: Process completed with exit code 1.

My usual assumption when Something Doesn't Work is that the cause is (my) user error, but I don't think I did anything here except respond to the Yeoman prompts. I didn't write any of my own tests. In case it's helpful, the process I followed to build is described at https://github.com/Pittsburgh-NEH-Institute/pr-app/blob/main/pr-app-tutorials/yeoman.md. As previously, I choose the "empty" option.

duncdrum added a commit that referenced this issue Jul 5, 2022
BREAKING CHANGE: update config files for cypress 10

presence of old config file will result in broken testsuites

close #833
close #800
@github-actions
Copy link

github-actions bot commented Jul 5, 2022

🎉 This issue has been resolved in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CI / Testing Issues related to CI and testing setup released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants