Skip to content

Commit

Permalink
Add CI for windows (#384)
Browse files Browse the repository at this point in the history
Also: ``copy_X = False`` will now raise a value error when ``X`` has dtype ``int32`` or ``int64``. Previously, it would only raise for dtype ``int64``.
  • Loading branch information
jtilly authored Jun 25, 2021
1 parent fdf378f commit 025790a
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 5 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/tests-win-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI
on:
push:
branches:
- master
jobs:
windows-ci:
name: "Win - tests - Python ${{ matrix.PYTHON_VERSION }}"
runs-on: windows-latest
env:
CI: True
***REMOVED***: ${{ secrets.***REMOVED*** }}
***REMOVED***: ${{ secrets.***REMOVED*** }}
strategy:
fail-fast: true
matrix:
PYTHON_VERSION: ['3.7']
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout branch
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
- name: Create .condarc
shell: pwsh
run: |
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
- uses: conda-incubator/setup-miniconda@723ab12c1d66bb893c5ac701f8e387f00b24549e
with:
python-version: ${{ matrix.PYTHON_VERSION }}
miniforge-variant: Mambaforge
miniforge-version: 4.10.0-0
use-mamba: true
condarc-file: .github/workflows/.condarc
environment-file: environment-win.yml
activate-environment: quantcore.glm
- name: Run Unit Tests
shell: pwsh
run: |
python -m pip install -e . --no-deps -vv --no-use-pep517 --disable-pip-version-check
pytest tests --doctest-modules src/
47 changes: 47 additions & 0 deletions .github/workflows/tests-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI
on:
push:
paths:
- '.github/**'
- '**/*.pyx'
- '**/*.cpp'
jobs:
windows-ci:
name: "Win - tests - Python ${{ matrix.PYTHON_VERSION }}"
runs-on: windows-latest
env:
CI: True
***REMOVED***: ${{ secrets.***REMOVED*** }}
***REMOVED***: ${{ secrets.***REMOVED*** }}
strategy:
fail-fast: true
matrix:
PYTHON_VERSION: ['3.7']
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout branch
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
- name: Create .condarc
shell: pwsh
run: |
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
((Get-Content -path .github/workflows/.condarc) -replace '***REMOVED***', '${{ secrets.***REMOVED*** }}') | Set-Content .github/workflows/.condarc
- uses: conda-incubator/setup-miniconda@723ab12c1d66bb893c5ac701f8e387f00b24549e
with:
python-version: ${{ matrix.PYTHON_VERSION }}
miniforge-variant: Mambaforge
miniforge-version: 4.10.0-0
use-mamba: true
condarc-file: .github/workflows/.condarc
environment-file: environment-win.yml
activate-environment: quantcore.glm
- name: Run Unit Tests
shell: pwsh
run: |
python -m pip install -e . --no-deps -vv --no-use-pep517 --disable-pip-version-check
pytest tests --doctest-modules src/
7 changes: 5 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
Changelog
=========

Unreleased
----------
1.4.3 - 2021-06-25
------------------

**Bug fix:**

- ``copy_X = False`` will now raise a value error when ``X`` has dtype ``int32`` or ``int64``. Previously, it would only raise for dtype ``int64``.

1.4.2 - 2021-06-15
------------------
Expand Down
51 changes: 51 additions & 0 deletions environment-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: quantcore.glm
channels:
- ***REMOVED***
- conda-forge
- nodefaults
dependencies:
- altair
- black
- c-compiler
- cxx-compiler
- cython
- dask-ml
- flake8
- git_root
- h2o-py
- ipdb
- ipython
- jinja2==2.11.3
- johnlees-glmnet_python
- jupyterlab
- jupytext
- libblas>=0=*mkl
- libpysal
- line_profiler
- make
- mako
- memory_profiler
- mkl-include
- nbclassic=0.2.7
- nbsphinx=0.8.3
- numexpr
- openjdk
- openml
- pandas
- pip
- pre-commit
- pyarrow
- pyshp
- pytest
- pytest-xdist
- quantcore.matrix>=2.0.1
- rpy2
- scikit-learn
- setuptools_scm
- shapely
- sparse_dot_mkl>=0.5.3
- sphinx=3.5.3
- sphinx_rtd_theme
- sphinxcontrib-apidoc
- tqdm
- xsimd
2 changes: 1 addition & 1 deletion src/quantcore/glm/_glm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ def set_up_and_check_fit_args(
if (
not isinstance(X, mx.CategoricalMatrix)
and hasattr(X, "dtype")
and X.dtype == np.int64 # type: ignore
and np.issubdtype(X.dtype, np.integer) # type: ignore
):
if self.copy_X is not None and not self.copy_X:
raise ValueError(
Expand Down
2 changes: 0 additions & 2 deletions tests/glm/test_glm.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,6 @@ def test_glm_identity_regression_categorical_data(solver, offset, convert_x_fn):
np.testing.assert_almost_equal(X.A if hasattr(X, "A") else X, x_mat)
res = glm.fit(X, y, offset=offset)

fit_coef = res.coef_
assert fit_coef.dtype.itemsize == X.dtype.itemsize
assert_allclose(res.coef_, coef, rtol=1e-6)


Expand Down

0 comments on commit 025790a

Please sign in to comment.