Skip to content

Commit

Permalink
Fix build (attempt 2)
Browse files Browse the repository at this point in the history
Mermaid is failing because it requires a headless browser (!) which is
not working inside the github runner. I'm disabling the Mermaid PNG
rendering as a result. Users can still run it locally if they want, and
we'll still provide the mermaid markup.
  • Loading branch information
mehaase committed Jan 8, 2025
1 parent 76c8f49 commit 8b1f0a9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 28 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ jobs:
- name: Install Node dependencies
working-directory: ./src/attack_flow_builder/
run: npm ci
- name: Install Mermaid
run: npm install -g @mermaid-js/mermaid-cli
- name: Create client directory
run: mkdir docs/extra/ui
- name: Download Attack Flow Builder
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ docs-examples: src/attack_flow_builder/dist/cli.common.js ## Build example flows
ls -1 corpus/*.json | sed 's/corpus\/\(.*\)\.json/\1/' | xargs -t -I {} af graphviz "corpus/{}.json" "docs/extra/corpus/{}.dot"
ls -1 docs/extra/corpus/*.dot | xargs -t -I {} dot -Tpng -O -q1 "{}"
ls -1 corpus/*.json | sed 's/corpus\/\(.*\)\.json/\1/' | xargs -t -I {} af mermaid "corpus/{}.json" "docs/extra/corpus/{}.mmd"
ls -1 corpus/*.json | sed 's/corpus\/\(.*\)\.json/\1/' | xargs -t -I {} mmdc -i "docs/extra/corpus/{}.mmd" -o "docs/extra/corpus/{}.mmd.png"
af doc-examples corpus/ docs/example_flows.rst

docs-matrix: ## Build the Navigator visualization JS code
Expand Down
2 changes: 1 addition & 1 deletion src/attack_flow/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def generate_example_flows(jsons, afds):
formats.append(
f'<p><em>Download:</em> <a href="../corpus/{quoted_stem}.json">JSON</a> | '
f'<a href="../corpus/{quoted_stem}.dot">GraphViz</a> (<a href="../corpus/{quoted_stem}.dot.png">PNG</a>) | '
f'<a href="../corpus/{quoted_stem}.mmd">Mermaid</a> (<a href="../corpus/{quoted_stem}.mmd.png">PNG</a>)'
f'<a href="../corpus/{quoted_stem}.mmd">Mermaid</a>'
)
doc_lines.append(f" * - **{name}**")
doc_lines.append("")
Expand Down
48 changes: 24 additions & 24 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,29 +381,29 @@ def test_generate_example_flows():
afds = [Path("tests/fixtures/flow1.afd")]
result = generate_example_flows(jsons, afds)
assert result == [
'.. list-table::',
' :widths: 30 20 50',
' :header-rows: 1',
'',
' * - Report',
' - Authors',
' - Description',
' * - **Test Flow 1**',
'',
' .. raw:: html',
'',
".. list-table::",
" :widths: 30 20 50",
" :header-rows: 1",
"",
" * - Report",
" - Authors",
" - Description",
" * - **Test Flow 1**",
"",
" .. raw:: html",
"",
' <p><em>Open:</em> <a target="_blank" href="../ui/?src=..%2fcorpus%2fflow1.afb"></i>Attack Flow Builder</a></p>',
' <p><em>Download:</em> <a href="../corpus/flow1.json">JSON</a> | <a href="../corpus/flow1.dot">GraphViz</a> (<a href="../corpus/flow1.dot.png">PNG</a>) | <a href="../corpus/flow1.mmd">Mermaid</a> (<a href="../corpus/flow1.mmd.png">PNG</a>)',
' - John Doe',
' - Test flow 1 is used for unit tests.',
'',
' * - **Test Flow 2**',
'',
' .. raw:: html',
'',
' <p><em>Download:</em> <a href="../corpus/flow2.json">JSON</a> | <a href="../corpus/flow2.dot">GraphViz</a> (<a href="../corpus/flow2.dot.png">PNG</a>) | <a href="../corpus/flow2.mmd">Mermaid</a> (<a href="../corpus/flow2.mmd.png">PNG</a>)',
' - Jane Doe',
' - Test flow 2 is used for unit tests.',
'',
''
' <p><em>Download:</em> <a href="../corpus/flow1.json">JSON</a> | <a href="../corpus/flow1.dot">GraphViz</a> (<a href="../corpus/flow1.dot.png">PNG</a>) | <a href="../corpus/flow1.mmd">Mermaid</a>',
" - John Doe",
" - Test flow 1 is used for unit tests.",
"",
" * - **Test Flow 2**",
"",
" .. raw:: html",
"",
' <p><em>Download:</em> <a href="../corpus/flow2.json">JSON</a> | <a href="../corpus/flow2.dot">GraphViz</a> (<a href="../corpus/flow2.dot.png">PNG</a>) | <a href="../corpus/flow2.mmd">Mermaid</a>',
" - Jane Doe",
" - Test flow 2 is used for unit tests.",
"",
"",
]

0 comments on commit 8b1f0a9

Please sign in to comment.