Repository navigation
106 lines (90 loc) · 2.74 KB
/
Copy pathtest-models.yml
File metadata and controls
106 lines (90 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Test models
on:
schedule:
- cron: "0 5 * * 1"
workflow_dispatch:
# Cancel any in-progress runs when a new run is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-pypsa-eur:
name: PyPSA-Eur
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- master
# - latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v7
with:
repository: PyPSA/pypsa-eur
ref: master
- name: Check out latest release
if: matrix.version == 'latest'
run: |
git fetch --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $latest_tag
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.10.2
with:
pixi-version: v0.68.1
cache: true
- name: Setup cache keys
run: |
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
# Only run check if package is not pinned
- name: Check if linopy package is pinned
run: |
grep_line=$(grep -- '${{ github.event.repository.name }} = ' pixi.toml)
if [[ $grep_line == *"<* || $grep_line == *"==* ]]; then
echo "pinned=true" >> $GITHUB_ENV
else
echo "pinned=false" >> $GITHUB_ENV
fi
- name: Setup secrets & cache dates
if: env.pinned == 'false'
run: |
echo -ne "url: ${CDSAPI_URL}\nkey: ${CDSAPI_TOKEN}\n" > ~/.cdsapirc
echo "week=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
- uses: actions/cache@v6
if: env.pinned == 'false'
with:
path: |
data
cutouts
key: data-cutouts-${{ env.week }}
- name: Install package from ref
if: env.pinned == 'false'
run: |
pixi remove pypsa
pixi remove linopy
pixi add --pypi --git https://github.com/${{ github.repository }}.git ${{ github.event.repository.name }} --rev ${{ github.sha }}
pixi add --pypi pypsa
- name: Run snakemake test workflows
if: env.pinned == 'false'
run: |
pixi run integration-tests
- name: Run unit tests
if: env.pinned == 'false'
run: |
pixi run unit-tests
- name: Upload artifacts
if: env.pinned == 'false'
uses: actions/upload-artifact@v7
with:
name: results-pypsa-eur-${{ matrix.version }}
path: |
logs
.snakemake/log
results
retention-days: 3
- name: Show remaining disk space
if: always()
run: df -h