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

try moving to Github Actions from Travis for CI #1783

Merged
merged 16 commits into from
Jan 19, 2021
Merged

try moving to Github Actions from Travis for CI #1783

merged 16 commits into from
Jan 19, 2021

Conversation

jywarren
Copy link
Member

@jywarren jywarren commented Dec 30, 2020

@jywarren jywarren requested a review from a team as a code owner December 30, 2020 00:02
@gitpod-io
Copy link

gitpod-io bot commented Dec 30, 2020

@jywarren
Copy link
Member Author

Working from:

sudo: required
language: node_js
node_js:
- '10'
- '12'
env:
- CXX=g++-4.8
before_script:
- npm install grunt-cli -g # for "grunt build"
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
jobs:
include:
- name: "Base istanbul/tape node tests"
script: npm test
- name: "Benchmark tests"
script: npm run benchmark
- name: "Gif tests"
script: npm run gif-test
- name: "Browserify core tests and run"
script: grunt tests && npm run core-tests
- name: "Jasmine UI tests (mocked browser env)"
script: npm run test-ui
- name: "jest-puppeteer UI tests (full browser env)"
script: npm run test-ui-2
- name: "CLI tests"
script: npm run test-cli
- name: "Grunt build test of dev environment"
script: grunt build
after_success:
- bash <(curl -s https://codecov.io/bash)
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- xvfb # for tape-run
before_install:
- sudo apt-get update
- sudo apt-get install xserver-xorg-dev libxext-dev libxi-dev
- sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev
install:
- export DISPLAY=':99.0' # for tape-run
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & # for tape-run
- npm install # for tape-run

@jywarren
Copy link
Member Author

Looking good for a first attempt! We got all the way to gif tests and failed 2:

  Failed Tests: There were 2 failures

    blur module works correctly

      ✖ blur module works correctly with Gif


    convolution module works correctly

      ✖ convolution module works correctly with Gif

  total:     31
  passing:   29
  failing:   2
  duration:  30.9s


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! image-sequencer@3.6.0 gif-test: `node test/core/gifs/gif-test.js | tap-spec;`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the image-sequencer@3.6.0 gif-test 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/2020-12-30T00_07_06_164Z-debug.log
Error: Process completed with exit code 1.

I wonder if these relate to setup - do we need... chromedriver... headless-gl... other stuff from .travis.yml?

cc @harshkhandeparkar @publiclab/is-maintainers just so you can see my progress here! Any help welcome!

@jywarren
Copy link
Member Author

Thinking some of this stuff we may have to port over:

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- xvfb # for tape-run
before_install:
- sudo apt-get update
- sudo apt-get install xserver-xorg-dev libxext-dev libxi-dev
- sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev
install:
- export DISPLAY=':99.0' # for tape-run
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & # for tape-run
- npm install # for tape-run

@harshkhandeparkar
Copy link
Member

Thinking some of this stuff we may have to port over:

We need those dependencies for some of the modules.

I wonder if these relate to setup - do we need... chromedriver... headless-gl... other stuff from .travis.yml?

If it works for non-GIFs, it should work for GIFs...

@jywarren
Copy link
Member Author

jywarren commented Jan 5, 2021

OK we should be able to use this format to do this:

- name: Install prerequisites
  run: | 
   - sudo apt-get update 
   - sudo apt-get install g++-4.8 xvfb
   - sudo apt-get install xserver-xorg-dev libxext-dev libxi-dev 
   - sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev 
   - export DISPLAY=':99.0' # for tape-run 
   - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & # for tape-run 
   - npm install # for tape-run 

Co-authored-by: Barun Acharya <47106543+daemon1024@users.noreply.github.com>
@jywarren
Copy link
Member Author

jywarren commented Jan 5, 2021

OK, we got as far as Gif tests!

@daemon1024
Copy link
Member

daemon1024 commented Jan 5, 2021

It's the same as before, the same two tests were failing without the prerequisites too.

@daemon1024
Copy link
Member

I tried debugging it. It seems like the blur module is working fine but the generated base64 string is not matching the provided benchmark. Both seem to be blurred out when I converted them to image. What could be the reason behind it 🤔

@harshkhandeparkar
Copy link
Member

It is possible that the two blurred images are very slightly off. This could happen even due to precision issues! We need to use a better way of comparing images. We used to use the looks-same library to do it before. I think we ditched it at some point because this used to work just fine.... Until now.

@daemon1024
Copy link
Member

daemon1024 commented Jan 10, 2021

That might be the case. looks-same seems to be limited to PNGs tho.

Both blur and convolution seems to be dependent on

const convolve = require('../_nomodule/gpuUtils').convolve; // GPU convolution function.

which convolutes the rgb channels.

It is a gpu accelerated task, is it some limitation of the ci environment in github resulting in that precision issue?

@harshkhandeparkar
Copy link
Member

GPU precision can vary very slightly from device to device and in the case of modules like a blur, it won't even be noticed. We really need a looks-same alternative.

@jywarren
Copy link
Member Author

jywarren commented Jan 11, 2021 via email

@daemon1024
Copy link
Member

daemon1024 commented Jan 11, 2021

So I tried using https://github.com/rsmbl/Resemble.js since it looked more convenient to use than pixelmatch. I set the mismatch percentage to be less than 5% to pass the tests.

Here's the CI run on my PR with resemble.js
https://github.com/daemon1024/image-sequencer/pull/1/checks?check_run_id=1680335832
and my PR daemon1024#1

The gif tests seems to passing now tho it fails at the next step but it shouldn't be related to the scope of what we are trying to figure out right now.

Update: Pixelmatch seems to need height and width of image as input, we would need to process the image for getting that information. Let me know if you know of a way to do that.

@jywarren jywarren requested a review from a team as a code owner January 12, 2021 16:19
@jywarren
Copy link
Member Author

This is awesome, @daemon1024 thank you! Pulling in your commits now. Let's see what's next.

@jywarren
Copy link
Member Author

jywarren commented Jan 12, 2021

OK great - past Gif tests! Now:


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! image-sequencer@3.6.0 core-tests: `cat ./output/core-tests.js | tape-run --render="tap-spec"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the image-sequencer@3.6.0 core-tests 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/2021-01-12T16_23_44_822Z-debug.log
Error: Process completed with exit code 1.

note that ./output/core-tests.js is the browserified output of the tests themselves, from the grunt tests command. Some googling shows ELIFECYCLE sometimes relates to outdated dependencies and sometimes to permissions issues (https://stackoverflow.com/questions/42308879/how-to-solve-npm-error-npm-err-code-elifecycle and facebook/create-react-app#5980)... hmm. I tried restarting the test run to see if this was intermittent, but will keep trying...

@jywarren
Copy link
Member Author

OK, reproduced this in GitPod, full log copied here: https://gist.github.com/jywarren/eef2a7419c8a465842149554598e4045

@harshkhandeparkar
Copy link
Member

Are Github actions faster or have higher caps?

@harshkhandeparkar
Copy link
Member

Github, NPM, Azure, those PRs to the Linux kernel, WSL, Github One.... It's all falling into place now 😂

@jywarren
Copy link
Member Author

jywarren commented Jan 12, 2021 via email

@harshkhandeparkar
Copy link
Member

Judging by what they are doing, they probably want to erase GitLab from the face of the planet. CI/CD, Web IDE, Collaboration... All of these were Gitlab's main features...

@jywarren
Copy link
Member Author

For what it's worth, here is a complete log of running npm run setup:

https://gist.github.com/jywarren/c1573f8ceac5ecb45db49c945a6d7115

It does seem related to canvas but... it's possible the error from npm run setup is unrelated to the error from npm run core-tests

@jywarren
Copy link
Member Author

Here's a note on using tape-run in github actions! https://github.com/juliangruber/tape-run#github-actions

@jywarren
Copy link
Member Author

What do you both think? Can you offer a review?

Copy link
Member

@daemon1024 daemon1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@daemon1024
Copy link
Member

Xvfb (short for X virtual framebuffer) is an in-memory display server for UNIX-like operating system (e.g., Linux). It enables you to run graphical applications without a display (e.g., browser tests on a CI server)

Interesting.

@jywarren
Copy link
Member Author

Yeah, seems like that was it -- i hope that by splitting out, we can see more clearly what is required for which job!

@jywarren
Copy link
Member Author

Also noting this runs in 1/2 the time of Travis because it's parallel -- 2m 50s instead of 6m 26s in https://github.com/publiclab/image-sequencer/runs/1343663692 (for example)

@harshkhandeparkar
Copy link
Member

It works finally? 🥳

@jywarren
Copy link
Member Author

jywarren commented Jan 19, 2021 via email

@jywarren
Copy link
Member Author

jywarren commented Jan 19, 2021 via email

@harshkhandeparkar
Copy link
Member

Sure, np!

@jywarren jywarren merged commit 580a154 into main Jan 19, 2021
@jywarren
Copy link
Member Author

Hooray! Thank you both a TON for helping get this merged! I couldn't have done it without you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
v3.7.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants