parent
a6ac2b4865
commit
6387c46c2e
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
@ -99,7 +99,7 @@ jobs:
|
||||
|
||||
- name: Run snakemake test workflows
|
||||
run: |
|
||||
./test.sh
|
||||
make test
|
||||
|
||||
- name: Upload artifacts
|
||||
if: matrix.os == 'ubuntu' && matrix.inhouse == 'stable-inhouse-deps'
|
||||
|
2
.github/workflows/update-fixed-env.yaml
vendored
2
.github/workflows/update-fixed-env.yaml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
- name: Update environment.fixed.yaml
|
||||
run: |
|
||||
conda env export --name pypsa-eur --no-builds > envs/environment.fixed.yaml
|
||||
conda env export --name pypsa-eur-fixed --no-builds > envs/environment.fixed.yaml
|
||||
|
||||
- name: Add SPDX header
|
||||
run: |
|
||||
|
59
Makefile
Executable file
59
Makefile
Executable file
@ -0,0 +1,59 @@
|
||||
# SPDX-FileCopyrightText: : 2021-2024 The PyPSA-Eur Authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
.PHONY: _conda_check install install-fixed test clean-tests reset
|
||||
|
||||
# Helper: Check if conda or mamba is installed and set CONDA_OR_MAMBA variable
|
||||
_conda_check:
|
||||
@# Check if conda or mamba is installed and set CONDA_OR_MAMBA variable
|
||||
@if command -v conda &> /dev/null; then \
|
||||
echo "Conda detected, using Conda..."; \
|
||||
$(eval CONDA_OR_MAMBA := conda) \
|
||||
elif command -v mamba &> /dev/null; then \
|
||||
echo "Conda not found, but Mamba detected. Using Mamba..."; \
|
||||
$(eval CONDA_OR_MAMBA := mamba) \
|
||||
else \
|
||||
echo "Neither Conda nor Mamba is installed. Please install one of them and retry."; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Install the environment
|
||||
install: _conda_check
|
||||
@$(CONDA_OR_MAMBA) env create -f envs/environment.yaml
|
||||
@$(CONDA_OR_MAMBA) run -n pypsa-eur pre-commit install
|
||||
|
||||
# Install fixed environment
|
||||
install-fixed: _conda_check
|
||||
@$(CONDA_OR_MAMBA) env create -f envs/environment.fixed.yaml
|
||||
@$(CONDA_OR_MAMBA) run -n pypsa-eur pre-commit install
|
||||
|
||||
# Run default tests
|
||||
test:
|
||||
set -e
|
||||
snakemake -call solve_elec_networks --configfile config/test/config.electricity.yaml --rerun-triggers=mtime
|
||||
snakemake -call all --configfile config/test/config.overnight.yaml --rerun-triggers=mtime
|
||||
snakemake -call all --configfile config/test/config.myopic.yaml --rerun-triggers=mtime
|
||||
snakemake -call make_summary_perfect --configfile config/test/config.perfect.yaml --rerun-triggers=mtime
|
||||
snakemake -call all --configfile config/test/config.scenarios.yaml --rerun-triggers=mtime -n
|
||||
echo "All tests completed successfully."
|
||||
|
||||
# Cleans all output files from tests
|
||||
clean-tests:
|
||||
snakemake -call solve_elec_networks --configfile config/test/config.electricity.yaml --rerun-triggers=mtime --delete-all-output
|
||||
snakemake -call all --configfile config/test/config.overnight.yaml --rerun-triggers=mtime --delete-all-output
|
||||
snakemake -call all --configfile config/test/config.myopic.yaml --rerun-triggers=mtime --delete-all-output
|
||||
snakemake -call make_summary_perfect --configfile config/test/config.perfect.yaml --rerun-triggers=mtime --delete-all-output
|
||||
snakemake -call all --configfile config/test/config.scenarios.yaml --rerun-triggers=mtime -n --delete-all-output
|
||||
|
||||
# Removes all created files except for large cutout files (similar to fresh clone)
|
||||
reset:
|
||||
@echo "Do you really wanna continue? This will remove logs, resources, benchmarks, results, and .snakemake directories (y/n): " && \
|
||||
read ans && [ $${ans} = y ] && ( \
|
||||
rm -r ./logs || true; \
|
||||
rm -r ./resources || true; \
|
||||
rm -r ./benchmarks || true; \
|
||||
rm -r ./results || true; \
|
||||
rm -r ./.snakemake || true; \
|
||||
echo "Reset completed." \
|
||||
) || echo "Reset cancelled."
|
@ -1,7 +1,7 @@
|
||||
# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
name: pypsa-eur
|
||||
name: pypsa-eur-fixed
|
||||
channels:
|
||||
- conda-forge
|
||||
- bioconda
|
||||
|
13
test.sh
13
test.sh
@ -1,13 +0,0 @@
|
||||
# SPDX-FileCopyrightText: : 2021-2024 The PyPSA-Eur Authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
set -x && \
|
||||
|
||||
snakemake -call solve_elec_networks --configfile config/test/config.electricity.yaml --rerun-triggers=mtime && \
|
||||
snakemake -call all --configfile config/test/config.overnight.yaml --rerun-triggers=mtime && \
|
||||
snakemake -call all --configfile config/test/config.myopic.yaml --rerun-triggers=mtime && \
|
||||
snakemake -call make_summary_perfect --configfile config/test/config.perfect.yaml --rerun-triggers=mtime && \
|
||||
snakemake -call all --configfile config/test/config.scenarios.yaml --rerun-triggers=mtime -n && \
|
||||
|
||||
set +x
|
Loading…
Reference in New Issue
Block a user