Skip to content

Commit

Permalink
CI: Add build date to files
Browse files Browse the repository at this point in the history
  • Loading branch information
illusion0001 committed Aug 22, 2023
1 parent e12db15 commit 8bf3485
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 10 additions & 5 deletions .ci/file-autogen-xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
import sys

if __name__ == '__main__':
if len(sys.argv) == 2:
if len(sys.argv) == 3:
entry = 0
for patches in glob.glob(sys.argv[1], recursive=True):
print('Source: %s' % (patches))
# print('Source: %s' % (patches))
with open(patches, 'r') as fr:
string_data = fr.read()
string_data = string_data.replace('<?xml version="1.0" encoding="utf-8"?>\n', f'<?xml version="1.0" encoding="utf-8"?>\n<!-- File generated from: {patches} -->\n')
string_data = string_data.replace('<?xml version="1.0" encoding="utf-8"?>\n', f'<?xml version="1.0" encoding="utf-8"?>\n<!-- File generated from: {patches} @ {sys.argv[2]} -->\n')
root = ET.fromstring(string_data)
ID = root.findall('TitleID/ID')
for i in ID:
if not (i.text.startswith('CUSA') or i.text.startswith('PPSA')):
print(f'Ignored {i.text}')
continue
out = ('output/xml/{}.xml'.format(i.text))
print('Output: %s' % (out))
# print('Output: %s' % (out))
with open(out, 'w') as fw:
fw.write(string_data)
entry = entry + 1
print('processed %u entries' % (entry))
exit(0)
else:
print('path to glob not provided')
print('path to glob not or current time provided')
exit(1)
6 changes: 5 additions & 1 deletion .github/workflows/zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
run: |
mkdir -p output/xml
mkdir -p output/misc
python .ci/file-autogen-xml.py "$(pwd)/patches/xml/*.xml"
current=$(date '+%Y-%m-%d %H:%M:%S %A (%Z %z)')
msg="Patch database version: $current"
msg_md="Patch archive built on: \`$current\`"
Expand All @@ -52,28 +51,33 @@ jobs:
echo $msg > build.txt
echo $msg_md > patch_built.md
echo $msg
python .ci/file-autogen-xml.py "$(pwd)/patches/xml/*.xml" "$current"
mv output patch1
- name: Verify XML files
working-directory: mxml
run: |
clang ../.ci/test.c -lmxml -D__PC__
FILES="../patches/xml/*.xml"
i=0
for f in $FILES
do
./a.out $f
((i=i+1))
done
echo "Passed $i files"
- name: Verify Generated XML files
working-directory: mxml
run: |
FILES="../patch1/xml/*.xml"
i=0
for f in $FILES
do
./a.out $f
((i=i+1))
done
echo "Passed $i files"
- name: Pack zip
run: |
Expand Down

0 comments on commit 8bf3485

Please sign in to comment.