Skip to content

Commit 7c68c9e

Browse files
fix: correct pypsa-eur env path in CI (#486)
* fix: correct pypsa-eur env path in CI * deactivate claude review
1 parent 2e297df commit 7c68c9e

File tree

4 files changed

+89
-82
lines changed

4 files changed

+89
-82
lines changed
File renamed without changes.

.github/workflows/test-models.yml

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name: Test models
33
on:
44
push:
55
branches:
6-
- master
6+
- master
77
pull_request:
88
branches:
9-
- master
9+
- master
1010
schedule:
11-
- cron: "0 5 * * *"
11+
- cron: "0 5 * * *"
1212

1313
# Cancel any in-progress runs when a new run is triggered
1414
concurrency:
@@ -23,89 +23,89 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
version:
26-
- master
26+
- master
2727
# - latest # Activate when v0.14.0 is released
2828

2929
defaults:
3030
run:
3131
shell: bash -l {0}
3232

3333
steps:
34-
- uses: actions/checkout@v4
35-
with:
36-
repository: PyPSA/pypsa-eur
37-
ref: master
38-
39-
- name: Check out latest release
40-
if: matrix.version == 'latest'
41-
run: |
42-
git fetch --tags
43-
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
44-
git checkout $latest_tag
45-
46-
# Only run check if package is not pinned
47-
- name: Check if inhouse package is pinned
48-
run: |
49-
grep_line=$(grep -- '- pypsa' envs/environment.yaml)
50-
if [[ $grep_line == *"<"* || $grep_line == *"=="* ]]; then
51-
echo "pinned=true" >> $GITHUB_ENV
52-
else
53-
echo "pinned=false" >> $GITHUB_ENV
54-
fi
55-
56-
- name: Setup secrets & cache dates
57-
if: env.pinned == 'false'
58-
run: |
59-
echo -ne "url: ${CDSAPI_URL}\nkey: ${CDSAPI_TOKEN}\n" > ~/.cdsapirc
60-
echo "week=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
61-
62-
- uses: actions/cache@v4
63-
if: env.pinned == 'false'
64-
with:
65-
path: |
66-
data
67-
cutouts
68-
key: data-cutouts-${{ env.week }}
69-
70-
- uses: conda-incubator/setup-miniconda@v3
71-
if: env.pinned == 'false'
72-
with:
73-
activate-environment: pypsa-eur
74-
75-
- name: Cache Conda env
76-
if: env.pinned == 'false'
77-
uses: actions/cache@v4
78-
with:
79-
path: ${{ env.CONDA }}/envs
80-
key: conda-pypsa-eur-${{ env.week }}-${{ hashFiles('envs/linux-pinned.yaml') }}
81-
id: cache-env
82-
83-
- name: Update environment
84-
if: env.pinned == 'false' && steps.cache-env.outputs.cache-hit != 'true'
85-
run: conda env update -n pypsa-eur -f envs/linux-pinned.yaml
86-
87-
- name: Install package from ref
88-
if: env.pinned == 'false'
89-
run: |
90-
python -m pip install git+https://github.com/${{ github.repository }}@${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
91-
92-
- name: Run snakemake test workflows
93-
if: env.pinned == 'false'
94-
run: |
95-
make test
96-
97-
- name: Run unit tests
98-
if: env.pinned == 'false'
99-
run: |
100-
make unit-test
101-
102-
- name: Upload artifacts
103-
if: env.pinned == 'false'
104-
uses: actions/upload-artifact@v4
105-
with:
106-
name: results-pypsa-eur-${{ matrix.version }}
107-
path: |
108-
logs
109-
.snakemake/log
110-
results
111-
retention-days: 3
34+
- uses: actions/checkout@v4
35+
with:
36+
repository: PyPSA/pypsa-eur
37+
ref: master
38+
39+
- name: Check out latest release
40+
if: matrix.version == 'latest'
41+
run: |
42+
git fetch --tags
43+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
44+
git checkout $latest_tag
45+
46+
# Only run check if package is not pinned
47+
- name: Check if inhouse package is pinned
48+
run: |
49+
grep_line=$(grep -- '- pypsa' envs/environment.yaml)
50+
if [[ $grep_line == *"<"* || $grep_line == *"=="* ]]; then
51+
echo "pinned=true" >> $GITHUB_ENV
52+
else
53+
echo "pinned=false" >> $GITHUB_ENV
54+
fi
55+
56+
- name: Setup secrets & cache dates
57+
if: env.pinned == 'false'
58+
run: |
59+
echo -ne "url: ${CDSAPI_URL}\nkey: ${CDSAPI_TOKEN}\n" > ~/.cdsapirc
60+
echo "week=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
61+
62+
- uses: actions/cache@v4
63+
if: env.pinned == 'false'
64+
with:
65+
path: |
66+
data
67+
cutouts
68+
key: data-cutouts-${{ env.week }}
69+
70+
- uses: conda-incubator/setup-miniconda@v3
71+
if: env.pinned == 'false'
72+
with:
73+
activate-environment: pypsa-eur
74+
75+
- name: Cache Conda env
76+
if: env.pinned == 'false'
77+
uses: actions/cache@v4
78+
with:
79+
path: ${{ env.CONDA }}/envs
80+
key: conda-pypsa-eur-${{ env.week }}-${{ hashFiles('envs/linux-64.lock.yaml') }}
81+
id: cache-env
82+
83+
- name: Update environment
84+
if: env.pinned == 'false' && steps.cache-env.outputs.cache-hit != 'true'
85+
run: conda env update -n pypsa-eur -f envs/linux-64.lock.yaml
86+
87+
- name: Install package from ref
88+
if: env.pinned == 'false'
89+
run: |
90+
python -m pip install git+https://github.com/${{ github.repository }}@${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
91+
92+
- name: Run snakemake test workflows
93+
if: env.pinned == 'false'
94+
run: |
95+
make test
96+
97+
- name: Run unit tests
98+
if: env.pinned == 'false'
99+
run: |
100+
make unit-test
101+
102+
- name: Upload artifacts
103+
if: env.pinned == 'false'
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: results-pypsa-eur-${{ matrix.version }}
107+
path: |
108+
logs
109+
.snakemake/log
110+
results
111+
retention-days: 3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ benchmark/scripts/leftovers/
4343

4444
# Claude
4545
.claude/settings.local.json
46+
47+
# direnv
48+
.envrc

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ include = ["linopy"]
8888
write_to = "linopy/version.py"
8989
version_scheme = "no-guess-dev"
9090

91+
[tool.pytest.ini_options]
92+
testpaths = ["test"]
93+
norecursedirs = ["dev-scripts", "doc", "examples", "benchmark"]
94+
9195
[tool.coverage.run]
9296
branch = true
9397
source = ["linopy"]

0 commit comments

Comments
 (0)