From 327999d887b9616e480f9bc6a390de7681c9ad99 Mon Sep 17 00:00:00 2001 From: "Jason N." <33561705+JasonN3@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:08:42 -0400 Subject: [PATCH] update test --- action.yml | 1 + test/repo/vars.py | 35 ++++++++++++++++++++--------- test/repo/vars_copy.sh | 51 ------------------------------------------ xorriso/gen_input.sh | 2 +- 4 files changed, 26 insertions(+), 63 deletions(-) delete mode 100755 test/repo/vars_copy.sh diff --git a/action.yml b/action.yml index 19bf70b..ea0b43f 100644 --- a/action.yml +++ b/action.yml @@ -74,6 +74,7 @@ inputs: required: false rootfs_size: description: The size (in GiB) for the squashfs runtime volume + default: "2" secure_boot_key_url: description: Secure boot key that is installed from URL location required: false diff --git a/test/repo/vars.py b/test/repo/vars.py index 086b908..e76f3e3 100755 --- a/test/repo/vars.py +++ b/test/repo/vars.py @@ -44,12 +44,9 @@ for line in action_lines: inputs[var_name]['default_value'] = parts[1].strip().strip('"') elif line.startswith(' '): var_name = line.strip().strip(':').lower() - if var_name in inputs: - inputs[var_name][action] = True - else: - print("WARNING: " + var_name + " found in action.yml but not Makefile") + if not var_name in inputs: inputs[var_name] = {} - inputs[var_name]['action'] = True + inputs[var_name]['action'] = True else: at_inputs = False @@ -97,9 +94,25 @@ for line in readme_lines: var_name = parts[1].strip().lower() if not var_name in inputs: print("ERROR: " + var_name + " is not listed in action.yml or Makefile") - inputs[var_name] = {} - print(inputs[var_name]) - var_description = parts[2].strip() - var_default_value = parts[3].strip() - var_action = parts[4].strip() - var_makefile = parts[5].strip() + errors += 1 + continue + if 'description' in inputs[var_name]: + if parts[2].strip() != inputs[var_name]['description']: + print("WARNING: " + var_name + " description in README.md does not match action.yml") + if 'default_value' in inputs[var_name]: + if not parts[3].strip().strip('"').startswith('*'): + if inputs[var_name]['default_value'] == "": + if parts[3].strip().strip('"') != '\\[empty\\]': + print("ERROR: " + var_name + " default value in README.md does not match action.yml") + errors += 1 + elif parts[3].strip().strip('"') != inputs[var_name]['default_value']: + print("ERROR: " + var_name + " default value in README.md does not match action.yml") + errors += 1 + if 'action' in inputs[var_name] and inputs[var_name]['action']: + if parts[4].strip() != ':white_check_mark:': + print("WARNING: " + var_name + " not labeled as in action.yml in the README.md") + if 'makefile' in inputs[var_name] and inputs[var_name]['makefile']: + if parts[4].strip() != ':white_check_mark:': + print("WARNING: " + var_name + " not labeled as in Makefile in the README.md") + +exit(errors) \ No newline at end of file diff --git a/test/repo/vars_copy.sh b/test/repo/vars_copy.sh deleted file mode 100755 index c039292..0000000 --- a/test/repo/vars_copy.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -exit 0 - -makefile = open('../../Makefile.inputs', 'r') -makefile_lines = makefile.readlines() - -vars = [] - -for line in makefile_lines: - if line.startswith('#'): - makefile_lines.remove(line) - parts = line.split('=', 1) - vars += { parts[0]: parts[1] } - -print(vars) - -vars=() -default_values=() - -while read -r line -do - if ! [[ $line =~ ^# ]] - then - vars+=$(echo $line | cut -d= -f1 | tr [:upper:] [:lower:]) - fi -done < ../../Makefile.inputs - -result=0 - -for var in $vars -do - grep "^| ${var}" README.md > /dev/null - if [[ $? != 0 ]] - then - echo "$var not found in README.md" - result=1 - fi -done - -for var in $vars -do - grep "^ ${var}:" action.yml > /dev/null - if [[ $? != 0 ]] - then - echo "$var not found in action.yml" - result=1 - fi -done - -exit ${result} \ No newline at end of file diff --git a/xorriso/gen_input.sh b/xorriso/gen_input.sh index a65d63f..dae4dd3 100644 --- a/xorriso/gen_input.sh +++ b/xorriso/gen_input.sh @@ -22,7 +22,6 @@ popd > /dev/null if [[ -n "${FLATPAK_DIR}" ]] then pushd "${FLATPAK_DIR}" > /dev/null - chmod -R ugo=rX . for file in $(find repo) do if [[ "${file}" == "repo/.lock" ]] @@ -30,6 +29,7 @@ then continue fi echo "-map ${PWD}/${file} flatpak/${file}" + echo "-chmod 0444 ${file}" done popd > /dev/null fi