Skip to content
Open
Show file tree
Hide file tree
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
38 changes: 27 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test workflows
name: Test

on:
push:
Expand All @@ -18,8 +18,30 @@ concurrency:
cancel-in-progress: true

jobs:
run-tests:
name: OS
unit-tests:
name: Unit
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v6

- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

- name: Run unit tests
run: |
pixi run unit-tests

integration-tests:
name: Integration
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
Expand All @@ -44,7 +66,6 @@ jobs:
- 'data/**'
- 'Snakefile'
- 'config/**'
- 'test/**'
- 'pixi.toml'
- 'pixi.lock'
- '.github/workflows/test.yaml'
Expand All @@ -59,6 +80,7 @@ jobs:
sudo docker builder prune -a --force
echo "Final disk space"
df -h

- name: Skip - no source changes
if: steps.filter.outputs.src != 'true' && github.event_name != 'schedule'
run: echo "Skipping tests because no source code changes detected"
Expand All @@ -69,8 +91,7 @@ jobs:
with:
pixi-version: v0.59.0
cache: true
# Do not cache in branches
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

- name: Setup cache keys
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
Expand Down Expand Up @@ -99,11 +120,6 @@ jobs:
run: |
pixi run integration-tests

- name: Run unit tests
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
run: |
pixi run unit-tests

- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v6
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ gurobi.log
/cutouts
/tmp
doc/_build
_build

/scripts/old
/scripts/create_scenarios.py
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Contributors to PyPSA-Eur <https://github.com/pypsa/pypsa-eur>
#
# SPDX-License-Identifier: CC0-1.0
exclude: "^LICENSES"
exclude: "^LICENSES|^config/schema\\.json$|^config/config\\.default\\.yaml$"

ci:
autoupdate_schedule: quarterly
Expand Down
3 changes: 3 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ from scripts._helpers import (
get_shadow,
path_provider,
)
from scripts.lib.validation.config import validate_config


configfile: "config/config.default.yaml"
Expand All @@ -27,6 +28,8 @@ if Path("config/config.yaml").exists():
configfile: "config/config.yaml"


validate_config(config)

run = config["run"]
scenarios = get_scenarios(run)
RDIR = get_rdir(run)
Expand Down
Loading