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

missing dynamc_matrix for CI #82

Merged
merged 14 commits into from
Nov 25, 2024
52 changes: 52 additions & 0 deletions .github/actions/dynamic_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import sys
import urllib.request
import json
import datetime
# minimal python script that returns a strategy matrix, for given github.event_name


with urllib.request.urlopen('https://endoflife.date/api/python.json') as f:
python_versions = json.loads(f.read().decode('utf-8'))

now = datetime.datetime.now().strftime('%Y-%m-%d')
python_supported_versions = [ v['cycle'] for v in python_versions if v['eol'] > now and v['cycle'] not in ['3.7','3.8','3.12'] ]

python_default_version = python_supported_versions[1]

matrix = {
'default': {
'os': ['ubuntu-latest'],
'python_version': [python_default_version],
},
'pull_request': {
'os': ['ubuntu-latest'],
'python_version': [python_default_version],
},
'schedule': {
'os': ['ubuntu-latest', 'macos-latest', 'windows-latest'],
'python_version': python_supported_versions,
},
'release': {
'os': ['ubuntu-latest', 'macos-latest', 'windows-latest'],
'python_version': python_supported_versions,
},
'pull_request_review': {
'os': ['ubuntu-latest', 'macos-latest', 'windows-latest'],
'python_version': python_supported_versions,
},
'workflow_dispatch': {
'os': ['ubuntu-latest', 'macos-latest', 'windows-latest'],
'python_version': python_supported_versions,
},
}

if __name__ == "__main__":
try:
event = sys.argv[1]
except IndexError:
event = 'default'
if event not in matrix:
event = 'default'

print('::set-output name=os_matrix::%s' % str(matrix[event]['os']))
print('::set-output name=python_version_matrix::%s' % str(matrix[event]['python_version']))
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [main]
branches: [master]
pull_request:
branches: [main]
branches: [master]
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
echo "CONDA_ENV_FILE=ci/requirements/environment.yaml" >> $GITHUB_ENV

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: ${{ env.CONDA_ENV_FILE }}
environment-name: xsarsea-tests
Expand Down
3 changes: 0 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ xsarsea
.. image:: https://img.shields.io/pypi/v/xsarsea.svg
:target: https://pypi.python.org/pypi/xsarsea

.. image:: https://img.shields.io/travis/umr-lops/xsarsea.svg
:target: https://travis-ci.com/umr-lops/xsarsea

.. image:: https://readthedocs.org/projects/xsarsea/badge/?version=latest
:target: https://xsarsea.readthedocs.io/en/latest/?version=latest
:alt: Documentation Status
Expand Down
8 changes: 8 additions & 0 deletions ci/requirements/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ dependencies:
- xarray
- pandas
- aiohttp
- fsspec
- dask
- numba
- opencv
- pyyaml
- matplotlib
- h5netcdf
- scipy
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ dependencies = [
'scipy',
'pyyaml',
'typer',
'dask',
'matplotlib',
'h5netcdf'
]
[project.optional-dependencies]
XSAR = ["xsar"]
Expand Down
6 changes: 4 additions & 2 deletions src/xsarsea/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import aiohttp
import fsspec
import yaml
from importlib_resources import files

try:
from importlib_resources import files
except:
from importlib.resources import files # new syntaxe
logger = logging.getLogger("xsarsea")
logger.addHandler(logging.NullHandler())
mem_monitor = True
Expand Down
5 changes: 4 additions & 1 deletion src/xsarsea/windspeed/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

import numpy as np
import yaml
from importlib_resources import files
try:
from importlib_resources import files
except:
from importlib.resources import files # new syntaxe

logger = logging.getLogger("xsarsea.windspeed")
# logger.addHandler(logging.NullHandler())
Expand Down