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

ci: run tests on windows #557

Merged
merged 5 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
# On macos, the up-to-date git may not be first on the path
# N.B. setting includes a final ":", to simplify the path setting command
gitpath-prepend: "/opt/homebrew/bin:"
- os: windows-latest
version: py313
platform: win
steps:
- name: "Checkout"
uses: actions/checkout@v4
Expand Down Expand Up @@ -105,6 +108,21 @@ jobs:
path: ${{ github.workspace }}/.tox
key: ${{ runner.os }}-tox-${{ env.ENV_NAME }}-${{ matrix.version }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.TOX_INI) }}

# setuptools can't find shared library installed by conda on windows
# so we need to prepare environment variables for it
- name: Export environment variables for UDUNITS2 lookup
if: runner.os == 'Windows'
uses: actions/github-script@v7
with:
script: |
const path = require('path')

const base = path.join('.tox/${{ matrix.version }}-${{ matrix.platform }}-test')

core.exportVariable('UDUNITS2_INCDIR', path.join(base, 'Library/include/'));
core.exportVariable('UDUNITS2_LIBDIR', path.join(base, 'Library/lib/'));
core.exportVariable('UDUNITS2_XML_PATH', path.join(base, 'Library/share/udunits/udunits2.xml'));

- name: "Run ${{ matrix.os }} on ${{ matrix.version}} tests"
run: |
export PATH=${{ matrix.gitpath-prepend }}$PATH
Expand Down
2 changes: 1 addition & 1 deletion cf_units/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_license_headers(self):
and full_fname.is_file()
and not any(fnmatch(fname, pat) for pat in exclude_patterns)
):
with open(full_fname) as fh:
with open(full_fname, encoding="utf-8") as fh:
content = fh.read()
if not content.startswith(LICENSE_TEMPLATE):
print(
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ conda_deps =
description =
Create explicit environment specification conda lock files for cf-units dependencies.
platform =
linux|darwin
linux|darwin|win32
setenv =
LOCKDIR = {toxinidir}{/}requirements{/}locks
TMPFILE = {envtmpdir}{/}cf-units.yml
Expand Down Expand Up @@ -50,6 +50,9 @@ description =
Perform cf-units unit/integration tests.
passenv =
CYTHON_COVERAGE
UDUNITS2_INCDIR
UDUNITS2_LIBDIR
UDUNITS2_XML_PATH
usedevelop =
true
commands =
Expand Down
Loading