Skip to content

Commit

Permalink
Merge branch 'main' into vinc_dev_streaks
Browse files Browse the repository at this point in the history
  • Loading branch information
vincelhx authored Nov 11, 2024
2 parents dbabb65 + 60355c5 commit 53c1a72
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 23 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Upload Conda Package

on:
release:
types:
- created

jobs:
build-and-upload-conda-package:
if: true
runs-on: ubuntu-latest
#${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.9

- name: Install conda-build
run: |
conda init
source ~/.bashrc
conda activate base
conda install -y -c conda-forge conda-build anaconda-client
- name: Build and Upload Conda package
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
cd recipe
conda init
source ~/.bashrc
conda activate base
conda-build . --token $ANACONDA_TOKEN --user tcevaer -c tcevaer -c conda-forge
50 changes: 27 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,65 +15,69 @@ jobs:

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: "1.5.9-1" # any version from https://github.com/mamba-org/micromamba-releases
channels: tcevaer, conda-forge, defaults
channels: tcevaer, conda-forge
init-shell: bash
post-cleanup: "all"

- name: Configure Conda channel priority to disabled
run: |
conda config --set channel_priority disabled
- name: Create environment and install tools
run: micromamba create -n grdwind_env pytest conda-build boa python=3.10 -y -c tcevaer -c conda-forge
run: micromamba create -n grdwind_env pytest conda-build boa python=3.10 -y

- name: Build package
run: |
cd recipe
eval "$(micromamba shell hook --shell bash)"
micromamba activate grdwind_env
conda mambabuild . -c tcevaer -c conda-forge
conda mambabuild .
# Install the built package into the environment
- name: Install the built package
run: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate grdwind_env
conda install --use-local grdwindinversion -y -c tcevaer -c conda-forge
conda install --use-local grdwindinversion -y
# Cache the test data if previously downloaded (up to 10 GB limit for the cache)
# WARNING : modify the key if the data is modified !!
- name: Cache test data
uses: actions/cache@v4
id: cache
with:
path: ./test_data
key: test-data-v3
restore-keys: test-data-v3
- name: Cache test data
uses: actions/cache@v4
id: cache
with:
path: ./test_data
key: test-data-v3
restore-keys: test-data-v3

# Download test data if not already cached
- name: Download test data
if: steps.cache.outputs.cache-hit != 'true' # Only download if cache miss
run: |
- name: Download test data
if: steps.cache.outputs.cache-hit != 'true' # Only download if cache miss
run: |
mkdir -p ./test_data/
wget https://cloud.ifremer.fr/index.php/s/ExLQ2TnYAqozPWE/download -O /tmp/ecmwf.zip
unzip /tmp/ecmwf.zip -d ./test_data/
wget https://cloud.ifremer.fr/index.php/s/kRgdOOPsjoZieZR/download -O /tmp/l1.zip
unzip /tmp/l1.zip -d ./test_data/
timeout-minutes: 200 # Adjust depending on the size of your data
timeout-minutes: 200 # Adjust depending on the size of your data

# Set up xsar configuration
- name: Setup xsar configuration
run: |
- name: Setup xsar configuration
run: |
mkdir -p ~/.xsar
echo "data_dir: /tmp" > ~/.xsar/config.yaml
echo "auxiliary_dir: ./test_data/auxiliary" >> ~/.xsar/config.yaml
echo "path_dataframe_aux: ./test_data/auxiliary/active_aux.csv" >> ~/.xsar/config.yaml
# Set up grdwindinversion configuration
- name: Setup grdwindinversion configuration
run: |
- name: Setup grdwindinversion configuration
run: |
mkdir -p ~/.grdwindinversion
echo "'ecmwf_0100_1h': ./test_data/ECMWF/forecast/hourly/0100deg/netcdf_light/%Y/%j/ECMWF_FORECAST_0100_%Y%m%d%H%M_10U_10V.nc" > ~/.grdwindinversion/data_config.yaml
echo "'ecmwf_0125_1h': ./test_data/ECMWF/0.125deg/1h/forecasts/%Y/%j/ecmwf_%Y%m%d%H%M.nc" >> ~/.grdwindinversion/data_config.yaml
Expand All @@ -82,8 +86,8 @@ jobs:
#echo "'lut_ms1ahw_path': './test_data/GMFS/v1.6/GMF_cmodms1ahw'" >> ~/.grdwindinversion/data_config.yaml
# Run the tests
- name: Run tests
run: |
- name: Run tests
run: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate grdwind_env
pytest
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ dependencies = [
"scipy",
"fsspec",
"aiohttp",
"xarray-safe-s1",
"xradarsat2",
"xarray-safe-rcm"
]

dynamic = ["version"]
Expand Down

0 comments on commit 53c1a72

Please sign in to comment.