diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04b195d..2ee1ce5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.11 - name: Install protoplaster with pip run: | pip install . @@ -35,13 +35,15 @@ jobs: python3-pip telnet iptables iproute2 bc cpio rsync - name: Run scripts in Renode - uses: antmicro/renode-linux-runner-action@v0 + uses: antmicro/renode-linux-runner-action@v1 with: - shared-dir: ./ + shared-dirs: ./ renode-run: | - ./protoplaster/protoplaster -t tests/basic.yml + python -m venv .venv + source .venv/bin/activate + pip install . + protoplaster -t tests/basic.yml devices: | vivid gpio 0 32 i2c 0x1C - python-packages: git+https://github.com/antmicro/protoplaster.git diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b9c509a..6e1d9e8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.11 - name: Install protoplaster with pip run: | pip install . @@ -38,12 +38,20 @@ jobs: protoplaster -t example.yml --csv report.csv protoplaster-test-report report.csv -t md + - name: Generate system report from yml + run: | + tuttest README.md system-report-example > system-report-example.yml + protoplaster-system-report -c system-report-example.yml --sudo + - name: Prepare docs template run: | cp -r .github/docs-template docs/ cp README.md docs/source/readme.md cp protoplaster.md docs/source/ cp report.md docs/source/ + echo -e "\`\`\`\n$(cat system-report-example.yml)\n\`\`\`" >> docs/source/system-report-example.yml + mkdir -p docs/source/_static/system_report + unzip report.zip -d docs/source/_static/system_report - name: Build html uses: docker://btdi/sphinx:min diff --git a/README.md b/README.md index f120db4..2dd8779 100644 --- a/README.md +++ b/README.md @@ -241,9 +241,15 @@ dmesg: superuser: required ip: run: ip a + summary: + - title: Network interfaces state + run: python3 $PROTOPLASTER_SCRIPTS/generate_ip_table.py "$(cat)" output: ip.out on-fail: run: ifconfig -a + summary: + - title: Network interfaces state + run: python3 $PROTOPLASTER_SCRIPTS/generate_ifconfig_table.py "$(cat)" output: ifconfig.out ``` diff --git a/protoplaster/report_generators/system_report/protoplaster_system_report.py b/protoplaster/report_generators/system_report/protoplaster_system_report.py index 819242b..5ed7a2c 100755 --- a/protoplaster/report_generators/system_report/protoplaster_system_report.py +++ b/protoplaster/report_generators/system_report/protoplaster_system_report.py @@ -124,18 +124,23 @@ def run_command(config): out = get_cmd_output(f"sh -c '{config.script}'") summaries = [] for summary_config in config.summary_configs: - summary_content = subprocess.check_output( - f"sh -c '{summary_config.script}'", - shell=True, - text=True, - stderr=subprocess.STDOUT, - env=os.environ | { - "PROTOPLASTER_SCRIPTS": - f"{os.path.dirname(__file__)}/scripts" - }, - input=out) - summaries.append( - SubReportSummary(summary_config.title, summary_content)) + try: + summary_content = subprocess.check_output( + f"sh -c '{summary_config.script}'", + shell=True, + text=True, + stderr=subprocess.STDOUT, + env=os.environ | { + "PROTOPLASTER_SCRIPTS": + f"{os.path.dirname(__file__)}/scripts" + }, + input=out) + summaries.append( + SubReportSummary(summary_config.title, summary_content)) + except: + summaries.append( + SubReportSummary(summary_config.title, + "this summary is empty")) return SubReportResult(config.name, out, config.output_file, summaries) except: if config.on_fail: