Skip to content

CI-linux

CI-linux #348

Workflow file for this run

# SPDX-FileCopyrightText: : 2022 The PyPSA-Earth Authors
#
# SPDX-License-Identifier: CC0-1.0
name: CI-linux
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 5 * * TUE"
env:
CACHE_NUMBER: 3 # 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: Fill submodule
run: |
git submodule init
git submodule update
- name: Create environment cache
uses: actions/cache@v2
id: cache
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('pypsa-earth/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 pypsa-earth/envs/environment.yaml
conda activate pypsa-earth
pip install rampdemand
- name: Conda list
run: |
conda list
- name: Test workflow
run: |
rm -rf config.yaml
cp -rf test/config.distribution.test.yaml config.distribution.yaml
cp -rf pypsa-earth/config.tutorial.yaml config.pypsa-earth.yaml
snakemake --cores all solve_network
# - 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