Skip to content
Merged
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
53 changes: 27 additions & 26 deletions .github/workflows/test-models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
branches:
- master
pull_request:
branches:
- master
branches: ["*"]
schedule:
- cron: "0 5 * * *"

Expand All @@ -24,7 +23,7 @@ jobs:
matrix:
version:
- master
# - latest # Activate when v0.14.0 is released
# - latest

defaults:
run:
Expand All @@ -43,11 +42,23 @@ jobs:
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $latest_tag

- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.68.1
cache: true
# Do not cache in branches
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

- name: Setup cache keys
run: |
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts

# Only run check if package is not pinned
- name: Check if inhouse package is pinned
- name: Check if linopy package is pinned
run: |
grep_line=$(grep -- '- pypsa' envs/environment.yaml)
if [[ $grep_line == *"<"* || $grep_line == *"=="* ]]; then
grep_line=$(grep -- '${{ github.event.repository.name }} = ' pixi.toml)
if [[ $grep_line == *"<* || $grep_line == *"==* ]]; then

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this breaking the pin detection? Why remove the "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's checking the pixi toml, and deps are defined differently there:

linopy = ">=0.6.1"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the bash script is broken and fails silently. > needs quoting and the quote is not part of the string:

for v in ">=0.6.1" "<0.6.1" "==0.6.1"; do
    grep_line="linopy = \"$v\""

    # current
    if [[ $grep_line == *"<* || $grep_line == *"==* ]]; then
      cur="PINNED"; else cur="unpinned"
    fi

    # fixed
    if [[ $grep_line == *"<"* || $grep_line == *"=="* ]]; then
      fix="PINNED"; else fix="unpinned"
    fi

    printf '%-22s  current=%-8s  fixed=%s\n' "$grep_line" "$cur" "$fix"
  done

linopy = ">=0.6.1" current=unpinned fixed=unpinned
linopy = "<0.6.1" current=unpinned fixed=PINNED
linopy = "==0.6.1" current=unpinned fixed=PINNED

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brynpickering, this is resolved?

@FabianHofmann FabianHofmann Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway I merge the pr now as it is for sure improving

echo "pinned=true" >> $GITHUB_ENV
else
echo "pinned=false" >> $GITHUB_ENV
Expand All @@ -67,37 +78,23 @@ jobs:
cutouts
key: data-cutouts-${{ env.week }}

- uses: conda-incubator/setup-miniconda@v4
if: env.pinned == 'false'
with:
activate-environment: pypsa-eur

- name: Cache Conda env
if: env.pinned == 'false'
uses: actions/cache@v5
with:
path: ${{ env.CONDA }}/envs
key: conda-pypsa-eur-${{ env.week }}-${{ hashFiles('envs/linux-64.lock.yaml') }}
id: cache-env

- name: Update environment
if: env.pinned == 'false' && steps.cache-env.outputs.cache-hit != 'true'
run: conda env update -n pypsa-eur -f envs/linux-64.lock.yaml

- name: Install package from ref
if: env.pinned == 'false'
run: |
python -m pip install git+https://github.com/${{ github.repository }}@${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
pixi remove pypsa
pixi remove linopy
pixi add --pypi --git https://github.com/${{ github.repository }}.git ${{ github.event.repository.name }} --rev ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
pixi add --pypi pypsa

- name: Run snakemake test workflows
if: env.pinned == 'false'
run: |
make test
pixi run integration-tests

- name: Run unit tests
if: env.pinned == 'false'
run: |
make unit-test
pixi run unit-tests

- name: Upload artifacts
if: env.pinned == 'false'
Expand All @@ -109,3 +106,7 @@ jobs:
.snakemake/log
results
retention-days: 3

- name: Show remaining disk space
if: always()
run: df -h
Loading