Skip to content

Commit d8d52b4

Browse files
lkstrpbrynpickeringFabianHofmann
authored
ci: fix model runs (#522)
* ci: fix model runs * Also reinstall PyPSA Removed PACKAGE_NAME environment variable and adjusted package removal commands. * Update pixi command to add pypsa with pypi option * Update pixi (+action) version * Remove unnecessary conda env install steps --------- Co-authored-by: Bryn Pickering <17178478+brynpickering@users.noreply.github.com> Co-authored-by: Fabian Hofmann <fab.hof@gmx.de>
1 parent 3f824cc commit d8d52b4

1 file changed

Lines changed: 27 additions & 26 deletions

File tree

.github/workflows/test-models.yml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ on:
55
branches:
66
- master
77
pull_request:
8-
branches:
9-
- master
8+
branches: ["*"]
109
schedule:
1110
- cron: "0 5 * * *"
1211

@@ -24,7 +23,7 @@ jobs:
2423
matrix:
2524
version:
2625
- master
27-
# - latest # Activate when v0.14.0 is released
26+
# - latest
2827

2928
defaults:
3029
run:
@@ -43,11 +42,23 @@ jobs:
4342
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
4443
git checkout $latest_tag
4544
45+
- name: Setup Pixi
46+
uses: prefix-dev/setup-pixi@v0.9.6
47+
with:
48+
pixi-version: v0.68.1
49+
cache: true
50+
# Do not cache in branches
51+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
52+
53+
- name: Setup cache keys
54+
run: |
55+
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
56+
4657
# Only run check if package is not pinned
47-
- name: Check if inhouse package is pinned
58+
- name: Check if linopy package is pinned
4859
run: |
49-
grep_line=$(grep -- '- pypsa' envs/environment.yaml)
50-
if [[ $grep_line == *"<"* || $grep_line == *"=="* ]]; then
60+
grep_line=$(grep -- '${{ github.event.repository.name }} = ' pixi.toml)
61+
if [[ $grep_line == *"<* || $grep_line == *"==* ]]; then
5162
echo "pinned=true" >> $GITHUB_ENV
5263
else
5364
echo "pinned=false" >> $GITHUB_ENV
@@ -67,37 +78,23 @@ jobs:
6778
cutouts
6879
key: data-cutouts-${{ env.week }}
6980

70-
- uses: conda-incubator/setup-miniconda@v4
71-
if: env.pinned == 'false'
72-
with:
73-
activate-environment: pypsa-eur
74-
75-
- name: Cache Conda env
76-
if: env.pinned == 'false'
77-
uses: actions/cache@v5
78-
with:
79-
path: ${{ env.CONDA }}/envs
80-
key: conda-pypsa-eur-${{ env.week }}-${{ hashFiles('envs/linux-64.lock.yaml') }}
81-
id: cache-env
82-
83-
- name: Update environment
84-
if: env.pinned == 'false' && steps.cache-env.outputs.cache-hit != 'true'
85-
run: conda env update -n pypsa-eur -f envs/linux-64.lock.yaml
86-
8781
- name: Install package from ref
8882
if: env.pinned == 'false'
8983
run: |
90-
python -m pip install git+https://github.com/${{ github.repository }}@${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
84+
pixi remove pypsa
85+
pixi remove linopy
86+
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 }}
87+
pixi add --pypi pypsa
9188
9289
- name: Run snakemake test workflows
9390
if: env.pinned == 'false'
9491
run: |
95-
make test
92+
pixi run integration-tests
9693
9794
- name: Run unit tests
9895
if: env.pinned == 'false'
9996
run: |
100-
make unit-test
97+
pixi run unit-tests
10198
10299
- name: Upload artifacts
103100
if: env.pinned == 'false'
@@ -109,3 +106,7 @@ jobs:
109106
.snakemake/log
110107
results
111108
retention-days: 3
109+
110+
- name: Show remaining disk space
111+
if: always()
112+
run: df -h

0 commit comments

Comments
 (0)