Skip to content

Commit 6c83d6d

Browse files
committed
add missing scripts to software-layer
Signed-off-by: laraPPr <lara.peeters@ugent.be>
1 parent 93dca82 commit 6c83d6d

3 files changed

Lines changed: 64 additions & 2 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# At the moment this script will only filter out the easystack files
2+
# Next step could be to filter out other subpaths
3+
# by using the GITHUB action environment variables and argsparse.
4+
5+
# Can also distiguish between modified, added, ... files
6+
# That information is in the string that is generated by git diff
7+
# For filtering easystacks this was however not necessary
8+
# since we want to check both added and modified files
9+
10+
# Todo: This script should eventually be its own github action. When it can be used for filtering more files. And all the todo have been addressed.
11+
12+
import os
13+
14+
diff = os.getenv('CHANGED')
15+
env_file = os.getenv('GITHUB_ENV')
16+
17+
diff_list = diff.split('\n')
18+
19+
diff_filter_path = 'easystacks'
20+
21+
diff_filtered = ''
22+
23+
for line in diff_list:
24+
status = line.split('\t')[0]
25+
file = line.split('\t')[1]
26+
if file.startswith(diff_filter_path):
27+
# Ignoring the status assigned to the file
28+
diff_filtered += file + ' '
29+
30+
if diff_filtered != '':
31+
# Todo: Can only handle 1 level paths now
32+
# If we want to pass multi-level paths this will need to be updated
33+
# Name of the env_var can change based on the file or path
34+
env_var = 'CHANGED_' + diff_filter_path.upper()
35+
set_var = env_var + "=" + diff_filtered
36+
37+
# This adds the environment variable to the github action environment
38+
with open(env_file, 'a') as file:
39+
file.write(set_var)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import os
2+
import re
3+
4+
missing = os.environ['missing']
5+
missing = missing.split('\n')
6+
missing_cuda = []
7+
missing_cpu = []
8+
for ec in missing:
9+
if re.search('CUDA', ec):
10+
missing_cuda.append(ec)
11+
else:
12+
missing_cpu.append(ec)
13+
if len(missing_cpu) != 0 and len(missing_cuda) != 0:
14+
print(f'Please open a seperate pr for these dependencies: {missing_cpu}')
15+
os.write(2, b'Error: CPU dependencies for CUDA build must be build in a seperate pr')
16+
exit(1)
17+
elif len(missing_cuda) != 0:
18+
# TODO: Make this set the accelorator label?
19+
print(f'Have fun installing the following gpu builds: {missing_cuda}')
20+
elif len(missing_cpu) != 0:
21+
print(f'Have fun installing the following gpu builds: {missing_cpu}')
22+
else:
23+
print('no missing modules')

.github/workflows/test-check_easystacks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
echo "git diff --no-renames --name-status ${GITHUB_BASE_REF}..HEAD"
4141
export CHANGED=$(git diff --no-renames --name-status origin/${GITHUB_BASE_REF}..HEAD)
4242
echo $CHANGED
43-
python software-layer-scripts/.github/workflows/scripts/filter_git_diff.py
43+
python .github/workflows/scripts/filter_git_diff.py
4444
- name: Mount EESSI CernVM-FS pilot repository
4545
if: env.CHANGED_EASYSTACKS
4646
uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0
@@ -82,6 +82,6 @@ jobs:
8282
if [[ ${ec} -ne 0 ]]; then
8383
echo "missing installations found for ${easystack_file}!" >&2
8484
export missing=$(env | grep .eb\) | tr -d \*)
85-
python software-layer-scripts/.github/workflows/scripts/parse_missing-installations-output.py
85+
python .github/workflows/scripts/parse_missing-installations-output.py
8686
fi
8787
done

0 commit comments

Comments
 (0)