Skip to content

Windows CI #269

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

Merged
merged 3 commits into from
Sep 21, 2020
Merged

Windows CI #269

merged 3 commits into from
Sep 21, 2020

Conversation

tomwhite
Copy link
Collaborator

This is a first attempt at #247.

  • The main change is to use Miniconda (so we can install msprime easily on Windows).
  • I couldn't get the pre-commit GH action to work with conda, so I ended up just calling the relevant commands directly.
  • Added guards to only perform some actions (linting, doc checking, etc) for one matrix entry (Ubuntu/Python 3.7)
  • I had to skip some doctest checking, since on Windows it would show numpy arrays as (array([0, 2], dtype=int64) not (array([0, 2]). I'm not sure why this is happening exactly, but I couldn't see a way in numpy to control whether the dtype was displayed or not.
  • We probably want to update docs.yml to use the same approach for consistency.

@tomwhite tomwhite requested a review from ravwojdyla September 17, 2020 13:36
run: |
sudo apt install libgsl-dev # Needed for msprime < 1.0. Binary wheels include GSL for >= 1.0
python -m pip install --upgrade pip
conda install msprime
pip install -r requirements.txt -r requirements-dev.txt
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we install these also via conda?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure. What's the downside of doing it like this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@tomwhite not sure, but if we already use conda, why not use it all the way?

Copy link
Collaborator

@jeromekelleher jeromekelleher Sep 17, 2020

Choose a reason for hiding this comment

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

I'd be in favour of using conda by default - it's good to test out CI on the conda infrastructure. I'd only use pip when conda packages aren't available.

python-version: ${{ matrix.python-version }}
- name: Install dependencies
shell: bash -l {0}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's to ensure the conda env is activated. See https://github.com/marketplace/actions/setup-miniconda#important

I can add a comment to document this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, this is why internally we use:

    - uses: s-weigand/setup-conda@v1
      with:
        python-version: 3.8
        conda-channels: conda-forge

that makes it easier to use the base env.

if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7'
shell: bash -l {0}
run: |
pre-commit install
Copy link
Collaborator

@ravwojdyla ravwojdyla Sep 17, 2020

Choose a reason for hiding this comment

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

So this is not using cache for pre-commit env anymore? FYI pre-commit/action comes with cache built in

Edit: maybe we should try to get pre-commit/action to work again? what's the problem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here's an example of a run where it failed: https://github.com/tomwhite/sgkit/runs/1121992680?check_suite_focus=true

##[error]Unable to locate executable file: pre-commit. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

pip install -r requirements.txt -r requirements-dev.txt
- name: Run pre-commit
uses: pre-commit/[email protected]
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there no better way to do this than having it repeated in each step?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question!

@jeromekelleher
Copy link
Collaborator

My take would be that it'd be better to write a specific workflow for windows/conda and leave the current Ubuntu workflows as they are. In practise, it never works having complicated stuff work across all three platforms. Having a specific workflow where we just do the bare minimum to make the unit tests work on Windows will make things much easier.

@tomwhite tomwhite marked this pull request as ready for review September 17, 2020 16:20
@tomwhite
Copy link
Collaborator Author

Thanks for all the feedback. Hows does this look now?

@@ -0,0 +1,30 @@
name: Windows build
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want to add this as a badge? I assume so, and if we do, this name will appear on the badge, is this the name we want (maybe just Windows)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Be nice to have the badge.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

on: [push, pull_request]

jobs:
build:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to update mergify config (we might want to rename build to say win_build to avoid collision)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jeromekelleher
Copy link
Collaborator

LGTM - ready to merge?

@tomwhite tomwhite merged commit 379c141 into sgkit-dev:master Sep 21, 2020
@tomwhite tomwhite deleted the windows-ci branch September 21, 2020 08:46
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