-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Conversation
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. |
I tried to create an environment similar to that of half a year ago with
but the test still segfaults locally. |
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. |
I have a couple of things to say about this. Please don't merge it yet. |
.circleci/config.yml
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this step:
- Please move these commands to an
install.sh
script in.circleci
- 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.
.circleci/config.yml
Outdated
export PATH="$HOME/miniconda/bin:$PATH" | ||
conda install python=$PYTHON_VERSION | ||
- run: | ||
name: Install Spyder from GitHub |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
.circleci/config.yml
Outdated
cd spyder-3.x | ||
python setup.py install | ||
- run: | ||
name: Set up test environment |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
.circleci/config.yml
Outdated
echo '********** output of conda list **********' | ||
conda list | ||
- run: | ||
name: Run tests |
There was a problem hiding this comment.
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.
.circleci/config.yml
Outdated
command: | | ||
export PATH="$HOME/miniconda/bin:$PATH" | ||
mkdir test-reports | ||
pytest spyder_notebook --cov=spyder_notebook --junitxml=test-reports/junit.xml |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
.circleci/config.yml
Outdated
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.circleci/config.yml
Outdated
pytest spyder_notebook --cov=spyder_notebook --junitxml=test-reports/junit.xml | ||
COVERALLS_REPO_TOKEN=Kr503QwklmJYKXYRXLywrtw8zbX7K8SKx coveralls | ||
- run: | ||
name: Run style checks |
There was a problem hiding this comment.
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.
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 |
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. |
Please do. Just follow the example of |
The nice thing about ci-helpers is that you declare your dependencies through the env vars |
The latest error is caused because the scripts are not executable files. |
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. |
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 |
.circleci/install.sh
Outdated
popd | ||
|
||
# Install spyder-notebook from source in developer mode | ||
python setup.py develop |
There was a problem hiding this comment.
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.
.circleci/run-tests.sh
Outdated
|
||
# Run tests; flag -x means stop on first test failure | ||
pytest -x -vv spyder_notebook --cov=spyder_notebook --junitxml=test-reports/junit.xml | ||
|
There was a problem hiding this comment.
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
.
.circleci/run-tests.sh
Outdated
|
||
export PATH="$HOME/miniconda/bin:$PATH" | ||
conda activate test | ||
mkdir test-reports |
There was a problem hiding this comment.
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.
.circleci/install.sh
Outdated
|
||
# Install Miniconda and required packages using astropy's ci-helpers | ||
TRAVIS_OS_NAME='linux' | ||
CONDA_DEPENDENCIES='notebook pytest pytest-cov flaky' |
There was a problem hiding this comment.
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.
.circleci/install.sh
Outdated
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 |
There was a problem hiding this comment.
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.
.circleci/config.yml
Outdated
- store_test_results: | ||
path: test-reports | ||
- store_artifacts: | ||
path: test-reports |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.
This reverts commit b07b54a.
I checked and it is not necessary to add
after the call to pytest, because the script is run with the This is now ready for merging as far as I am concerned. |
.circleci/install.sh
Outdated
export PATH="$HOME/miniconda/bin:$PATH" | ||
|
||
# Install required Python version | ||
conda install -y python=$PYTHON_VERSION |
There was a problem hiding this comment.
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.
There was a problem hiding this 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!
Fixes #156