Skip to content

Commit

Permalink
lint and updating test.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
kthyng committed Oct 12, 2023
1 parent bcfbde5 commit a07d9e3
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 137 deletions.
92 changes: 57 additions & 35 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,73 @@ jobs:
with:
fetch-depth: 0

- name: Cache Linux/macOS (x86) Conda environment
if: ${{ runner.os != 'Windows' }}
uses: actions/cache@v3
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}
# - name: Cache Linux/macOS (x86) Conda environment
# if: ${{ runner.os != 'Windows' }}
# uses: actions/cache@v3
# env:
# # Increase this value to reset cache if ci/environment.yml has not changed
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}

- name: Cache Windows Conda environment
if: ${{ runner.os == 'Windows' }}
uses: actions/cache@v3
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}-win.yml') }}
# - name: Cache Windows Conda environment
# if: ${{ runner.os == 'Windows' }}
# uses: actions/cache@v3
# env:
# # Increase this value to reset cache if ci/environment.yml has not changed
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}-win.yml') }}

- name: Build and activate Linux/macOS Conda environment
- name: Setup Linux/macOS Micromamba Python ${{ matrix.python-version }}
if: ${{ runner.os != 'Windows' }}
uses: conda-incubator/setup-miniconda@v2
uses: mamba-org/setup-micromamba@v1
with:
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
channels: conda-forge, defaults # These need to be specified to use mamba
channel-priority: true
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} --channel conda-forge
environment-file: ci/environment-py${{ matrix.python-version }}.yml
cache-environment: true
post-cleanup: 'all'

activate-environment: test-env-mac-unix
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!

- name: Build and activate Windows Conda environment
- name: Setup Windows Micromamba Python ${{ matrix.python-version }}
if: ${{ runner.os == 'Windows' }}
uses: conda-incubator/setup-miniconda@v2
uses: mamba-org/setup-micromamba@v1
with:
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
channels: conda-forge, defaults # These need to be specified to use mamba
channel-priority: true
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} --channel conda-forge
environment-file: ci/environment-py${{ matrix.python-version }}-win.yml
cache-environment: true
post-cleanup: 'all'

# - name: Build and activate Linux/macOS Conda environment
# if: ${{ runner.os != 'Windows' }}
# uses: conda-incubator/setup-miniconda@v2
# with:
# miniforge-variant: Mambaforge
# python-version: ${{ matrix.python-version }}
# channels: conda-forge, defaults # These need to be specified to use mamba
# channel-priority: true
# environment-file: ci/environment-py${{ matrix.python-version }}.yml

# activate-environment: test-env-mac-unix
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!

# - name: Build and activate Windows Conda environment
# if: ${{ runner.os == 'Windows' }}
# uses: conda-incubator/setup-miniconda@v2
# with:
# miniforge-variant: Mambaforge
# python-version: ${{ matrix.python-version }}
# channels: conda-forge, defaults # These need to be specified to use mamba
# channel-priority: true
# environment-file: ci/environment-py${{ matrix.python-version }}-win.yml

activate-environment: test-env-win
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
# activate-environment: test-env-win
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!

- name: Install package in environment
shell: bash -l {0}
Expand Down
9 changes: 1 addition & 8 deletions tests/make_test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ def make_test_datasets():
}
)
dds["profile"] = df



## surface drifter ##
example_loc1 = ds.sel(eta_rho=20, xi_rho=10).isel(s_rho=-1)
Expand All @@ -69,9 +67,7 @@ def make_test_datasets():
)
npts = len(times)

lons = np.linspace(
float(example_loc1.lon_rho), float(example_loc2.lon_rho), npts
)
lons = np.linspace(float(example_loc1.lon_rho), float(example_loc2.lon_rho), npts)
lats = [float(example_loc1.lat_rho)] * npts
depths = [0] * npts

Expand All @@ -95,7 +91,6 @@ def make_test_datasets():
df["salinity"] = salt
dds["trajectory"] = df


## CTD transect ##
example_loc1 = ds.sel(eta_rho=20, xi_rho=10)
example_loc2 = ds.sel(eta_rho=20, xi_rho=15)
Expand Down Expand Up @@ -214,8 +209,6 @@ def make_test_datasets():
dsd["salt"] = (("date_time", "depths"), salt.T)
dds["timeSeriesProfile"] = dsd



# HF Radar
example_area = ds.sel(eta_rho=slice(20, 25), xi_rho=slice(10, 15)).isel(
ocean_time=0, s_rho=-1
Expand Down
Loading

0 comments on commit a07d9e3

Please sign in to comment.