Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Aug 31, 2023
1 parent 28f3012 commit e73c5fd
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/_build_devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ on:

pull_request:
push:
inputs:
sdk_ref:
type: string
required: false
default: 'master'

run_nanos:
type: boolean
required: false
default: true
run_nanosp:
type: boolean
required: false
default: true
run_nanox:
type: boolean
required: false
default: true
run_stax:
type: boolean
required: false
default: true



jobs:
Expand Down Expand Up @@ -66,7 +89,7 @@ jobs:
- name: Merge output files
run: |
python3 scripts/output_scripts/merge.py --input_files build_nanos.json build_nanosp.json build_nanox.json build_stax.json --output_file build_output.json
python3 scripts/output_scripts/merge.py --input_files build_nanos.json build_nanosp.json build_nanox.json build_stax.json --output_file build_output.json --merge_key "name"
#- name: Push info to DB
# run: |
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/_test_devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ on:

pull_request:
push:
inputs:
sdk_ref_nanosp:
type: string
required: false
default: 'API_LEVEL_1'
run_nanosp:
type: boolean
required: false
default: true

sdk_ref_nanox:
type: string
required: false
default: 'API_LEVEL_5'
run_nanox:
type: boolean
required: false
default: true

sdk_ref_stax:
type: string
required: false
default: 'API_LEVEL_12'
run_stax:
type: boolean
required: false
default: true



jobs:
Expand Down Expand Up @@ -66,7 +94,7 @@ jobs:
- name: Merge output files
run: |
python3 scripts/output_scripts/merge.py --input_files test_nanosp.json test_nanox.json test_stax.json --output_file test_output.json
python3 scripts/output_scripts/merge.py --input_files test_nanosp.json test_nanox.json test_stax.json --output_file test_output.json --merge_key "name"
- name: Archive output file
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_outdated_build_db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- name: Build db
run: |
python3 scripts/create_app_list/main.py --output_file out.json --access_token ${{ secrets.GH_ACCESS_TOKEN }}
python3 scripts/create_app_list/main.py --full_output_file out.json --access_token ${{ secrets.GH_ACCESS_TOKEN }}
- name: Compare Files
run: |
# Compare two files using diff
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_and_test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
parser.add_argument("--sdk_ref", required=False, type=Path, default="origin/master")

parser.add_argument("--input_file", required=False, type=Path, default=Path("input_files/test_input.json"))
parser.add_argument("--output_file", required=False, type=Path, default=Path("output_file/output.json"))
parser.add_argument("--output_file", required=False, type=Path, default=Path("output_files/output.json"))
parser.add_argument("--workdir", required=False, type=str, default="workdir")

args = parser.parse_args()
Expand Down
29 changes: 29 additions & 0 deletions scripts/output_scripts/merge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import argparse
import json

def merge_json_files(input_files, output_file, merge_key):
merged_data = {}

for input_file in input_files:
with open(input_file, 'r') as f:
data = json.load(f)
key_value = data.get(merge_key)
if key_value is not None:
merged_data[key_value] = data

with open(output_file, 'w') as f:
json.dump(merged_data, f, indent=2)

def main():
parser = argparse.ArgumentParser(description="Merge JSON files based on a specified key")
parser.add_argument("--input_files", nargs="+", help="List of input JSON files")
parser.add_argument("--output_file", help="Output merged JSON file")
parser.add_argument("--merge_key", help="Key to use for merging")

args = parser.parse_args()

merge_json_files(args.input_files, args.output_file, args.merge_key)
print(f"Merged data saved to {args.output_file}")

if __name__ == "__main__":
main()

0 comments on commit e73c5fd

Please sign in to comment.