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

Deploy documentation and make extended tests visible #1447

Merged
merged 9 commits into from Mar 19, 2018

Conversation

Croydon
Copy link
Contributor

@Croydon Croydon commented Feb 27, 2018

As discovered in #1402 the docs aren't getting deployed anymore.
Also the tests don't run.

This fixes both (fix #1402) and has some other simplifications.

The tests are failing right now. This is already the case in the current master branch, but was hidden since no tests ran...

@JimiC
Copy link

JimiC commented Feb 28, 2018

@Croydon I see you are switching to stages. Great! I was going to propose that. The only objection I have to this PR is that documentation should be deployed after all test pass, not before.
I'll try to propose a travis configuration within the day.

@Croydon
Copy link
Contributor Author

Croydon commented Feb 28, 2018

Before the documentation gets deployed all tests already ran.

If you put it at the end, you first deploy new binaries and then documentation, which is worse in my opinion.

@JimiC
Copy link

JimiC commented Feb 28, 2018

You see the point with stages is to run your test first and when they pass you move to the stage where you deploy the binaries and then to the stage where you update the docs. At least that's the steps I take in other projects and that's the one I'll propose.

@Croydon
Copy link
Contributor Author

Croydon commented Feb 28, 2018

This is possible as well, sure.

Current order in this pull request:

  • ran all implemented tests
  • if former step succeeded: deploy documentation
  • if former step succeeded: build and deploy all binaries

Order in master right now:

  • build and deploy binaries if some smaller tests are fine
  • SOMEWHEN ran more extensive tests (when NODE VERSION = 6)
    • this didn't worked anymore, since no such versions existed in the CI configuration
    • even if this version would exist, it would hide the extensive testing "somewhere" within the amount of jobs, without visible indiciation, and even if the extensive tests would fail, all other binaries would get deployed

So this pull request is already a huge improvement to this. You can surely improve it even more, but I think that would be follow up work.

What is missing in this pull request is possibly the fixing of the tests, however, technically speaking even this is another issue.

@JimiC
Copy link

JimiC commented Feb 28, 2018

From what I see, currently travis does:

  • Setup
  • Run test
    • if tagged and OS is linux and node version is 6 then run test and produce coverage reports and send them to coveralls
      -If tagged then deploy binaries
  • if branch is master and not a PR and OS is linux and node version is 6 and targeted arch os x64 then deploy documentation.

With stages we can have:

  • Setup
  • Stage Test (if conditions are met)
    • Run tests
  • Stage Code Coverage report (if condition are met)
    • Run tests and run tests on compiled code and generate report and upload
  • Stage Deploy Binaries (if condition are met)
    • Compile and deploy binaries (no need to runt tests here again)
  • Stage Deploy Documentation (if condition are met)
    • Compile and run deploy-docs script (no need to run tests here again)

Note here that we can trigger 'Stage Test' on every occasion except release and all others on release.
Also, the stage order should be as described.

@JimiC
Copy link

JimiC commented Feb 28, 2018

Come to think of it 'Stage Code Coverage report' can be combined with 'Stage Test' by altering the running travis script.

@Croydon Croydon changed the title Deploy documentation and run tests Deploy documentation and make extended tests visible Feb 28, 2018
@JimiC
Copy link

JimiC commented Feb 28, 2018

@Croydon What does the before_script do?

@JimiC
Copy link

JimiC commented Feb 28, 2018

sudo: false

compiler: clang

language: node_js

os:
  - linux
  - osx

node_js:
  - node
  - 8
  - 7
  - 6

env:
  matrix:
    - TARGET_ARCH="x64"
    - TARGET_ARCH="ia32"

matrix:
  fast_finish: true
  exclude:
    - os: osx
      env: TARGET_ARCH="ia32"

git:
  depth: 1

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - build-essential
      - libssl-dev
      - gcc-4.9-multilib
      - g++-4.9-multilib
      - lcov

before_install:
  - export CC=clang
  - export CXX=clang++
  - export npm_config_clang=1
  - export JOBS=4
  - export GYP_DEFINES="use_obsolete_asm=true"

# This is a random private key used purely for testing.
before_script:
  - echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
  - echo -e "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkTcgXnHuqR0gbwegnr9Zxz4hTkjjV/SpgJNPJz7mo/HKNbx0rqjj1P0yGR053R9GSFFim2ut4NK9DPPUkQdyucw+DoLkYRHJmlJ4BNa9NTCD0sl+eSXO2969kZojCYSOgbmkCJx8mdgTwhzdgE/jhBrsY0hPE6pRTlU+H68/zeNdJUAIJf0LLXOm3h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r\nkS6138gU/CSCLf8pCYa6pA/GmsaXxloeJGLvT4fzOZRsVav80/92XHRhAoGBAOu2\nmKh4Gr1EjgN9QNbk9cQTSFDtlBEqO/0pTepvL73UvNp/BAn4iYZFU4WnklFVBSWc\nL84Sc732xU12TAbTTUsa6E7W29pS8u7zVTxlIdQIIU5pzDyU1pNNk2kpxzte5p3Y\nPDtniPFsoYLWoH0LpsKL93t2pLAj+IOkE6f3XBq5AoGAIKaYo5N1FxQr952frx/x\nQUpK0N/R5Ng8v18SiLG26rhmM5iVSrQXC7TrHI7wfR8a9tC6qP/NqnM9NuwC/bQ0\nEEo7/GhaWxKNRwZRkmWiSFLNGk9t1hbtGU+N1lUdFtmloPIQdRNiw0kN3JTj474Q\nYI7O1EItFORnK6yxZfR6HEECgYEA1CT7MGUoa8APsMRCXyaiq15Pb8bjxK8mXquW\nHLEFXuzhLCW1FORDoj0y9s/iuKC0iS0ROX8R/J7k5NrbgikbH8WP36UxKkYNr1IC\nHOFImPTYRSKjVsL+fIUNb1DSp3S6SsYbL7v3XJJQqtlQiDq8U8x1aQFXJ9C4EoLR\nzhKrKsECgYBtU/TSF/TATZY5XtrN9O+HX1Fbz70Ci8XgvioheVI2fezOcXPRzDcC\nOYPaCMNKA5E8gHdg4s0TN7uDvKTJ+KhSg2V7gZ39A28dHrJaRX7Nz4k6t2uEBjX9\na1JidpAIbJ+3w7+hj6L299tVZvS+Y/6Dz/uuEQGXfJg/l/5CCvQPsA==\n-----END RSA PRIVATE KEY-----" > ~/.ssh/id_rsa
  - chmod 600 ~/.ssh/id_rsa*
  - eval `ssh-agent -s`
  - ssh-add ~/.ssh/id_rsa
  - git config --global user.name "John Doe"
  - git config --global user.email johndoe@example.com

script: travis_retry npm test

jobs:
  include:
    - stage: Code Coverage Report
      if: repo =~ ^nodegit AND tag IS present AND type != pull_request
      os: linux
      node_js: 6
      before_install:
        - export GYP_DEFINES="coverage=1 use_obsolete_asm=true";
        - export CC=/usr/bin/gcc-4.9;
        - export CXX=/usr/bin/g++-4.9;
        - export npm_config_clang=0;
        - wget http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz;
        - tar xvfz lcov-1.10.tar.gz;
      before_script:
      script: travis_retry npm test && npm run cov && npm run coveralls

    - stage: Deploy Binaries
      if: repo =~ ^nodegit AND tag IS present AND type != pull_request
      os: linux
      node_js: 6
      env:
        - TARGET_ARCH="x64"
        - TARGET_ARCH="ia32"
      before_script:
      script:
        - npm install -g node-pre-gyp;
        - npm install -g aws-sdk;
        - node lifecycleScripts/clean;
        - node-pre-gyp package --target_arch=$TARGET_ARCH;
        - node-pre-gyp publish --target_arch=$TARGET_ARCH;
    
    - stage: Deploy Documentation
      if: repo =~ ^nodegit AND tag IS present AND type != pull_request
      os: linux
      node_js: 6
      before_script:
      script: bash .travis/deploy-docs.sh      

notifications:
  slack:
    secure: KglNSqZiid9YudCwkPFDh+sZfW5BwFlM70y67E4peHwwlbbV1sSBPHcs74ZHP/lqgEZ4hMv4N2NI58oYFD5/1a+tKIQP1TkdIMuq4j2LXheuirA2HDcydOVrsC8kRx5XFGKdVRg/uyX2dlRHcOWFhxrS6yc6IxtxYWlRTD2SmEc=

  webhooks:
    urls:
      - https://webhooks.gitter.im/e/cbafdb27ad32ba746a73
    on_success: always  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always
    on_start: false     # default: false

Here is my proposal of a simplified travis config. I still don't know what before_script does so you may have to adjust accordingly If you decide to adopt it.

@Croydon
Copy link
Contributor Author

Croydon commented Feb 28, 2018

@JimiC I haven't used stage conditions or grouping the script steps into the stages on purposes as it is too buggy right now. See travis-ci/beta-features#28

Beyond that, your script seems to do the same as my version.

before_script is preparing the environment for the steps later. Like setting some flags for GYP and downloading lcov.


From my perspective this pull request's work is done. Not sure who needs to review this. @implausible maybe?

@JimiC
Copy link

JimiC commented Feb 28, 2018

What you describe is before_install. before_script looks like some setup for git but as I'm not familiar with the entire project, I'm hesitant to remove it.

Regarding the condition declaration in stages what I used is safe as I have dealt with the bugs in another project and used those that work.

I'm merely proposing simplicity versus complexity for the travis config. I believe that my proposal increases readability and maintainability. But I'm just passing through here... so no biggy.

@implausible
Copy link
Member

@Croydon I will get to this before the next release so we can start having good docs again.

@implausible
Copy link
Member

This was cancelled/failing on travis. @Croydon

@Croydon
Copy link
Contributor Author

Croydon commented Mar 16, 2018

@implausible It's weird. Either the stage condition did work in this case (it's still a buggy beta feature), but then the overall build status should not be set to "failed". And if there was another reason then there should be some log...

Could you please just restart the build?

@Croydon
Copy link
Contributor Author

Croydon commented Mar 16, 2018

I will have a look in the next 36 hours.

@implausible
Copy link
Member

@Croydon I canceled the PR this time. It looks like you need another condition in the deploy stage which only causes it to run if the build is NOT in a PR. It is trying to update documentation in this PR.

@Croydon
Copy link
Contributor Author

Croydon commented Mar 16, 2018

No, let it run.

The job runs but the documentation will NOT get deployed. https://github.com/inexorgame/nodegit/blob/f725ac5950b0ba7fb126c0845212f1a78377a62e/.travis.yml#L106

@implausible
Copy link
Member

Aha, thanks that's what I was missing. Thanks @Croydon!

.travis.yml Outdated
@@ -98,7 +103,7 @@ after_success:
node-pre-gyp publish --target_arch=$TARGET_ARCH;
fi

- if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_PULL_REQUEST == "false" ] && [ $TRAVIS_OS_NAME == "linux" ] && [ $NODE_VERSION == "6" ] && [ $TARGET_ARCH == "x64" ]; then
- if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_PULL_REQUEST == "false" ] && [ $DEPLOY_DOCUMENTATION == "true" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

We should not deploy documentation unless it is a deploy build. Please add the TRAVIS_TAG condition.

@implausible implausible merged commit 204d621 into nodegit:master Mar 19, 2018
@implausible
Copy link
Member

Thanks @Croydon!

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

Successfully merging this pull request may close these issues.

Documentation falling behind releases
3 participants