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

PR: Upgrade to CircleCI v2.0 #159

Merged
merged 19 commits into from
Aug 25, 2018
Merged

Conversation

jitseniesen
Copy link
Member

Fixes #156

@jitseniesen
Copy link
Member Author

The tests segfault on Circle, but they also segfault when I run them locally, so it looks like the CircleCI script works fine and something else broke in the last half year.

@jitseniesen jitseniesen added this to the v0.1.3 milestone Aug 22, 2018
@jitseniesen
Copy link
Member Author

I tried to create an environment similar to that of half a year ago with

conda install qt=5.6.2 spyder=3.2.6 ipython=6.2.1 notebook=5.4.0 qtpy=1.3.1

but the test still segfaults locally.

@jitseniesen
Copy link
Member Author

Tests are passing now on Circle CI after I removed pytest-xvfb (which was installed via pip) and also when run locally on one of my computers, so this is ready to be merged.

The tests do segfault when run on another computer but I'm assuming that is a local issue.

@ccordoba12
Copy link
Member

I have a couple of things to say about this. Please don't merge it yet.

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
conda install python=$PYTHON_VERSION
Copy link
Member

Choose a reason for hiding this comment

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

In this step:

  1. Please move these commands to an install.sh script in .circleci
  2. Please use Astropy's ci-helpers instead of installing Miniconda by hand. That's what we have adopted is most other repos in our org. See for example qtpy's install.sh.

export PATH="$HOME/miniconda/bin:$PATH"
conda install python=$PYTHON_VERSION
- run:
name: Install Spyder from GitHub
Copy link
Member

Choose a reason for hiding this comment

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

There's no need to have this step now. It was needed before we released Spyder 3.2, but not anymore, so please remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ccordoba12 I am not sure I understand what you are saying. Do you mean that it is easier to install spyder via conda instead of via github? That is true, but I think it is better to test against the version at the head of the 3.x branch on git, in order to catch any regressions. I know that 3.x is not supposed to introduce any backward incompatibilities, but it is good to test for it. Of course, this does mean testing against a moving target which has its own problems, but I felt this approach was the most useful.

Copy link
Member

Choose a reason for hiding this comment

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

I know that 3.x is not supposed to introduce any backward incompatibilities, but it is good to test for it

Ok. I was thinking to test against the latest release, but sure, we can test against the HEAD of 3.x

Then please move this to install.sh too.

cd spyder-3.x
python setup.py install
- run:
name: Set up test environment
Copy link
Member

Choose a reason for hiding this comment

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

The commands in this step can go to install.sh too.

Copy link
Member

Choose a reason for hiding this comment

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

And they will be simpler after switching to ci-helpers.

echo '********** output of conda list **********'
conda list
- run:
name: Run tests
Copy link
Member

Choose a reason for hiding this comment

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

Please move these commands to a script called run_tests.sh. You can find an example in qtpy too.

command: |
export PATH="$HOME/miniconda/bin:$PATH"
mkdir test-reports
pytest spyder_notebook --cov=spyder_notebook --junitxml=test-reports/junit.xml
Copy link
Member

Choose a reason for hiding this comment

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

This command needs to be

pytest -x -vv spyder_notebook --cov=spyder_notebook

Copy link
Member

Choose a reason for hiding this comment

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

And after this command please add these lines

if [ $? -ne 0 ]; then
    exit 1
fi

so that this step fails if the pytest exit code is not 0.

export PATH="$HOME/miniconda/bin:$PATH"
mkdir test-reports
pytest spyder_notebook --cov=spyder_notebook --junitxml=test-reports/junit.xml
COVERALLS_REPO_TOKEN=Kr503QwklmJYKXYRXLywrtw8zbX7K8SKx coveralls
Copy link
Member

Choose a reason for hiding this comment

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

There's no need to use COVERALLS_REPO_TOKEN in Circle now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Without the token, I get the following error:

Couldn't find a repository matching this job.
Traceback (most recent call last):
  File "/home/circleci/miniconda/bin/coveralls", line 11, in <module>
    sys.exit(main())
  File "/home/circleci/miniconda/lib/python3.6/site-packages/coveralls/cli.py", line 80, in main
    log.info(result['url'])
KeyError: 'url'
Exited with code 1

pytest spyder_notebook --cov=spyder_notebook --junitxml=test-reports/junit.xml
COVERALLS_REPO_TOKEN=Kr503QwklmJYKXYRXLywrtw8zbX7K8SKx coveralls
- run:
name: Run style checks
Copy link
Member

Choose a reason for hiding this comment

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

This can be removed. Unfortunately ciocheck hasn't been updated in a long time.

You could set up support for pep8speaks in another PR though.

@ccordoba12
Copy link
Member

Thanks for doing this @jitseniesen! My main suggestion is to use shell scripts to perform the installation and testing steps. That way things will be more readable and maintainable than putting everything in a big config.yml.

Also, we should use ci-helpers everywhere from now on. It's a fantastic project and it works pretty well too.

@jitseniesen
Copy link
Member Author

Also, we should use ci-helpers everywhere from now on. It's a fantastic project and it works pretty well too.

When I was testing, I found ci-helpers not so helpful because I didn't understand what is going on. When I looked into it, it seemed that only six lines of script was relevant for me, so I thought it better to just include them explicitly. But if you prefer to use ci-helpers, I'll give it another go.

@ccordoba12
Copy link
Member

But if you prefer to use ci-helpers, I'll give it another go.

Please do. Just follow the example of qtpy.

@ccordoba12
Copy link
Member

The nice thing about ci-helpers is that you declare your dependencies through the env vars CONDA_DEPENDENCIES and PIP_DEPENDENCIES. That's what makes things more maintainable.

@ccordoba12
Copy link
Member

The latest error is caused because the scripts are not executable files.

@goanpeca
Copy link
Member

Hi Jit thanks a lot for working on this :-)

I have mixed views on the recommendation of using ci helpers vs raw install commands for setting the environment. I originally used ci helpers and even I believe I advicated the use of them, but I have found that solution to be limiting under certain scenarios to the point that I rollback most projects where I used cihelpers back to a similar way like implemented on this PR.

It does make the yaml files simpler but it also obfuscates what is going on.

@ccordoba12
Copy link
Member

It does make the yaml files simpler but it also obfuscates what is going on.

Sure, but you usually need to touch ci-helpers env vars. But ok, if you prefer to not use it here, I'm not opposed to the idea.


@jitseniesen, last recommendation then: please unify all install-foo.sh scripts into a single install.sh one. I don't think we need three separate scripts for that.

popd

# Install spyder-notebook from source in developer mode
python setup.py develop
Copy link
Member

Choose a reason for hiding this comment

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

This line is what's causing the error in Circle. It's really not necessary, so please remove it.


# Run tests; flag -x means stop on first test failure
pytest -x -vv spyder_notebook --cov=spyder_notebook --junitxml=test-reports/junit.xml

Copy link
Member

Choose a reason for hiding this comment

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

As I told you before, please add here this bit of shell code

if [ $? -ne 0 ]; then
    exit 1
fi

to make this step really fail in Circle. That checks if the exit code of the previous step is 0, and if not, it forces an exit 1.


export PATH="$HOME/miniconda/bin:$PATH"
conda activate test
mkdir test-reports
Copy link
Member

Choose a reason for hiding this comment

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

This line shouldn't be necessary. Please try to remove it.


# Install Miniconda and required packages using astropy's ci-helpers
TRAVIS_OS_NAME='linux'
CONDA_DEPENDENCIES='notebook pytest pytest-cov flaky'
Copy link
Member

Choose a reason for hiding this comment

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

Please add below this step

CONDA_DEPENDENCIES_FLAGS="--quiet"

to avoid a lot of unnecessary noise in this step.

TRAVIS_OS_NAME='linux'
CONDA_DEPENDENCIES='notebook pytest pytest-cov flaky'
PIP_DEPENDENCIES='coveralls pytest-qt'
git clone --depth 1 git://github.com/astropy/ci-helpers.git
Copy link
Member

Choose a reason for hiding this comment

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

Please add blank above this line.

- store_test_results:
path: test-reports
- store_artifacts:
path: test-reports
Copy link
Member

Choose a reason for hiding this comment

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

I see test-reports is used here. Is this really necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this uploads the test results to CircleCI but it is not clear what they do with it, so I'll remove this.

@jitseniesen
Copy link
Member Author

But ok, if you prefer to not use [astropy's ci-helpers] here, I'm not opposed to the idea.

I tried to use it for consistency with the other repos, but I found that it downgrates conda to 4.3. That version does not have the --only-deps flag which is really quite useful so I decided against using ci-helpers.

This commit is for testing purposes and will be reverted in the next commit.
@jitseniesen
Copy link
Member Author

I checked and it is not necessary to add

if [ $? -ne 0 ]; then
    exit 1
fi

after the call to pytest, because the script is run with the -e flag.

This is now ready for merging as far as I am concerned.

export PATH="$HOME/miniconda/bin:$PATH"

# Install required Python version
conda install -y python=$PYTHON_VERSION
Copy link
Member

Choose a reason for hiding this comment

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

You're installing everything in conda's base or root environment.

That's bad. Instead, please create a clean env (ci-helpers calls it test) and install everything there.

@ccordoba12 ccordoba12 changed the title Upgrade to CircleCI v2.0 PR: Upgrade to CircleCI v2.0 Aug 25, 2018
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

This is ready, at last!

@ccordoba12 ccordoba12 merged commit fa3f04c into spyder-ide:master Aug 25, 2018
@jitseniesen jitseniesen deleted the circle2 branch August 25, 2018 18:00
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.

3 participants