From 156f4584541b9f928dd7dd2c90f0421578eca57b Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 29 Sep 2024 21:50:51 -0400 Subject: [PATCH 1/4] Fix codecov failure due to undeclared secret use --- .github/workflows/execute-tests.yml | 3 +++ .github/workflows/test-linux.yml | 3 +++ .github/workflows/test-osx.yml | 2 ++ .github/workflows/test-windows.yml | 2 ++ 4 files changed, 10 insertions(+) diff --git a/.github/workflows/execute-tests.yml b/.github/workflows/execute-tests.yml index ec2d94410..65fc7c864 100644 --- a/.github/workflows/execute-tests.yml +++ b/.github/workflows/execute-tests.yml @@ -11,6 +11,9 @@ on: workpath: required: true type: string + secrets: + CODECOV_TOKEN: + required: true jobs: test: diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 6514a62d6..d4a0712f3 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -11,8 +11,11 @@ jobs: with: os: "ubuntu-latest" workpath: "/home/runner/work/doorstop/doorstop" + Test: uses: ./.github/workflows/execute-tests.yml with: os: "ubuntu-latest" workpath: "/home/runner/work/doorstop/doorstop" + secrets: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} diff --git a/.github/workflows/test-osx.yml b/.github/workflows/test-osx.yml index 87908505b..39f36d676 100644 --- a/.github/workflows/test-osx.yml +++ b/.github/workflows/test-osx.yml @@ -11,3 +11,5 @@ jobs: with: os: "macos-13" workpath: "/Users/runner/work/doorstop/doorstop" + secrets: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index fdb26b214..58467794c 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -12,3 +12,5 @@ jobs: basepath: 'D:\' os: "windows-latest" workpath: 'C:\a\doorstop\doorstop' + secrets: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} From 581bded8fba662e1a76182b14d8ef6ef0bbb2f35 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Mon, 30 Sep 2024 23:27:25 -0400 Subject: [PATCH 2/4] Remove retying of running tests as no longer needed --- .github/workflows/execute-tests.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/execute-tests.yml b/.github/workflows/execute-tests.yml index 65fc7c864..1d2c2c06b 100644 --- a/.github/workflows/execute-tests.yml +++ b/.github/workflows/execute-tests.yml @@ -59,18 +59,9 @@ jobs: - name: Install project dependencies run: make install - # Some tests fails intermittently, likely due to the public runners being - # very slow. Especially any client/server tests seems to be problematic. - # This is a simple attempt to re-run the tests up to three times if they - # fail. Does not add any execution time if successful. - - uses: Wandalen/wretry.action@v1.4.4 - name: Run tests - with: - command: make test - current_path: ${{ inputs.workpath }} - attempt_limit: 5 - attempt_delay: 2000 - + - name: Run tests + run: make test + - name: Upload coverage uses: codecov/codecov-action@v4 if: ${{ inputs.os == 'ubuntu-latest' && matrix.python-version == '3.9' && github.repository == 'doorstop-dev/doorstop' }} From 6820ac6a8cda4b798148d03e9f840ece6169a6b3 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Mon, 30 Sep 2024 23:45:40 -0400 Subject: [PATCH 3/4] Make CI test execution fail fast, as should all be passing now --- .github/workflows/execute-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/execute-tests.yml b/.github/workflows/execute-tests.yml index 1d2c2c06b..b6b7081c2 100644 --- a/.github/workflows/execute-tests.yml +++ b/.github/workflows/execute-tests.yml @@ -19,7 +19,7 @@ jobs: test: runs-on: ${{ inputs.os }} strategy: - fail-fast: false + fail-fast: true matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] name: Python ${{ matrix.python-version }} From 789cd1e31c116bc9e4af840af9d5a7dc3e5228e9 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Thu, 3 Oct 2024 16:42:59 -0400 Subject: [PATCH 4/4] Mock plantuml execution --- doorstop/core/tests/files/published.html | 17 ++++++++++++++++- doorstop/core/tests/files/published2.html | 17 ++++++++++++++++- doorstop/core/tests/test_all.py | 23 +++++++++++++++++++++-- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/doorstop/core/tests/files/published.html b/doorstop/core/tests/files/published.html index 3fdbe718f..081b52931 100644 --- a/doorstop/core/tests/files/published.html +++ b/doorstop/core/tests/files/published.html @@ -105,7 +105,22 @@

1.6 REQ004

Hello, world!

2.1 Plantuml REQ002

Hello, world!

-

AuthorCreate DocumentCreate ItemLink Item to DocumentLink Item to other ItemEdit ItemReview ItemDelete ItemDelete DocumentExportImportReviewerSystemSuspect ChangesIntegrity

+

plantuml format="svg_inline" alt="Use Cases of Doorstop" title="Use Cases of Doorstop" +@startuml +Author --> (Create Document) +Author --> (Create Item) +Author --> (Link Item to Document) +Author --> (Link Item to other Item) +Author --> (Edit Item) +Author --> (Review Item) +Author -> (Delete Item) +Author -> (Delete Document) +(Export) <- (Author) +(Import) <- (Author) +Reviewer --> (Review Item) +System --> (Suspect Changes) +System --> (Integrity) +@enduml

Child links: TST001, TST002

2.1 REQ2-001

Hello, world!

diff --git a/doorstop/core/tests/files/published2.html b/doorstop/core/tests/files/published2.html index ecc2a319f..f1c1435d5 100644 --- a/doorstop/core/tests/files/published2.html +++ b/doorstop/core/tests/files/published2.html @@ -105,7 +105,22 @@

1.6 REQ004

Hello, world!

2.1 Plantuml REQ002

Hello, world!

-

AuthorCreate DocumentCreate ItemLink Item to DocumentLink Item to other ItemEdit ItemReview ItemDelete ItemDelete DocumentExportImportReviewerSystemSuspect ChangesIntegrity

+

plantuml format="svg_inline" alt="Use Cases of Doorstop" title="Use Cases of Doorstop" +@startuml +Author --> (Create Document) +Author --> (Create Item) +Author --> (Link Item to Document) +Author --> (Link Item to other Item) +Author --> (Edit Item) +Author --> (Review Item) +Author -> (Delete Item) +Author -> (Delete Document) +(Export) <- (Author) +(Import) <- (Author) +Reviewer --> (Review Item) +System --> (Suspect Changes) +System --> (Integrity) +@enduml

2.1 REQ2-001

Hello, world!

Test Math Expressions in Latex Style:

diff --git a/doorstop/core/tests/test_all.py b/doorstop/core/tests/test_all.py index 155c325aa..243dc6cc0 100644 --- a/doorstop/core/tests/test_all.py +++ b/doorstop/core/tests/test_all.py @@ -11,6 +11,7 @@ import shutil import tempfile import unittest +from typing import List from unittest.mock import Mock, patch import openpyxl @@ -649,8 +650,17 @@ def test_lines_markdown_document_without_child_links(self): self.assertEqual(expected, text) common.write_text(text, path) - def test_lines_html_document_linkify(self): + @patch("plantuml_markdown.PlantUMLPreprocessor.run") + @patch("plantuml_markdown.PlantUMLPreprocessor.__init__") + def test_lines_html_document_linkify(self, ext_init, ext_run): """Verify HTML can be published from a document.""" + + def run(lines: List[str]) -> List[str]: + return lines + + ext_init.return_value = None + ext_run.side_effect = run + path = os.path.join(FILES, "published.html") expected = common.read_text(path) # Act @@ -664,9 +674,18 @@ def test_lines_html_document_linkify(self): common.write_text(actual, path) self.assertEqual(expected, actual) + @patch("plantuml_markdown.PlantUMLPreprocessor.run") + @patch("plantuml_markdown.PlantUMLPreprocessor.__init__") @patch("doorstop.settings.PUBLISH_CHILD_LINKS", False) - def test_lines_html_document_without_child_links(self): + def test_lines_html_document_without_child_links(self, ext_init, ext_run): """Verify HTML can be published from a document w/o child links.""" + + def run(lines: List[str]) -> List[str]: + return lines + + ext_init.return_value = None + ext_run.side_effect = run + path = os.path.join(FILES, "published2.html") expected = common.read_text(path) # Act