Skip to content

add workflow scripts for filtering and checking easystacks #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/scripts/filter_git_diff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# At the moment this script will only filter out the easystack files
# Next step could be to filter out other subpaths
# by using the GITHUB action environment variables and argsparse.

# Can also distiguish between modified, added, ... files
# That information is in the string that is generated by git diff
# For filtering easystacks this was however not necessary
# since we want to check both added and modified files

import os

diff = os.getenv('CHANGED')
env_file = os.getenv('GITHUB_ENV')

diff_list = diff.split('\n')

diff_filter_path = 'easystacks'

diff_filtered = ''

for line in diff_list:
status = line.split('\t')[0]
file = line.split('\t')[1]
if file.startswith(diff_filter_path):
# Ignoring the status assigned to the file
diff_filtered += file + ' '

if diff_filtered != '':
# Todo: Can only handle 1 level paths now
# I we want to pass multi-level paths this will need to be updated
# Name of the env_var can change based on the file or path
env_var = 'CHANGED_' + diff_filter_path.upper()
set_var = env_var + "=" + diff_filtered

# This adds the environment variable to the github action environment
with open(env_file, 'a') as file:
file.write(set_var)
23 changes: 23 additions & 0 deletions .github/workflows/scripts/parse_missing-installations-output.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import re

missing = os.environ['missing']
missing = missing.split('\n')
missing_cuda = []
missing_cpu = []
for ec in missing:
if re.search('CUDA', ec):
missing_cuda.append(ec)
else:
missing_cpu.append(ec)
if len(missing_cpu) != 0 and len(missing_cuda) != 0:
print(f'Please open a seperate pr for these dependencies: {missing_cpu}')
os.write(2, b'Error: CPU dependencies for CUDA build must be build in a seperate pr')
exit(1)
elif len(missing_cuda) != 0:
# TODO: Make this set the accelorator label?
print(f'Have fun installing the following gpu builds: {missing_cuda}')
elif len(missing_cpu) != 0:
print(f'Have fun installing the following gpu builds: {missing_cpu}')
else:
print('no missing modules')