Skip to content

Commit 9586d8f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into merge-upstream-26-01-30
2 parents d7e0c3d + c5d57a7 commit 9586d8f

87 files changed

Lines changed: 18878 additions & 963 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
token: ${{ steps.generate-token.outputs.token }}
6464

6565
- name: Setup Pixi
66-
uses: prefix-dev/setup-pixi@v0.9.3
66+
uses: prefix-dev/setup-pixi@v0.9.4
6767
with:
6868
pixi-version: v0.59.0
6969
cache: true

.github/workflows/test.yaml

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test workflows
1+
name: Test
22

33
on:
44
push:
@@ -17,8 +17,30 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20-
run-tests:
21-
name: OS
20+
unit-tests:
21+
name: Unit
22+
runs-on: ubuntu-latest
23+
24+
defaults:
25+
run:
26+
shell: bash -l {0}
27+
28+
steps:
29+
- uses: actions/checkout@v6
30+
31+
- name: Setup Pixi
32+
uses: prefix-dev/setup-pixi@v0.9.4
33+
with:
34+
pixi-version: v0.59.0
35+
cache: true
36+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
37+
38+
- name: Run unit tests
39+
run: |
40+
pixi run unit-tests
41+
42+
integration-tests:
43+
name: Integration
2244
runs-on: ${{ matrix.os }}-latest
2345
strategy:
2446
fail-fast: false
@@ -43,7 +65,6 @@ jobs:
4365
- 'data/**'
4466
- 'Snakefile'
4567
- 'config/**'
46-
- 'test/**'
4768
- 'pixi.toml'
4869
- 'pixi.lock'
4970
- '.github/workflows/test.yaml'
@@ -58,31 +79,41 @@ jobs:
5879
sudo docker builder prune -a --force
5980
echo "Final disk space"
6081
df -h
82+
6183
- name: Skip - no source changes
6284
if: steps.filter.outputs.src != 'true' && github.event_name != 'schedule'
6385
run: echo "Skipping tests because no source code changes detected"
6486

6587
- name: Setup Pixi
6688
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
67-
uses: prefix-dev/setup-pixi@v0.9.3
89+
uses: prefix-dev/setup-pixi@v0.9.4
6890
with:
6991
pixi-version: v0.59.0
7092
cache: true
71-
# Do not cache in branches
72-
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
93+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
7394

7495
- name: Setup cache keys
7596
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
7697
run: |
77-
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
98+
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data
99+
echo "MONTH=$(date +'%Y%m')" >> $GITHUB_ENV # cutouts
100+
echo "VERSIONS_HASH=${{ hashFiles('data/versions.csv') }}" >> $GITHUB_ENV
78101
79102
- uses: actions/cache@v5
80103
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
81104
with:
82-
path: |
83-
data
84-
cutouts
85-
key: data-cutouts-${{ env.WEEK }}
105+
path: data
106+
key: data-${{ env.WEEK }}-${{ env.VERSIONS_HASH }}
107+
108+
- uses: actions/cache@v5
109+
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
110+
with:
111+
path: cutouts
112+
key: cutouts-${{ env.MONTH }}
113+
114+
- name: Restore git-tracked files in data/
115+
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
116+
run: git checkout HEAD -- data/
86117

87118
- name: Run pylint check on scripts
88119
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
@@ -98,11 +129,6 @@ jobs:
98129
run: |
99130
pixi run integration-tests
100131
101-
- name: Run unit tests
102-
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
103-
run: |
104-
pixi run unit-tests
105-
106132
- name: Upload artifacts
107133
if: always()
108134
uses: actions/upload-artifact@v6

.github/workflows/update-lockfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v6
2020

2121
- name: Setup Pixi
22-
uses: prefix-dev/setup-pixi@v0.9.3
22+
uses: prefix-dev/setup-pixi@v0.9.4
2323
with:
2424
pixi-version: v0.59.0
2525

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ gurobi.log
3131
/cutouts
3232
/tmp
3333
doc/_build
34+
_build
3435

3536
/scripts/old
3637
/scripts/create_scenarios.py
@@ -65,6 +66,8 @@ d1gam3xoknrgr2.cloudfront.net/
6566

6667
*~
6768

69+
*.egg-info
70+
6871
*.pyc
6972

7073
*.xlsx

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# SPDX-FileCopyrightText: Contributors to PyPSA-Eur <https://github.com/pypsa/pypsa-eur>
22
#
33
# SPDX-License-Identifier: CC0-1.0
4-
5-
exclude: "^LICENSES"
4+
exclude: "^LICENSES|^config/schema\\.json$|^config/config\\.default\\.yaml$"
65

76
ci:
87
autoupdate_schedule: quarterly

Snakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import yaml
77
import sys
88
from os.path import normpath, exists, join
99
from shutil import copyfile, move, rmtree, unpack_archive
10+
from dotenv import load_dotenv
1011
from snakemake.utils import min_version
1112

13+
load_dotenv()
14+
1215
min_version("8.11")
1316

1417
from scripts._helpers import (
@@ -17,13 +20,16 @@ from scripts._helpers import (
1720
get_shadow,
1821
path_provider,
1922
)
23+
from scripts.lib.validation.config import validate_config
2024

2125

2226
configfile: "config/config.default.yaml"
2327
configfile: "config/plotting.default.yaml"
2428
configfile: "config/config.de.yaml"
2529

2630

31+
validate_config(config)
32+
2733
run = config["run"]
2834
scenarios = get_scenarios(run)
2935
RDIR = get_rdir(run)

0 commit comments

Comments
 (0)