Skip to content

Commit fa4c7dd

Browse files
committed
update gh action
1 parent a2c9197 commit fa4c7dd

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

.github/workflows/check_for_changes_in_NP_jsons.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,21 @@ jobs:
2424
with:
2525
python-version: '3.10'
2626

27+
# we just install probeinterface to get the version number
28+
- name: Install probeinterface and matplotlib
29+
run: |
30+
pip install probeinterface matplotlib
31+
PROBEINTERFACE_VERSION=$(pip show pip | grep Version | awk '{print $2}')
32+
pip uninstall probeinterface
33+
2734
# Clone dev version of probeinterface
2835
- name: Clone external repository
2936
run: |
3037
git clone https://github.com/spikeinterface/probeinterface ./probeinterface
38+
git fetch
39+
git checkout tags/$PROBEINTERFACE_VERSION
40+
pip install ./probeinterface
3141
32-
- name: Install probeinterface and matplotlib
33-
run: pip install ./probeinterface matplotlib
3442
3543
- name: Generate full NP library
3644
run: |
@@ -40,8 +48,10 @@ jobs:
4048
# Check for any new probes
4149
- name: Run local script
4250
run: |
43-
rsync -av --include='*/' --include='*.json' --exclude='*' scripts/neuropixels_library_generated/ imec/
44-
rm -r scripts/neuropixels_library_generated/
51+
cd scripts/
52+
python check_for_json_changes_in_NP_probes.py
53+
rm -r neuropixels_library_generated/
54+
cd ..
4555
rm -r ./probeinterface
4656
4757
- name: Commit changes if any
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from pathlib import Path
2+
import shutil
3+
4+
old_dir = Path('../imec')
5+
new_dir = Path('./neuropixels_library_generated')
6+
7+
new_dir = Path("/Users/christopherhalcrow/Work/fromgit/probeinterface/neuropixels_library_generated")
8+
9+
for temp_probe_directory in new_dir.iterdir():
10+
11+
probe_name = str(temp_probe_directory.name)
12+
13+
temp_probe_json_path = temp_probe_directory / (probe_name + '.json')
14+
old_probe_json_path = old_dir / probe_name / (probe_name + '.json')
15+
16+
if old_probe_json_path.is_file():
17+
with open(temp_probe_json_path, 'r') as f1, open(old_probe_json_path, 'r') as f2:
18+
# Read in json files
19+
lines1 = f1.readlines()
20+
lines2 = f2.readlines()
21+
22+
# We don't want to update the probes just because of a probeinterface version update.
23+
# The probeinterface version is stored on the 3rd line of the json file, so we only
24+
# compare the json files from line 3 and down.
25+
if lines1[3:] == lines2[3:]:
26+
continue
27+
else:
28+
shutil.copy(f"{temp_probe_json_path}", f"../imec/{probe_name}")

0 commit comments

Comments
 (0)