Skip to content

Commit

Permalink
Revert "Merge pull request pypsa-meets-earth#1086 from merge-pyspa-ea…
Browse files Browse the repository at this point in the history
…rth-sec"

This reverts commit a898746.
  • Loading branch information
ekatef committed Oct 11, 2024
1 parent b64623d commit a1496a7
Show file tree
Hide file tree
Showing 118 changed files with 1,813 additions and 16,402 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/ci-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI-linux

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 5 * * TUE"

env:
CACHE_NUMBER: 1 # Change this value to manually reset the environment cache

jobs:
build:
strategy:
fail-fast: false # don't break CI for ubuntu if windows fails before
matrix:
include:
# Matrix required to handle environment caching with Mambaforge
- os: ubuntu-latest
label: ubuntu-latest
prefix: /usr/share/miniconda3/envs/pypsa-earth

name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}

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

steps:
- uses: actions/checkout@v2

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: pypsa-earth
use-mamba: true

- name: Create environment cache
uses: actions/cache@v2
id: cache
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('envs/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}

- name: Update environment due to outdated or unavailable cache
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n pypsa-earth -f envs/environment.yaml

- name: Conda list
run: |
conda list
- name: Create test configs
run: |
snakemake --cores all build_test_configs
- name: Test tutorial workflow
run: |
cp test/tmp/config.tutorial_noprogress_tmp.yaml config.yaml
snakemake --cores all solve_all_networks --forceall
- name: Test custom workflow
run: |
mkdir -p configs/scenarios
cp test/config.custom.yaml configs/scenarios/config.custom.yaml
snakemake --cores 1 run_all_scenarios --forceall
- name: Test monte-carlo workflow
run: |
cp test/tmp/config.monte_carlo_tmp.yaml config.yaml
snakemake --cores all solve_all_networks_monte --forceall
- name: Test landlock workflow
run: |
cp test/tmp/config.landlock_tmp.yaml config.yaml
snakemake --cores all solve_all_networks --forceall
# - name: Test plotting and summaries
# run: |
# snakemake --cores all plot_all_p_nom
# snakemake --cores all plot_all_summaries
# snakemake --cores all make_all_summaries
# rm -rf resources/*.nc resources/*.geojson resources/*.h5 networks results
76 changes: 76 additions & 0 deletions .github/workflows/ci-mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI-mac

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 5 * * TUE"

env:
CACHE_NUMBER: 1 # Change this value to manually reset the environment cache

jobs:
build:
strategy:
matrix:
include:
- os: macos-latest
label: macos-latest
prefix: /Users/runner/miniconda3/envs/pypsa-earth

name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}

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

steps:
- uses: actions/checkout@v2

# - name: Add solver to environment
# run: |
# echo -e "- glpk\n- ipopt<3.13.3" >> envs/environment.yaml

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: pypsa-earth
use-mamba: true

- name: Create environment cache
uses: actions/cache@v2
id: cache
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('envs/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}

- name: Update environment due to outdated or unavailable cache
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n pypsa-earth -f envs/environment.yaml

- name: Conda list
run: |
conda list
- name: Create test configs
run: |
snakemake --cores all build_test_configs
- name: Test tutorial workflow
run: |
cp test/tmp/config.tutorial_noprogress_tmp.yaml config.yaml
snakemake --cores all solve_all_networks
# - name: Test plotting and summaries
# run: |
# snakemake --cores all plot_all_p_nom
# snakemake --cores all plot_all_summaries
# snakemake --cores all make_all_summaries
# rm -rf resources/*.nc resources/*.geojson resources/*.h5 networks results
76 changes: 76 additions & 0 deletions .github/workflows/ci-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI-windows

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 5 * * TUE"

env:
CACHE_NUMBER: 1 # Change this value to manually reset the environment cache

jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
label: windows-latest
prefix: C:\Miniconda3\envs\pypsa-earth

name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}

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

steps:
- uses: actions/checkout@v2

# - name: Add solver to environment
# run: |
# echo -e "- glpk\n- ipopt<3.13.3" >> envs/environment.yaml

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: pypsa-earth
use-mamba: true

- name: Create environment cache
uses: actions/cache@v2
id: cache
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('envs/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}

- name: Update environment due to outdated or unavailable cache
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n pypsa-earth -f envs/environment.yaml

- name: Conda list
run: |
conda list
- name: Create test configs
run: |
snakemake --cores all build_test_configs
- name: Test tutorial workflow
run: |
cp test/tmp/config.tutorial_noprogress_tmp.yaml config.yaml
snakemake --cores all solve_all_networks
# - name: Test plotting and summaries
# run: |
# snakemake --cores all plot_all_p_nom
# snakemake --cores all plot_all_summaries
# snakemake --cores all make_all_summaries
# rm -rf resources/*.nc resources/*.geojson resources/*.h5 networks results
72 changes: 0 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,72 +0,0 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 5 * * TUE"

env:
CACHE_NUMBER: 2 # Change this value to manually reset the environment cache

jobs:
build:
strategy:
fail-fast: false
max-parallel: 3
matrix:
os:
- ubuntu-latest
- macos-latest
# - windows-latest

runs-on: ${{ matrix.os }}

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

steps:
- uses: actions/checkout@v2


- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.9-1'
environment-file: envs/environment.yaml
log-level: debug
init-shell: bash
cache-environment: true
cache-downloads: true


- name: Set cache dates
run: |
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV
- name: Cache data and cutouts folders
uses: actions/cache@v3
with:
path: |
data
cutouts
key: data-cutouts-${{ env.WEEK }}-${{ env.CACHE_NUMBER }}


- name: Micromamba list
run: micromamba list

- name: Run Test
run: make test

# - name: Test plotting and summaries
# run: |
# snakemake --cores all plot_all_p_nom
# snakemake --cores all plot_all_summaries
# snakemake --cores all make_all_summaries
# rm -rf resources/*.nc resources/*.geojson resources/*.h5 networks results
Loading

0 comments on commit a1496a7

Please sign in to comment.