Skip to content

Commit

Permalink
Update to pixi (#149)
Browse files Browse the repository at this point in the history
* Update to pixi

* Update

* Fix build and docker

* Fix docker

* Dumb fix

* Docs fix

* Fix docs packages

* Fix docs packages

* Quarto fix

* Fix shell hook

* Update publish workflow

* Add pixi command
  • Loading branch information
dalmijn authored Jan 23, 2025
1 parent 4174613 commit 6710798
Show file tree
Hide file tree
Showing 15 changed files with 680 additions and 1,312 deletions.
15 changes: 9 additions & 6 deletions .build/hook-fiat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
root_path = sys.prefix

if is_conda and Version(gdal_version) >= Version("3.9.1"):
plugin = distribution("libgdal-netcdf")
try:
plugin = distribution("libgdal-netcdf")

# Look for all the plugins
plugin_dir = Path(root_path, plugin.files[0].parent)
all_plugins = glob.glob(Path(plugin_dir, "*").as_posix())
# Look for all the plugins
plugin_dir = Path(root_path, plugin.files[0].parent)
all_plugins = glob.glob(Path(plugin_dir, "*").as_posix())

# Append the data
datas += list(map(lambda path: (path, "./gdalplugins"), all_plugins))
# Append the data
datas += list(map(lambda path: (path, "./gdalplugins"), all_plugins))
except BaseException:
logger.warning("NetCDF plugin for gdal not found.")

# Sort out the proj database
src_proj = None
Expand Down
5 changes: 3 additions & 2 deletions .build/linux64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SCRIPTPATH=$(dirname "$SCRIPT")
PROJECTPATH=$(dirname "$SCRIPTPATH")
PIXIPATH=$PROJECTPATH/.pixi

bin_var=conda
bin_var=pixi
shell_var=bash

# Help message
Expand Down Expand Up @@ -80,7 +80,8 @@ if [ $bin_var == "conda" ]; then
conda activate fiat_build
export PROJ_LIB=$bin_dir/envs/fiat_build/share/proj
elif [ $bin_var == "pixi" ]; then
eval $(pixi shell-hook --manifest-path $PROJECTPATH/pixi.toml -s $shell_var -e build)
pixi shell-hook --manifest-path $PROJECTPATH/pyproject.toml -s $shell_var -e build-linux > $PROJECTPATH/pixi-hook.rc
source $PROJECTPATH/pixi-hook.rc
export PROJ_LIB=$PIXIPATH/envs/build/share/proj
fi

Expand Down
3 changes: 1 addition & 2 deletions .build/win64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ REM set the current directory of the batch file
set CUR_DIR=%~dp0

REM Execute building
call activate fiat_build
pyinstaller "%CUR_DIR%/build.spec" --distpath %CUR_DIR%../bin --workpath %CUR_DIR%../bin/intermediates
pixi run -e build-win pyinstaller "%CUR_DIR%/build.spec" --distpath %CUR_DIR%../bin --workpath %CUR_DIR%../bin/intermediates

pause
46 changes: 11 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,29 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.12"]
include:
- os: ubuntu-latest
label: linux-64
prefix: /home/runner/miniconda3/envs/fiat_test

name: ${{ matrix.os }} - py${{ matrix.python-version }}
name: ${{ matrix.os }} - build
runs-on: ${{ matrix.os }}

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

- name: Generate env yaml
run: |
pip install tomli
python make_env.py build
- name: Load cache
id: cache
uses: actions/cache/restore@v4
- name: Setup pixi env
uses: prefix-dev/[email protected]
with:
path: |
/home/runner/miniconda3
~/pycache
# the below two settings mean we'll alway srestore the cache
# but the cache hit output can tell us if we have to update afterwards
key: build-${{ hashFiles('environment.yml') }}
restore-keys: |
build
- name: Cache failed
if: steps.cache.outputs.cache-matched-key == ''
run: |
echo "Failed to restore any cache. exiting..."
exit 1
pixi-version: "v0.40.3"
environments: build-linux
locked: false
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

- name: Update environment
if: steps.cache.outputs.cache-hit != 'true'
- name: Install fiat
run: |
export PATH=/home/runner/miniconda3/bin:$PATH
mamba env update -n fiat_build -f environment.yml
pixi run -e build-linux install-fiat
- name: Build FIAT
run: |
Expand All @@ -77,12 +58,7 @@ jobs:
- name: Create Testdata
run: |
export PATH=/home/runner/miniconda3/bin:$PATH
source /home/runner/miniconda3/etc/profile.d/conda.sh
conda activate fiat_build
pip install tomli-w
python .testdata/create_test_data.py
conda deactivate
pixi run -e build-linux generate-data
- name: Test Binary
run: ./bin/Release/fiat run .testdata/geom_event.toml
204 changes: 0 additions & 204 deletions .github/workflows/cache.yml

This file was deleted.

7 changes: 3 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ jobs:
uses: addnab/docker-run-action@v3
with:
username: deltares
options: -v ${{ github.workspace }}/.testdata:/home/deltares/data
options: -v ${{ github.workspace }}/.testdata:/home/deltares/.testdata
shell: bash
image: fiat:latest
run: |
pixi run python -m pip install tomli-w
pixi run python data/create_test_data.py
pixi run fiat run data/geom_event.toml
pixi run generate-data
pixi run fiat run .testdata/geom_event.toml
exit
Loading

0 comments on commit 6710798

Please sign in to comment.