From 216ef2cebe6869d504c99e34aed03f3c88814f5a Mon Sep 17 00:00:00 2001 From: f-peverali <112709306+f-peverali@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:48:39 +0100 Subject: [PATCH 01/19] update script and init test --- .vscode/settings.json | 9 ++++++ tests/test-update-tool-folders.py | 47 +++++++++++++++++++++++++++++++ update-tool-folders.py | 47 +++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 tests/test-update-tool-folders.py create mode 100644 update-tool-folders.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 7a73a41b..b1506db8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,2 +1,11 @@ { + "python.testing.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true } \ No newline at end of file diff --git a/tests/test-update-tool-folders.py b/tests/test-update-tool-folders.py new file mode 100644 index 00000000..96dc48c0 --- /dev/null +++ b/tests/test-update-tool-folders.py @@ -0,0 +1,47 @@ +import unittest +from unittest.mock import patch, call +import subprocess +import update_tool_folders + +class TestUpdateToolFolders(unittest.TestCase): + + @patch('update_tool_folders.subprocess.run') + def test_run_command_success(self, mock_run): + mock_run.return_value.returncode = 0 + mock_run.return_value.stdout = "success" + result = update_tool_folders.run_command("echo success") + self.assertEqual(result.returncode, 0) + self.assertEqual(result.stdout, "success") + mock_run.assert_called_once_with("echo success", shell=True, cwd=None, capture_output=True, text=True) + + @patch('update_tool_folders.subprocess.run') + def test_run_command_failure(self, mock_run): + mock_run.return_value.returncode = 1 + mock_run.return_value.stderr = "error" + result = update_tool_folders.run_command("echo error") + self.assertEqual(result.returncode, 1) + self.assertEqual(result.stderr, "error") + mock_run.assert_called_once_with("echo error", shell=True, cwd=None, capture_output=True, text=True) + + @patch('update_tool_folders.run_command') + def test_get_current_branch(self, mock_run_command): + mock_run_command.return_value.stdout = "main" + current_branch = update_tool_folders.get_current_branch() + self.assertEqual(current_branch, "main") + mock_run_command.assert_called_once_with("git branch --show-current") + + @patch('update_tool_folders.run_command') + def test_update_folders(self, mock_run_command): + folders = ["folder1", "folder2"] + current_branch = "main" + update_tool_folders.update_folders(folders, current_branch) + expected_calls = [ + call(f"git checkout {update_tool_folders.SOURCE_BRANCH}"), + call(f"git checkout {current_branch} -- folder1"), + call(f"git checkout {current_branch} -- folder2"), + call(f"git checkout {current_branch}") + ] + mock_run_command.assert_has_calls(expected_calls, any_order=False) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/update-tool-folders.py b/update-tool-folders.py new file mode 100644 index 00000000..44f79e44 --- /dev/null +++ b/update-tool-folders.py @@ -0,0 +1,47 @@ +import os +import shutil +import tempfile +import subprocess + +# Define the source repository and branch +SOURCE_REPO = "https://github.com/gematik/spec-ISiK-Basismodul" +SOURCE_BRANCH = "main-isik-stufe-4" + +# Define the list of folders to update +FOLDERS = [".github", "scripts"] + +# Define the list of files to exclude from updating +EXCLUDE_FILES = ["scripts/config.yaml"] + +def run_command(command, cwd=None): + result = subprocess.run(command, shell=True, cwd=cwd, capture_output=True, text=True) + if result.returncode != 0: + print(f"Error running command: {command}\n{result.stderr}") + return result + +def clone_source_repo(temp_dir): + run_command(f"git clone --branch {SOURCE_BRANCH} {SOURCE_REPO} {temp_dir}") + +def copy_folders(temp_dir, folders, exclude_files): + for folder in folders: + src_folder = os.path.join(temp_dir, folder) + if os.path.exists(src_folder): + dest_folder = os.path.join(os.getcwd(), folder) + if os.path.exists(dest_folder): + shutil.rmtree(dest_folder) + shutil.copytree(src_folder, dest_folder, ignore=shutil.ignore_patterns(*exclude_files)) + else: + print(f"Folder {folder} does not exist in the source repository.") + +def update_folders(folders, exclude_files): + print("Updating folders...") + with tempfile.TemporaryDirectory() as temp_dir: + clone_source_repo(temp_dir) + copy_folders(temp_dir, folders, exclude_files) + print("Update complete.") + +def main(): + update_folders(FOLDERS, EXCLUDE_FILES) + +if __name__ == "__main__": + main() From 22114d948c10bdc0574961285d3d9930f8714ab2 Mon Sep 17 00:00:00 2001 From: f-peverali Date: Thu, 12 Dec 2024 08:25:39 +0000 Subject: [PATCH 02/19] auto-generated FHIR files by GitHub Actions (CI FSH to FHIR Validation) --- .../resources/ValueSet-ISiKConfidentialityCodes.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/fsh-generated/resources/ValueSet-ISiKConfidentialityCodes.json b/Resources/fsh-generated/resources/ValueSet-ISiKConfidentialityCodes.json index 00f34c61..8a430263 100644 --- a/Resources/fsh-generated/resources/ValueSet-ISiKConfidentialityCodes.json +++ b/Resources/fsh-generated/resources/ValueSet-ISiKConfidentialityCodes.json @@ -5,8 +5,8 @@ "id": "ISiKConfidentialityCodes", "title": "ISiKConfidentialityCodes", "description": "Vertraulichkeitsstufen", - "url": "https://gematik.de/fhir/isik/ValueSet/ISiKConfidentialityCodes", "version": "4.0.0", + "url": "https://gematik.de/fhir/isik/ValueSet/ISiKConfidentialityCodes", "experimental": false, "publisher": "gematik GmbH", "date": "2024-09-24", From 2c2163bd598cb2dc56ca9850199e89e242af54a2 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Mon, 16 Dec 2024 12:15:16 +0100 Subject: [PATCH 03/19] added update tool folders.yml --- .github/workflows/update-tool-folders.yml | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/update-tool-folders.yml diff --git a/.github/workflows/update-tool-folders.yml b/.github/workflows/update-tool-folders.yml new file mode 100644 index 00000000..4d242220 --- /dev/null +++ b/.github/workflows/update-tool-folders.yml @@ -0,0 +1,26 @@ +name: Update Tool Folders + +on: + workflow_dispatch: + +jobs: + update-folders: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + # Add any additional dependencies if required + # pip install + + - name: Run update tool + run: python ./update-tool-folders.py From 23232e30474357781293fad4a0670bbeeb758237 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Mon, 16 Dec 2024 12:36:54 +0100 Subject: [PATCH 04/19] set back --- .github/workflows/ToolUpdate.yml | 120 ++++++++++++++++++ .../update-compile-and-validation-tools.py | 30 +++++ 2 files changed, 150 insertions(+) create mode 100644 .github/workflows/ToolUpdate.yml create mode 100644 scripts/update-compile-and-validation-tools.py diff --git a/.github/workflows/ToolUpdate.yml b/.github/workflows/ToolUpdate.yml new file mode 100644 index 00000000..a5f4f9bf --- /dev/null +++ b/.github/workflows/ToolUpdate.yml @@ -0,0 +1,120 @@ +name: Update Dependency + +on: # Trigger on commits to any branch and manual trigger + workflow_dispatch: # Allows manual trigger + push: + paths: + - 'Resources/**' + branches-ignore: + - 'main**' + pull_request: + branches: + - 'main**' + schedule: + - cron: '0 0 * * *' # Runs at 00:00 UTC every day + + +permissions: + contents: write + pull-requests: write + +jobs: + update-dependency: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + token: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions + + - name: Set up jq + run: sudo apt-get install jq + + - name: Fetch latest version of firely terminal dependency + id: fetch_version_firely + run: | + # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository + LATEST_VERSION_FIRELY=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) + echo "LATEST_VERSION_FIRELY=$LATEST_VERSION_FIRELY" >> $GITHUB_ENV + echo $LATEST_VERSION_FIRELY + + - name: Fetch latest version of Sushi dependency + id: fetch_version_sushi + run: | + # Fetch the latest version from the fhir/sushi GitHub repository + LATEST_VERSION_SUSHI=$(curl -s https://api.github.com/repos/FHIR/sushi/releases/latest | jq -r .tag_name | sed 's/^v//') + echo "LATEST_VERSION_SUSHI=$LATEST_VERSION_SUSHI" >> $GITHUB_ENV + echo $LATEST_VERSION_SUSHI + + + - name: Check if Firely version is up-to-date + id: check_firely_version + run: | + CURRENT_VERSION_FIRELY=$(grep -oP 'FirelyTeam/firely-terminal-pipeline@\K[^"]+' .github/workflows/main.yml) + if [ "$CURRENT_VERSION_FIRELY" = "$LATEST_VERSION_FIRELY" ]; then + echo "Firely version is up-to-date" + echo "update_needed=false" >> $GITHUB_ENV + else + echo "update_needed=true" >> $GITHUB_ENV + fi + + - name: Check if Sushi version is up-to-date + id: check_sushi_version + run: | + CURRENT_VERSION_SUSHI=$(grep -oP 'SUSHI_VERSION: \K[^"]+' .github/workflows/main.yml) + if [ "$CURRENT_VERSION_SUSHI" = "$LATEST_VERSION_SUSHI" ]; then + echo "Sushi version is up-to-date" + echo "update_needed=false" >> $GITHUB_ENV + else + echo "update_needed=true" >> $GITHUB_ENV + fi + + - name: Stop if no update is needed + if: env.update_needed == 'false' + continue-on-error: false + run: | + echo "No update needed. Exiting." + exit 0 + + + - name: Update main.yml for Firely and Sushi + run: | + # Update the main.yml file with the new versions of Firely and Sushi + sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION_FIRELY|" .github/workflows/main.yml + sed -i "s|SUSHI_VERSION: .*|SUSHI_VERSION: $LATEST_VERSION_SUSHI|" .github/workflows/main.yml + + - name: Commit changes + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # Commit the changes + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git checkout -b update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} || git checkout update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + git add .github/workflows/main.yml + git commit -m "Update dependencies to versions Firely: ${LATEST_VERSION_FIRELY}, Sushi: ${LATEST_VERSION_SUSHI}" + git push https://x-access-token:${{ secrets.WORKFLOW_PERMISSION_GITHUB }}@github.com/${{ github.repository }}.git update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + + - name: Create Pull Request + uses: actions/github-script@v6 + with: + script: | + const latestVersionFirely = process.env.LATEST_VERSION_FIRELY; + const latestVersionSushi = process.env.LATEST_VERSION_SUSHI; + if (!latestVersionFirely || !latestVersionSushi) { + throw new Error('Versions are not defined'); + } + const prTitle = `Update dependencies to versions Firely: ${latestVersionFirely}, Sushi: ${latestVersionSushi}`; + const prHead = `update-dependency-${latestVersionFirely}-${latestVersionSushi}`; + const prBody = `This PR updates the dependencies to versions Firely: ${latestVersionFirely} and Sushi: ${latestVersionSushi}.`; + const { data: pullRequest } = await github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: prTitle, + head: prHead, + base: context.ref.replace('refs/heads/', ''), + body: prBody, + maintainer_can_modify: true, + }); + console.log(`Created pull request: ${pullRequest.html_url}`); \ No newline at end of file diff --git a/scripts/update-compile-and-validation-tools.py b/scripts/update-compile-and-validation-tools.py new file mode 100644 index 00000000..7acb1f3f --- /dev/null +++ b/scripts/update-compile-and-validation-tools.py @@ -0,0 +1,30 @@ +### This script updates the main.yml file with the latest versions of firely-terminal and sushi and can be used locally +import requests +import os + +def get_latest_version(repo): + url = f"https://api.github.com/repos/{repo}/releases/latest" + response = requests.get(url) + response.raise_for_status() + return response.json()["tag_name"] + +if __name__ == "__main__": + firely_terminal_version = get_latest_version("FirelyTeam/firely-terminal-pipeline") + sushi_version = get_latest_version("FHIR/sushi") + + script_dir = os.path.dirname(__file__) + main_yml_path = os.path.abspath(os.path.join(script_dir, "../.github/workflows/main.yml")) + + with open(main_yml_path, "r") as file: + lines = file.readlines() + + with open(main_yml_path, "w") as file: + for line in lines: + if line.strip().startswith("uses: FirelyTeam/firely-terminal-pipeline@"): + file.write(f" uses: FirelyTeam/firely-terminal-pipeline@{firely_terminal_version}\n") + elif line.strip().startswith("SUSHI_VERSION:"): + file.write(f" SUSHI_VERSION: {sushi_version}\n") + else: + file.write(line) + + print(f"Updated main.yml with firely-terminal=={firely_terminal_version} and sushi=={sushi_version}") \ No newline at end of file From 2471d821edc29496a8ad23d35acf1622cf858396 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Mon, 16 Dec 2024 16:49:16 +0100 Subject: [PATCH 05/19] Update python file and tests --- .github/workflows/update-tool-folders.yml | 26 ----- tests/test-update-tool-folders.py | 31 +++++- ...-tool-folders.py => update_tool_folders.py | 94 +++++++++---------- 3 files changed, 77 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/update-tool-folders.yml rename update-tool-folders.py => update_tool_folders.py (97%) diff --git a/.github/workflows/update-tool-folders.yml b/.github/workflows/update-tool-folders.yml deleted file mode 100644 index 4d242220..00000000 --- a/.github/workflows/update-tool-folders.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Update Tool Folders - -on: - workflow_dispatch: - -jobs: - update-folders: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - # Add any additional dependencies if required - # pip install - - - name: Run update tool - run: python ./update-tool-folders.py diff --git a/tests/test-update-tool-folders.py b/tests/test-update-tool-folders.py index 96dc48c0..781f1a9f 100644 --- a/tests/test-update-tool-folders.py +++ b/tests/test-update-tool-folders.py @@ -1,5 +1,8 @@ import unittest -from unittest.mock import patch, call +from unittest.mock import patch, call, MagicMock +import os +import shutil +import tempfile import subprocess import update_tool_folders @@ -7,6 +10,7 @@ class TestUpdateToolFolders(unittest.TestCase): @patch('update_tool_folders.subprocess.run') def test_run_command_success(self, mock_run): + # Test that run_command works correctly when the command succeeds mock_run.return_value.returncode = 0 mock_run.return_value.stdout = "success" result = update_tool_folders.run_command("echo success") @@ -16,6 +20,7 @@ def test_run_command_success(self, mock_run): @patch('update_tool_folders.subprocess.run') def test_run_command_failure(self, mock_run): + # Test that run_command handles errors correctly when the command fails mock_run.return_value.returncode = 1 mock_run.return_value.stderr = "error" result = update_tool_folders.run_command("echo error") @@ -25,6 +30,7 @@ def test_run_command_failure(self, mock_run): @patch('update_tool_folders.run_command') def test_get_current_branch(self, mock_run_command): + # Test that get_current_branch returns the correct branch name mock_run_command.return_value.stdout = "main" current_branch = update_tool_folders.get_current_branch() self.assertEqual(current_branch, "main") @@ -32,6 +38,7 @@ def test_get_current_branch(self, mock_run_command): @patch('update_tool_folders.run_command') def test_update_folders(self, mock_run_command): + # Test that update_folders calls the correct git commands folders = ["folder1", "folder2"] current_branch = "main" update_tool_folders.update_folders(folders, current_branch) @@ -43,5 +50,27 @@ def test_update_folders(self, mock_run_command): ] mock_run_command.assert_has_calls(expected_calls, any_order=False) + @patch('update_tool_folders.shutil.copy2') + @patch('update_tool_folders.os.path.exists') + @patch('update_tool_folders.os.makedirs') + @patch('update_tool_folders.os.listdir') + @patch('update_tool_folders.shutil.copytree') + def test_additional_files_not_overwritten(self, mock_copytree, mock_listdir, mock_makedirs, mock_path_exists, mock_copy2): + # Setup mocks + mock_path_exists.side_effect = lambda path: path.endswith("dest_folder") or path.endswith("additional_file.txt") + mock_listdir.side_effect = lambda path: ["file1.txt", "file2.txt"] if path.endswith("src_folder") else ["additional_file.txt"] + + temp_dir = tempfile.gettempdir() + src_folder = os.path.join(temp_dir, "src_folder") + dest_folder = os.path.join(os.getcwd(), "dest_folder") + + # Call the function + update_tool_folders.copy_folders(temp_dir, ["src_folder"], ["file2.txt"]) + + # Check that additional files are not overwritten + mock_copy2.assert_called_once_with(os.path.join(src_folder, "file1.txt"), os.path.join(dest_folder, "file1.txt")) + mock_copytree.assert_not_called() + self.assertTrue(mock_path_exists(os.path.join(dest_folder, "additional_file.txt"))) + if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/update-tool-folders.py b/update_tool_folders.py similarity index 97% rename from update-tool-folders.py rename to update_tool_folders.py index 44f79e44..90eef93e 100644 --- a/update-tool-folders.py +++ b/update_tool_folders.py @@ -1,47 +1,47 @@ -import os -import shutil -import tempfile -import subprocess - -# Define the source repository and branch -SOURCE_REPO = "https://github.com/gematik/spec-ISiK-Basismodul" -SOURCE_BRANCH = "main-isik-stufe-4" - -# Define the list of folders to update -FOLDERS = [".github", "scripts"] - -# Define the list of files to exclude from updating -EXCLUDE_FILES = ["scripts/config.yaml"] - -def run_command(command, cwd=None): - result = subprocess.run(command, shell=True, cwd=cwd, capture_output=True, text=True) - if result.returncode != 0: - print(f"Error running command: {command}\n{result.stderr}") - return result - -def clone_source_repo(temp_dir): - run_command(f"git clone --branch {SOURCE_BRANCH} {SOURCE_REPO} {temp_dir}") - -def copy_folders(temp_dir, folders, exclude_files): - for folder in folders: - src_folder = os.path.join(temp_dir, folder) - if os.path.exists(src_folder): - dest_folder = os.path.join(os.getcwd(), folder) - if os.path.exists(dest_folder): - shutil.rmtree(dest_folder) - shutil.copytree(src_folder, dest_folder, ignore=shutil.ignore_patterns(*exclude_files)) - else: - print(f"Folder {folder} does not exist in the source repository.") - -def update_folders(folders, exclude_files): - print("Updating folders...") - with tempfile.TemporaryDirectory() as temp_dir: - clone_source_repo(temp_dir) - copy_folders(temp_dir, folders, exclude_files) - print("Update complete.") - -def main(): - update_folders(FOLDERS, EXCLUDE_FILES) - -if __name__ == "__main__": - main() +import os +import shutil +import tempfile +import subprocess + +# Define the source repository and branch +SOURCE_REPO = "https://github.com/gematik/spec-ISiK-Basismodul" +SOURCE_BRANCH = "main-isik-stufe-4" + +# Define the list of folders to update +FOLDERS = [".github", "scripts"] + +# Define the list of files to exclude from updating +EXCLUDE_FILES = ["scripts/config.yaml"] + +def run_command(command, cwd=None): + result = subprocess.run(command, shell=True, cwd=cwd, capture_output=True, text=True) + if result.returncode != 0: + print(f"Error running command: {command}\n{result.stderr}") + return result + +def clone_source_repo(temp_dir): + run_command(f"git clone --branch {SOURCE_BRANCH} {SOURCE_REPO} {temp_dir}") + +def copy_folders(temp_dir, folders, exclude_files): + for folder in folders: + src_folder = os.path.join(temp_dir, folder) + if os.path.exists(src_folder): + dest_folder = os.path.join(os.getcwd(), folder) + if os.path.exists(dest_folder): + shutil.rmtree(dest_folder) + shutil.copytree(src_folder, dest_folder, ignore=shutil.ignore_patterns(*exclude_files)) + else: + print(f"Folder {folder} does not exist in the source repository.") + +def update_folders(folders, exclude_files): + print("Updating folders...") + with tempfile.TemporaryDirectory() as temp_dir: + clone_source_repo(temp_dir) + copy_folders(temp_dir, folders, exclude_files) + print("Update complete.") + +def main(): + update_folders(FOLDERS, EXCLUDE_FILES) + +if __name__ == "__main__": + main() From e6ae668a40d7aaab0a9dac17ceb83817c6a84890 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Mon, 16 Dec 2024 17:13:10 +0100 Subject: [PATCH 06/19] Update test cases and python file --- tests/test-update-tool-folders.py | 27 ++++- ...-tool-folders.py => update_tool_folders.py | 103 ++++++++++-------- 2 files changed, 82 insertions(+), 48 deletions(-) rename update-tool-folders.py => update_tool_folders.py (68%) diff --git a/tests/test-update-tool-folders.py b/tests/test-update-tool-folders.py index 96dc48c0..be5cbe98 100644 --- a/tests/test-update-tool-folders.py +++ b/tests/test-update-tool-folders.py @@ -1,5 +1,8 @@ import unittest -from unittest.mock import patch, call +from unittest.mock import patch, call, MagicMock +import os +import shutil +import tempfile import subprocess import update_tool_folders @@ -43,5 +46,27 @@ def test_update_folders(self, mock_run_command): ] mock_run_command.assert_has_calls(expected_calls, any_order=False) + @patch('update_tool_folders.shutil.copy2') + @patch('update_tool_folders.os.path.exists') + @patch('update_tool_folders.os.makedirs') + @patch('update_tool_folders.os.listdir') + @patch('update_tool_folders.shutil.copytree') + def test_additional_files_not_overwritten(self, mock_copytree, mock_listdir, mock_makedirs, mock_path_exists, mock_copy2): + # Setup mocks + mock_path_exists.side_effect = lambda path: path.endswith("dest_folder") or path.endswith("additional_file.txt") + mock_listdir.side_effect = lambda path: ["file1.txt", "file2.txt"] if path.endswith("src_folder") else ["additional_file.txt"] + + temp_dir = tempfile.gettempdir() + src_folder = os.path.join(temp_dir, "src_folder") + dest_folder = os.path.join(os.getcwd(), "dest_folder") + + # Call the function + update_tool_folders.copy_folders(temp_dir, ["src_folder"], ["file2.txt"]) + + # Check that additional files are not overwritten + mock_copy2.assert_called_once_with(os.path.join(src_folder, "file1.txt"), os.path.join(dest_folder, "file1.txt")) + mock_copytree.assert_not_called() + self.assertTrue(mock_path_exists(os.path.join(dest_folder, "additional_file.txt"))) + if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/update-tool-folders.py b/update_tool_folders.py similarity index 68% rename from update-tool-folders.py rename to update_tool_folders.py index 44f79e44..54ee86fb 100644 --- a/update-tool-folders.py +++ b/update_tool_folders.py @@ -1,47 +1,56 @@ -import os -import shutil -import tempfile -import subprocess - -# Define the source repository and branch -SOURCE_REPO = "https://github.com/gematik/spec-ISiK-Basismodul" -SOURCE_BRANCH = "main-isik-stufe-4" - -# Define the list of folders to update -FOLDERS = [".github", "scripts"] - -# Define the list of files to exclude from updating -EXCLUDE_FILES = ["scripts/config.yaml"] - -def run_command(command, cwd=None): - result = subprocess.run(command, shell=True, cwd=cwd, capture_output=True, text=True) - if result.returncode != 0: - print(f"Error running command: {command}\n{result.stderr}") - return result - -def clone_source_repo(temp_dir): - run_command(f"git clone --branch {SOURCE_BRANCH} {SOURCE_REPO} {temp_dir}") - -def copy_folders(temp_dir, folders, exclude_files): - for folder in folders: - src_folder = os.path.join(temp_dir, folder) - if os.path.exists(src_folder): - dest_folder = os.path.join(os.getcwd(), folder) - if os.path.exists(dest_folder): - shutil.rmtree(dest_folder) - shutil.copytree(src_folder, dest_folder, ignore=shutil.ignore_patterns(*exclude_files)) - else: - print(f"Folder {folder} does not exist in the source repository.") - -def update_folders(folders, exclude_files): - print("Updating folders...") - with tempfile.TemporaryDirectory() as temp_dir: - clone_source_repo(temp_dir) - copy_folders(temp_dir, folders, exclude_files) - print("Update complete.") - -def main(): - update_folders(FOLDERS, EXCLUDE_FILES) - -if __name__ == "__main__": - main() +import os +import shutil +import tempfile +import subprocess + +# Define the source repository and branch +SOURCE_REPO = "https://github.com/gematik/spec-ISiK-Basismodul" +SOURCE_BRANCH = "main-isik-stufe-4" + +# Define the list of folders to update +FOLDERS = [".github", "scripts"] + +# Define the list of files to exclude from updating +EXCLUDE_FILES = ["scripts/config.yaml"] + +def run_command(command, cwd=None): + result = subprocess.run(command, shell=True, cwd=cwd, capture_output=True, text=True) + if result.returncode != 0: + print(f"Error running command: {command}\n{result.stderr}") + return result + +def clone_source_repo(temp_dir): + run_command(f"git clone --branch {SOURCE_BRANCH} {SOURCE_REPO} {temp_dir}") + +def copy_folders(temp_dir, folders, exclude_files): + for folder in folders: + src_folder = os.path.join(temp_dir, folder) + if os.path.exists(src_folder): + dest_folder = os.path.join(os.getcwd(), folder) + if not os.path.exists(dest_folder): + os.makedirs(dest_folder) + for root, _, files in os.walk(src_folder): + rel_path = os.path.relpath(root, src_folder) + dest_path = os.path.join(dest_folder, rel_path) + if not os.path.exists(dest_path): + os.makedirs(dest_path) + for file in files: + if file not in exclude_files: + src_file = os.path.join(root, file) + dest_file = os.path.join(dest_path, file) + shutil.copy2(src_file, dest_file) + else: + print(f"Folder {folder} does not exist in the source repository.") + +def update_folders(folders, exclude_files): + print("Updating folders...") + with tempfile.TemporaryDirectory() as temp_dir: + clone_source_repo(temp_dir) + copy_folders(temp_dir, folders, exclude_files) + print("Update complete.") + +def main(): + update_folders(FOLDERS, EXCLUDE_FILES) + +if __name__ == "__main__": + main() From 0f61edaa553be9d53a5bda2937534bfab92bb728 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Tue, 17 Dec 2024 09:43:46 +0100 Subject: [PATCH 07/19] Update github Action --- .github/workflows/ToolUpdate.yml | 120 ------------------ .github/workflows/update-tool-folders.yml | 27 ++++ .../update_tool_folders.cpython-313.pyc | Bin 0 -> 3398 bytes tests/test-update-tool-folders.py | 2 + update_tool_folders.py | 2 +- 5 files changed, 30 insertions(+), 121 deletions(-) delete mode 100644 .github/workflows/ToolUpdate.yml create mode 100644 .github/workflows/update-tool-folders.yml create mode 100644 __pycache__/update_tool_folders.cpython-313.pyc diff --git a/.github/workflows/ToolUpdate.yml b/.github/workflows/ToolUpdate.yml deleted file mode 100644 index a5f4f9bf..00000000 --- a/.github/workflows/ToolUpdate.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: Update Dependency - -on: # Trigger on commits to any branch and manual trigger - workflow_dispatch: # Allows manual trigger - push: - paths: - - 'Resources/**' - branches-ignore: - - 'main**' - pull_request: - branches: - - 'main**' - schedule: - - cron: '0 0 * * *' # Runs at 00:00 UTC every day - - -permissions: - contents: write - pull-requests: write - -jobs: - update-dependency: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - token: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions - - - name: Set up jq - run: sudo apt-get install jq - - - name: Fetch latest version of firely terminal dependency - id: fetch_version_firely - run: | - # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository - LATEST_VERSION_FIRELY=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) - echo "LATEST_VERSION_FIRELY=$LATEST_VERSION_FIRELY" >> $GITHUB_ENV - echo $LATEST_VERSION_FIRELY - - - name: Fetch latest version of Sushi dependency - id: fetch_version_sushi - run: | - # Fetch the latest version from the fhir/sushi GitHub repository - LATEST_VERSION_SUSHI=$(curl -s https://api.github.com/repos/FHIR/sushi/releases/latest | jq -r .tag_name | sed 's/^v//') - echo "LATEST_VERSION_SUSHI=$LATEST_VERSION_SUSHI" >> $GITHUB_ENV - echo $LATEST_VERSION_SUSHI - - - - name: Check if Firely version is up-to-date - id: check_firely_version - run: | - CURRENT_VERSION_FIRELY=$(grep -oP 'FirelyTeam/firely-terminal-pipeline@\K[^"]+' .github/workflows/main.yml) - if [ "$CURRENT_VERSION_FIRELY" = "$LATEST_VERSION_FIRELY" ]; then - echo "Firely version is up-to-date" - echo "update_needed=false" >> $GITHUB_ENV - else - echo "update_needed=true" >> $GITHUB_ENV - fi - - - name: Check if Sushi version is up-to-date - id: check_sushi_version - run: | - CURRENT_VERSION_SUSHI=$(grep -oP 'SUSHI_VERSION: \K[^"]+' .github/workflows/main.yml) - if [ "$CURRENT_VERSION_SUSHI" = "$LATEST_VERSION_SUSHI" ]; then - echo "Sushi version is up-to-date" - echo "update_needed=false" >> $GITHUB_ENV - else - echo "update_needed=true" >> $GITHUB_ENV - fi - - - name: Stop if no update is needed - if: env.update_needed == 'false' - continue-on-error: false - run: | - echo "No update needed. Exiting." - exit 0 - - - - name: Update main.yml for Firely and Sushi - run: | - # Update the main.yml file with the new versions of Firely and Sushi - sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION_FIRELY|" .github/workflows/main.yml - sed -i "s|SUSHI_VERSION: .*|SUSHI_VERSION: $LATEST_VERSION_SUSHI|" .github/workflows/main.yml - - - name: Commit changes - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - # Commit the changes - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git checkout -b update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} || git checkout update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} - git add .github/workflows/main.yml - git commit -m "Update dependencies to versions Firely: ${LATEST_VERSION_FIRELY}, Sushi: ${LATEST_VERSION_SUSHI}" - git push https://x-access-token:${{ secrets.WORKFLOW_PERMISSION_GITHUB }}@github.com/${{ github.repository }}.git update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} - - - name: Create Pull Request - uses: actions/github-script@v6 - with: - script: | - const latestVersionFirely = process.env.LATEST_VERSION_FIRELY; - const latestVersionSushi = process.env.LATEST_VERSION_SUSHI; - if (!latestVersionFirely || !latestVersionSushi) { - throw new Error('Versions are not defined'); - } - const prTitle = `Update dependencies to versions Firely: ${latestVersionFirely}, Sushi: ${latestVersionSushi}`; - const prHead = `update-dependency-${latestVersionFirely}-${latestVersionSushi}`; - const prBody = `This PR updates the dependencies to versions Firely: ${latestVersionFirely} and Sushi: ${latestVersionSushi}.`; - const { data: pullRequest } = await github.rest.pulls.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: prTitle, - head: prHead, - base: context.ref.replace('refs/heads/', ''), - body: prBody, - maintainer_can_modify: true, - }); - console.log(`Created pull request: ${pullRequest.html_url}`); \ No newline at end of file diff --git a/.github/workflows/update-tool-folders.yml b/.github/workflows/update-tool-folders.yml new file mode 100644 index 00000000..300f78eb --- /dev/null +++ b/.github/workflows/update-tool-folders.yml @@ -0,0 +1,27 @@ +name: Update Tool Folders + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" + +jobs: + update-tool-folders: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run update_tool_folders.py + run: python update_tool_folders.py \ No newline at end of file diff --git a/__pycache__/update_tool_folders.cpython-313.pyc b/__pycache__/update_tool_folders.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d0a3dc63e40c6673c3e5eed476145c7c8298411 GIT binary patch literal 3398 zcmbUjOKcn0@h!O|m!G92%Cf$;*ZNqZW065@S+Ok3mGyI=U!pY;22#z?%N4Z|xl6oV zLY4{yx)gAV0+xarqKX2N(g0G>3ljwBr3V)Uie3WHkrcTrp4wh|Gb956dg{Dg{*nqc zkVovi59jx0=FQ9r%eoMZZ{GVb-ohaCPqHZvOJQ;H2o_Hfk9cYfVRNQ1W$Z23V$4=- z=zt=PuXye(+KcHSPOu!CoLMpi)(2d385KB@sy`S z$cuOzP!O3v8eVjb?xxH`4uvdj$Zwy#@27Q}Ixi*?x>Z<=>0Tk4($ZLrC}}N~)^u7E zA8DBAxm-7lv4T0AmSstfb6~t=RF3s>I_2`)beEcbn8J!6s;X`U9NmRQU?dAlOw?^D zEXkT~SGAakvEQmY3e?yRoOL@E)pSBriIF&t)88BHoeilXR)eyXPy-9fd?Glc24Oq8Q(RfA8MpG~J?QB90!ijs)TDG89L22xA98&rxEh5A5F6@2OlfEAQy z>z+LL)q~9F?)5DHx3jtX;pglJDsWS(tkWPQ}R1_%Q92)F4++eUbC0|6i0sR z(F99^$Ah%!A!IzZH|a=qx`KnjRdE+?^hn9K5Hy3)|`8cc=W6&S+vX z6^Th$B|31pnvhf*+#;%y#)25ZVoJdcaDEOx^#TAe3w?tO~6Abp`7;cPSc};;*Kg+$ zRPZtKYncaGL7FI0ah159AL12oOBSg?_x^!U8hn(B%S?rg({w%azr4b+l4qQ+p+3#8 zAC#zFuc1E8POhJ1rxFz;JqGUo0AkV|{^}Myh8Wy>0<8NQT~52nLg^-+pFsVG5;Z$R zGLbQ+$y@%>XhGp`intt__z)pCg85(OJW5S`4cgZhiJ)*;NfNncEn13$S2*!k6WdHB zju9g(a?5@$ridyhD;g(0l2nb8WKNqGIWr}2BqgYlrr@Q3->q8|Ri{%?ZCg6_a#!a%pH^Jz^==r%z~Exm2<zve$U)@mRj5cD-k< zXT5)|f9s9In!xj#K)%Yi?*7!B8QZVw%(t}dbbQvad*!>9?ltc!ovFP)3@E1rT1EIWte>1<(<*((Vg+_@od9h+d#&d zufMSA`K@Ow{9XOc6DK;~^2&``Z@fB(Sl{YsW+d}=u5~=;n>h4L9=D>JMzau9CJ$24 zjY9AzSp2Z=m4mWe0Z;2~%8Av2WJ|ff30W#QIDx$}!d!^zCK6$Aq_u=!`N>q&-3sbB zx`eKxQo02P&sjKh5$HKI*?8M}5zSFX-3^g;g0wruULp`!t}+fq(gCFsq9z9XHY2Xh zLTiMb?>>}V1xNAHkc35nydtB#8bJkByB&1JmkA&*q1gDCQRpqSFa?SD24Hj%tRVoT zEIV_qi~BT}cUB)d+rD+S?K>~;cIKIeOy@q+nrF_ghIiS0=EnCnbc^)qFso z|K0)n1Lx)csBU1iT|dBD|IE4unj8XbOM`}$;l8V|sB~Z1W#xvYZ00!nf|`Vj5oLA9 z$kh1I@HDTp!{Nd4(9m#X4f5;n6FyU4L2o)xU5!Vqw`WAeXfL;PfCM_G>(8`cSILgta2pn$_6w=0+ z`Y?S)%P;ohJ8%X8fmC9bmsX0Rj*#;Ru}A345vqP^M`wOUt+-!QwXU$R@zkzLITyF$ zfVHm!TErFh6-`sVV-H2WOC8&N)D(5xX`?P2dnxJ-K%za5m-nm Date: Tue, 17 Dec 2024 09:47:19 +0100 Subject: [PATCH 08/19] update python script --- update_tool_folders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_tool_folders.py b/update_tool_folders.py index 7cb53201..48cf9027 100644 --- a/update_tool_folders.py +++ b/update_tool_folders.py @@ -11,7 +11,7 @@ FOLDERS = [".github", "scripts"] # Define the list of files to exclude from updating -EXCLUDE_FILES = ["scripts/config.yaml", ".github/workflows/Tool-Update.yml"] +EXCLUDE_FILES = ["./scripts/config.yaml", ".github/workflows/ToolUpdate.yml"] def run_command(command, cwd=None): result = subprocess.run(command, shell=True, cwd=cwd, capture_output=True, text=True) From ab3ebb8e2b7d3065ff44dd86ef99a16ddcfb7f24 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Tue, 17 Dec 2024 10:00:37 +0100 Subject: [PATCH 09/19] Update script and import current files from basis --- .../PR_Template_Contributor.md | 38 +++++++++- .../PR_Template_VersionUpgrade.md | 55 ++++++++------- .github/workflows/RenderAllDiagrams.yml | 46 ++---------- .github/workflows/TC-version-update.yml | 7 +- .github/workflows/link-check.yml | 40 +++++++++++ .github/workflows/main.yml | 70 ++++++++++++++++--- update_tool_folders.py | 2 +- 7 files changed, 179 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/link-check.yml diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md b/.github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md index 4d417179..58002236 100644 --- a/.github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md +++ b/.github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md @@ -29,4 +29,40 @@ - [ ] My code follows the code style of this IG / specification. - [ ] My change requires a change to the documentation or narrative (intend) of the IG. -- [ ] I have already updated the documentation / narrative (intend) accordingly. \ No newline at end of file +- [ ] I have already updated the documentation / narrative (intend) accordingly. + +## Reviewer / Quality Assurance Checklist + + + +- [ ] The Present PR does not need a thorough review process, due to brevity, low complexity or because it represents a rather minor change; otherwise go trough the list! ... and read the linked manual, if you did not do it yet! + +### content review steps ([based on Best Practice IG Germany](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation?version=current)) +- [ ] no content review needed +- [ ] [cardinalities in profiles](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Profilierung/Umgang-mit-Kardinalit%C3%A4ten.page.md?version=current) are added with caution (specially 'max') and are thoroughly motivated in a comment +- [ ] modifying-Elements are [highlighted](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Profilierung/Umgang-mit-Modifying-Elements.page.md?version=current) +- [ ] [meta.profile Elements](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Profilierung/Umgang-mit-Meta-Daten.page.md?version=current) not added or added with extreme caution +- [ ] [StructureDefinition.description](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Profilierung/Dokumentation-und-Nachvollziehbarkeit.page.md?version=current) is filled +- [ ] [Constrained Elements](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Profilierung/Dokumentation-und-Nachvollziehbarkeit.page.md?version=current) contain + - [ ] naming in ElementDefinition.short + - [ ] ElementDefinition.comment contains a motivation +- [ ] [Capability Statement](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Erstellung-eines-CapabilityStatements.page.md?version=current) exists + - [ ] the textual searchparameters of every instance do correspond to the definition within the CapabilityStatement +- [ ] [relevant examples exist](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Erstellung-von-Beispieldaten.page.md?version=current) + + +### formal intellectual review steps of [Implementation Guide](https://simplifier.net/guide/Best-Practice-bei-der-Implementierung-und-Spezifizierung-mit-HL7/%C3%9Cbersicht/Spezifikation/Erstellung-eines-Implementierungsleitfadens.page.md?version=current) +- [ ] no formal review needed +- [ ] proofreading for orthography + +- [ ] there are no (critical) validation Errors in the CI pipeline + - [ ] inspected and no critical errors found(In the "github action view" -> Option button -> "View raw logs") - possibly list non-critical below +- [ ] skim reading for correct rendering of IG (possibly using IG-grep of string String like "Could not render") + +### automated review steps: +- [ ] no formal review needed +- [ ] check IG-pages for broken links (possibly using plug-in) +- [ ] + +### For reviewers +You migh use this: https://conventionalcomments.org/ diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md b/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md index d0e0d423..0e438fa1 100644 --- a/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md +++ b/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md @@ -7,49 +7,56 @@ Date: ## Description -This is a Pullreuqest that requires an increase in the Version number. Therefore, multiple outside-github, related Task have to be performed and checked. +This is a Pullrequest that requires an increase in the Version number. Therefore, multiple outside-github, related Task have to be performed and checked. All jobs with an `x` in the boxes were performed to the best of knowledge. ## Pre-Merge Activities -- [ ] This PR refers to a versioned Branch with a name and a version number in the form of N.n.n, e.g. "TC_3.2.1". -- [ ] This PR has a clean meaningful committ history. Minor committs or committs without descirption have been squashed, at the latest now. -- [ ] The _./github/workflows/main.yml_ refers to the correct Firetly Terminal and SUSHI Version. - > **_Firely Terminal Pipeline_** 0.4.0. - - > **_SUSHI Versions_** 3.5.0. -- [ ] By running the _Release_Publish.py_ script, release version and date was updated accordingly. The script ran without errors. -- [ ] Eventually, increase the dependency of to newer Basis Modul (package and sushi-config) -- [ ] New Release Notes were created, aglined to the committ history and cleaned. In Github, go to - - [ ] _-> Releases_ then _-> Draft a new release_ with the _Modul Name and Version_, then - - [ ] _-> Target the main-Branch_ and _->enter a new Tag according to the Version_, then click. - - [ ] Click _-> Generate Release notes_ , _->Adjust them if necessary_ and _-> Copy/Paste the Details in the RealeaseNotes.md_ of the very Branch you want to merge. - - [ ] Finally _-> Save as Draft_ +- This PR refers to a versioned Branch with a name and a version number in the form of N.n.n, e.g. "TC_3.2.1". +- This PR has a clean meaningful commit history. Minor commits or commits without description have been squashed, at the latest now. +- The GitHub Actions "TC version update" and "CI (FHIR Validation)" finished successfully; release version and date was updated accordingly by release_publish.py (triggered by action) +- Eventually, increase the dependency of to newer Basis Modul and Basispofil-de and possibly others (package json and sushi-config) +- [ ] All release note items have been annotated as `test modifiying` OR `test stable` (the annotation should already take place within tickets for tracking reasons) +- [ ] the release notes were reviewed with a person responsible for testing +- [ ] New Release Notes were created, alined to the commit history. Possibly, if you want to check the release notes for completeness, check against automatic relesase note generation in GitHub. In Github, go to + - _-> Releases_ then _-> Draft a new release_ with the _Modul Name and Version_, then + - _-> Target the main-Branch_ and _-> enter a new Tag according to the Version_, then click. + - Click _-> Generate Release notes_ , _-> Adjust them if necessary_ and _-> Copy/Paste the Details in the RealeaseNotes.md_ of the very Branch you want to merge. + - Finally _-> Save as Draft_ ## Merge and Publishing - [ ] With the updated Version, Dates, and Release Notes (as described above) with the last committ into the Branch you want to merge. -- [ ] In GitHub _-> Actions_ the _->CI (FHIR Validation)_ workflow terminates successfully. -- [ ] Add the Approve / the PR gets posivitly reviewed by a collegue. +- [ ] In GitHub _-> Actions_ the _-> CI (FHIR Validation)_ workflow terminates successfully. +- [ ] Add the Approve / the PR gets positively reviewed by a colleague. - [ ] Merge (without squash) the PR, delete the Branch. ## Post-Merge Activities - + - [ ] Go to the corresponding SIMPLIFIER Project and _-> Github -> Reimport_ the project. - [ ] Go to the corresponding SIMPLIFIER Project and _-> Packages -> Expand the Dropdown for Create -> Create new package_ for the project. - [ ] With the corresponding version number, and - [ ] The Release notes (from above) and a compare-link to the previous Release. - - [ ] Unlist the old package by _-> clicking on the old package_, _-> go to Admininstration_ and _-> click on Unlist_ -- [ ] Publish the previosuly drafteted Release, including version number, on GitHub. -- [ ] Provide / Archive the IG in the corresponding _gh-pages_ branch of the GitHub project. - - [ ] Checkout the Branch (no need to merge it later). - - [ ] Export from Simplifier via _-> Guides -> Expand the Modul ... -> Export_ - - [ ] Unpack the zip, remove the packages folder (because its kinda big), and move everything else to a (version coressponding) new folder in the branch folder structure. - - [ ] committ the branch. + - [ ] Unlist the old package by _-> clicking on the old package_, _-> go to Administration_ and _-> click on Unlist_ +- [ ] Publish the previously drafted Release, including version number, on GitHub. +- [ ] Publish IG in Simplifier + - [ ] Provide a version in the IG title --> (x.x.x) + - [ ] Scope the IG to the published package + - [ ] Set URL key to isik-[module-name]-version (version without dots) + - [ ] Publish via Simplifier GUI (set to overwritable) + + +## Obsolete + +- Provide / Archive the IG in the corresponding _gh-pages_ branch of the GitHub project. + - Checkout the Branch (no need to merge it later). + - Export from Simplifier via _-> Guides -> Expand the Modul ... -> Export_ + - Add the zip (other tasks are automated by action called "Unzip and Update IG Version in webpage", in order to provide the Archige in the following page . https://gematik.github.io/spec-ISiK-Basismodul/index.html) +- If ISiK Basismodul was updated all depending Modules should be updated with a renewed dependency to the incremented Basismodul version - possibly including and closing technical corrections ## Finished diff --git a/.github/workflows/RenderAllDiagrams.yml b/.github/workflows/RenderAllDiagrams.yml index 13e357f6..76fe4085 100644 --- a/.github/workflows/RenderAllDiagrams.yml +++ b/.github/workflows/RenderAllDiagrams.yml @@ -37,18 +37,18 @@ jobs: # Download plantUML jar - name: Download plantuml file run: | - wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/latest/download/plantuml.jar" + wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/download/v1.2024.2/plantuml.jar" + - # Ensure Folder exsists, otherwise, create it + # Clean Folder - name: Ensure and clean folder run: | img_dir=Material/images/diagrams mkdir -p $img_dir - # do not clean - # rm -rf Material/images/diagrams/*.svg + rm -rf Material/images/diagrams/*.svg # Generate the SVGs from PUML - - name: Render PUML to SVG files + - name: Render PUML to SVG and Move files run: | FileNamePaths=$(find . -path "*/images/src/*/*.puml" -exec dirname {} \; | sort -u) for dir in $FileNamePaths @@ -72,34 +72,7 @@ jobs: format: svg action-mode: all - # Install note.js and bpmn-to-image - - name: Install Notejs and pbmn-to-image - uses: actions/setup-node@v4 - with: - node-version: 18 - - run: npm install -g bpmn-to-image - - # Generate the SVGs from BPMN - - name: Render BPMN to SVG files - run: | - FileNamePaths=$(find . -path "*/images/src/*/*.bpmn" -exec dirname {} \; | sort -u) - for dir in $FileNamePaths - do - # Render SVGs from BPMN - echo $dir - FileBaseNames=$(find $dir -name "*.bpmn" -exec basename "{}" ".bpmn" \; | sort -u) - #FileBaseNames=$(find $dir -name "*.bpmn" | xargs -L1 -I{} basename "{}") - - for base in $FileBaseNames - do - echo $base - bpmn-to-image "$dir/$base.bpmn":"$dir/$base.svg"; - done - - done - # copies the created SVG files to the images/diagrams folder and deletes the drawio files - # mv for copy and delete, here - name: Move SVGs to target image folder run: | img_dir=Material/images/diagrams @@ -108,8 +81,7 @@ jobs: for dir in $FileNamePaths do # Move SVGs to out directory - # find $dir -name "*.svg" -exec rm -rf {} $img_dir \; - find $dir -name "*.svg" -exec mv -f {} $img_dir \; + find $dir -name "*.svg" -exec mv {} $img_dir \; done ## add and commit the new generated files @@ -129,8 +101,4 @@ jobs: with: commit_user_name: GitHub Actions Bot commit_user_email: ActionBot@github.com - commit_message: auto-generated diagrams by GitHub Action after source code change - - - name: "Run if no changes have been detected" - if: steps.auto-commit-action.outputs.changes_detected == 'false' - run: echo "No Changes!" \ No newline at end of file + commit_message: auto-generated diagrams by GitHub Action after source code change \ No newline at end of file diff --git a/.github/workflows/TC-version-update.yml b/.github/workflows/TC-version-update.yml index 4d1831b4..18e8897c 100644 --- a/.github/workflows/TC-version-update.yml +++ b/.github/workflows/TC-version-update.yml @@ -1,3 +1,4 @@ + name: TC version update # Controls when the action will run. @@ -15,12 +16,12 @@ jobs: steps: - name: checkout repo content uses: actions/checkout@v2 # checkout the repository content - + - name: setup python uses: actions/setup-python@v4 with: python-version: '3.10' # install the python version needed - + - name: install python packages run: | python -m pip install --upgrade pip @@ -34,4 +35,4 @@ jobs: with: committer_name: GitHub Actions Bot committer_email: ActionBot@github.com - message: auto-generated file update of TC version by GitHub Actions (CI FSH to FHIR Validation) \ No newline at end of file + message: auto-generated file update of TC version by GitHub Actions (CI FSH to FHIR Validation) diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml new file mode 100644 index 00000000..b2d6dd50 --- /dev/null +++ b/.github/workflows/link-check.yml @@ -0,0 +1,40 @@ +name: Check Links +# This workflow checks for broken links in the repository. + +on: + pull_request: + # Trigger the workflow on any pull request targeting any branch. + branches: + - '**' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + link_checker: + # Define a job named "link_checker" that runs the link-checking process. + runs-on: ubuntu-latest + # Specify the virtual machine environment to run the job (latest Ubuntu). + + steps: + - name: Checkout repository + # Step 1: Checkout the repository code into the workflow environment. + uses: actions/checkout@v3 + # Use the official GitHub checkout action (version 3). + + - name: Run Link Checker + # Step 2: Run the Lychee link-checking tool. + uses: lycheeverse/lychee-action@v2 + # Use the Lychee GitHub Action (version 2) for link checking. + + with: + fail: true + # Configure the workflow to fail if broken links are found. + # Run the link checker on the current directory and all its contents. + # Exclude links matching the pattern for Jira links (e.g., HL7 Jira). + # Exclude all links in the "ImplementationGuide/style" directory. + # Exclude all links in the "Material" directory. + args: > + . + --exclude-path ImplementationGuide/style + --exclude-path Material + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3eabb7c0..545dae3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,8 @@ -name: Use Basis main Stufe 4 main.yml +# This is a basic workflow to help you get started with Actions -# Controls when the action will run +name: CI (FHIR Validation) + +# Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch push: @@ -11,15 +13,61 @@ on: pull_request: branches: - 'main**' + workflow_call: + secrets: + SIMPLIFIER_USERNAME: + required: true + SIMPLIFIER_PASSWORD: + required: true + WORKFLOW_PERMISSION_GITHUB: + required: true - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # Validate all resources using Firely Terminal + CI_FHIR_VALIDATION: + # The type of runner that the job will run on + runs-on: ubuntu-latest -jobs: - call-tool-update: - uses: gematik/spec-isik-basismodul/.github/workflows/main.yml@main-isik-stufe-4 - secrets: - SIMPLIFIER_USERNAME: ${{ secrets.SIMPLIFIER_USERNAME }} - SIMPLIFIER_PASSWORD: ${{ secrets.SIMPLIFIER_PASSWORD }} - WORKFLOW_PERMISSION_GITHUB: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} \ No newline at end of file + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout code (PR) + uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Checkout code (Main) + uses: actions/checkout@v4 + if: github.event_name != 'pull_request' + + # Java and .NET are already installed on ubuntu-latest + + - name: Firely.Terminal (GitHub Actions) + uses: FirelyTeam/firely-terminal-pipeline@v0.4.6 + with: + PATH_TO_CONFORMANCE_RESOURCES: Resources/fsh-generated/resources/ + #PATH_TO_EXAMPLES: Examples + PATH_TO_QUALITY_CONTROL_RULES: qc/custom + DOTNET_VALIDATION_ENABLED: true + JAVA_VALIDATION_ENABLED: true + OUTPUT_FORMAT: RAW + JAVA_VALIDATION_OPTIONS: -allow-example-urls true + SIMPLIFIER_USERNAME: ${{ secrets.SIMPLIFIER_USERNAME }} + SIMPLIFIER_PASSWORD: ${{ secrets.SIMPLIFIER_PASSWORD }} + SUSHI_ENABLED: true + SUSHI_OPTIONS: Resources/ + SUSHI_VERSION: 3.12.1 + EXPECTED_FAILS: VALIDATION_CONFORMANCE_DOTNET VALIDATION_CONFORMANCE_JAVA VALIDATION_EXAMPLES_JAVA + + - name: Add & Commit + uses: EndBug/add-and-commit@v9 + with: + committer_name: GitHub Actions Bot + committer_email: ActionBot@github.com + add: 'Resources/fsh-generated/resources/' + message: auto-generated FHIR files by GitHub Actions (CI FSH to FHIR Validation) diff --git a/update_tool_folders.py b/update_tool_folders.py index 48cf9027..c93f8477 100644 --- a/update_tool_folders.py +++ b/update_tool_folders.py @@ -11,7 +11,7 @@ FOLDERS = [".github", "scripts"] # Define the list of files to exclude from updating -EXCLUDE_FILES = ["./scripts/config.yaml", ".github/workflows/ToolUpdate.yml"] +EXCLUDE_FILES = ["config.yaml", "ToolUpdate.yml"] def run_command(command, cwd=None): result = subprocess.run(command, shell=True, cwd=cwd, capture_output=True, text=True) From fc2758e788f84eb39ae72a936e8208011abe0526 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Wed, 18 Dec 2024 13:33:56 +0100 Subject: [PATCH 10/19] update test files --- .github/workflows/ToolUpdate.yml | 120 ++++++++++++++ .../update_tool_folders.cpython-313.pyc | Bin 3398 -> 0 bytes tests/test-update-tool-folders.py | 156 ++++++++++-------- 3 files changed, 208 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/ToolUpdate.yml delete mode 100644 __pycache__/update_tool_folders.cpython-313.pyc diff --git a/.github/workflows/ToolUpdate.yml b/.github/workflows/ToolUpdate.yml new file mode 100644 index 00000000..a5f4f9bf --- /dev/null +++ b/.github/workflows/ToolUpdate.yml @@ -0,0 +1,120 @@ +name: Update Dependency + +on: # Trigger on commits to any branch and manual trigger + workflow_dispatch: # Allows manual trigger + push: + paths: + - 'Resources/**' + branches-ignore: + - 'main**' + pull_request: + branches: + - 'main**' + schedule: + - cron: '0 0 * * *' # Runs at 00:00 UTC every day + + +permissions: + contents: write + pull-requests: write + +jobs: + update-dependency: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + token: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions + + - name: Set up jq + run: sudo apt-get install jq + + - name: Fetch latest version of firely terminal dependency + id: fetch_version_firely + run: | + # Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository + LATEST_VERSION_FIRELY=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) + echo "LATEST_VERSION_FIRELY=$LATEST_VERSION_FIRELY" >> $GITHUB_ENV + echo $LATEST_VERSION_FIRELY + + - name: Fetch latest version of Sushi dependency + id: fetch_version_sushi + run: | + # Fetch the latest version from the fhir/sushi GitHub repository + LATEST_VERSION_SUSHI=$(curl -s https://api.github.com/repos/FHIR/sushi/releases/latest | jq -r .tag_name | sed 's/^v//') + echo "LATEST_VERSION_SUSHI=$LATEST_VERSION_SUSHI" >> $GITHUB_ENV + echo $LATEST_VERSION_SUSHI + + + - name: Check if Firely version is up-to-date + id: check_firely_version + run: | + CURRENT_VERSION_FIRELY=$(grep -oP 'FirelyTeam/firely-terminal-pipeline@\K[^"]+' .github/workflows/main.yml) + if [ "$CURRENT_VERSION_FIRELY" = "$LATEST_VERSION_FIRELY" ]; then + echo "Firely version is up-to-date" + echo "update_needed=false" >> $GITHUB_ENV + else + echo "update_needed=true" >> $GITHUB_ENV + fi + + - name: Check if Sushi version is up-to-date + id: check_sushi_version + run: | + CURRENT_VERSION_SUSHI=$(grep -oP 'SUSHI_VERSION: \K[^"]+' .github/workflows/main.yml) + if [ "$CURRENT_VERSION_SUSHI" = "$LATEST_VERSION_SUSHI" ]; then + echo "Sushi version is up-to-date" + echo "update_needed=false" >> $GITHUB_ENV + else + echo "update_needed=true" >> $GITHUB_ENV + fi + + - name: Stop if no update is needed + if: env.update_needed == 'false' + continue-on-error: false + run: | + echo "No update needed. Exiting." + exit 0 + + + - name: Update main.yml for Firely and Sushi + run: | + # Update the main.yml file with the new versions of Firely and Sushi + sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION_FIRELY|" .github/workflows/main.yml + sed -i "s|SUSHI_VERSION: .*|SUSHI_VERSION: $LATEST_VERSION_SUSHI|" .github/workflows/main.yml + + - name: Commit changes + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # Commit the changes + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git checkout -b update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} || git checkout update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + git add .github/workflows/main.yml + git commit -m "Update dependencies to versions Firely: ${LATEST_VERSION_FIRELY}, Sushi: ${LATEST_VERSION_SUSHI}" + git push https://x-access-token:${{ secrets.WORKFLOW_PERMISSION_GITHUB }}@github.com/${{ github.repository }}.git update-dependency-${LATEST_VERSION_FIRELY}-${LATEST_VERSION_SUSHI} + + - name: Create Pull Request + uses: actions/github-script@v6 + with: + script: | + const latestVersionFirely = process.env.LATEST_VERSION_FIRELY; + const latestVersionSushi = process.env.LATEST_VERSION_SUSHI; + if (!latestVersionFirely || !latestVersionSushi) { + throw new Error('Versions are not defined'); + } + const prTitle = `Update dependencies to versions Firely: ${latestVersionFirely}, Sushi: ${latestVersionSushi}`; + const prHead = `update-dependency-${latestVersionFirely}-${latestVersionSushi}`; + const prBody = `This PR updates the dependencies to versions Firely: ${latestVersionFirely} and Sushi: ${latestVersionSushi}.`; + const { data: pullRequest } = await github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: prTitle, + head: prHead, + base: context.ref.replace('refs/heads/', ''), + body: prBody, + maintainer_can_modify: true, + }); + console.log(`Created pull request: ${pullRequest.html_url}`); \ No newline at end of file diff --git a/__pycache__/update_tool_folders.cpython-313.pyc b/__pycache__/update_tool_folders.cpython-313.pyc deleted file mode 100644 index 0d0a3dc63e40c6673c3e5eed476145c7c8298411..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3398 zcmbUjOKcn0@h!O|m!G92%Cf$;*ZNqZW065@S+Ok3mGyI=U!pY;22#z?%N4Z|xl6oV zLY4{yx)gAV0+xarqKX2N(g0G>3ljwBr3V)Uie3WHkrcTrp4wh|Gb956dg{Dg{*nqc zkVovi59jx0=FQ9r%eoMZZ{GVb-ohaCPqHZvOJQ;H2o_Hfk9cYfVRNQ1W$Z23V$4=- z=zt=PuXye(+KcHSPOu!CoLMpi)(2d385KB@sy`S z$cuOzP!O3v8eVjb?xxH`4uvdj$Zwy#@27Q}Ixi*?x>Z<=>0Tk4($ZLrC}}N~)^u7E zA8DBAxm-7lv4T0AmSstfb6~t=RF3s>I_2`)beEcbn8J!6s;X`U9NmRQU?dAlOw?^D zEXkT~SGAakvEQmY3e?yRoOL@E)pSBriIF&t)88BHoeilXR)eyXPy-9fd?Glc24Oq8Q(RfA8MpG~J?QB90!ijs)TDG89L22xA98&rxEh5A5F6@2OlfEAQy z>z+LL)q~9F?)5DHx3jtX;pglJDsWS(tkWPQ}R1_%Q92)F4++eUbC0|6i0sR z(F99^$Ah%!A!IzZH|a=qx`KnjRdE+?^hn9K5Hy3)|`8cc=W6&S+vX z6^Th$B|31pnvhf*+#;%y#)25ZVoJdcaDEOx^#TAe3w?tO~6Abp`7;cPSc};;*Kg+$ zRPZtKYncaGL7FI0ah159AL12oOBSg?_x^!U8hn(B%S?rg({w%azr4b+l4qQ+p+3#8 zAC#zFuc1E8POhJ1rxFz;JqGUo0AkV|{^}Myh8Wy>0<8NQT~52nLg^-+pFsVG5;Z$R zGLbQ+$y@%>XhGp`intt__z)pCg85(OJW5S`4cgZhiJ)*;NfNncEn13$S2*!k6WdHB zju9g(a?5@$ridyhD;g(0l2nb8WKNqGIWr}2BqgYlrr@Q3->q8|Ri{%?ZCg6_a#!a%pH^Jz^==r%z~Exm2<zve$U)@mRj5cD-k< zXT5)|f9s9In!xj#K)%Yi?*7!B8QZVw%(t}dbbQvad*!>9?ltc!ovFP)3@E1rT1EIWte>1<(<*((Vg+_@od9h+d#&d zufMSA`K@Ow{9XOc6DK;~^2&``Z@fB(Sl{YsW+d}=u5~=;n>h4L9=D>JMzau9CJ$24 zjY9AzSp2Z=m4mWe0Z;2~%8Av2WJ|ff30W#QIDx$}!d!^zCK6$Aq_u=!`N>q&-3sbB zx`eKxQo02P&sjKh5$HKI*?8M}5zSFX-3^g;g0wruULp`!t}+fq(gCFsq9z9XHY2Xh zLTiMb?>>}V1xNAHkc35nydtB#8bJkByB&1JmkA&*q1gDCQRpqSFa?SD24Hj%tRVoT zEIV_qi~BT}cUB)d+rD+S?K>~;cIKIeOy@q+nrF_ghIiS0=EnCnbc^)qFso z|K0)n1Lx)csBU1iT|dBD|IE4unj8XbOM`}$;l8V|sB~Z1W#xvYZ00!nf|`Vj5oLA9 z$kh1I@HDTp!{Nd4(9m#X4f5;n6FyU4L2o)xU5!Vqw`WAeXfL;PfCM_G>(8`cSILgta2pn$_6w=0+ z`Y?S)%P;ohJ8%X8fmC9bmsX0Rj*#;Ru}A345vqP^M`wOUt+-!QwXU$R@zkzLITyF$ zfVHm!TErFh6-`sVV-H2WOC8&N)D(5xX`?P2dnxJ-K%za5m-nm Date: Thu, 19 Dec 2024 16:12:45 +0100 Subject: [PATCH 11/19] tests running but failing --- .vscode/settings.json | 17 +-- .../update_tool_folders.cpython-312.pyc | Bin 0 -> 3364 bytes .../test_update_tool_folders.cpython-312.pyc | Bin 0 -> 5612 bytes tests/test-update-tool-folders.py | 24 ++--- tests/test_update_tool_folders.py | 101 ++++++++++++++++++ 5 files changed, 123 insertions(+), 19 deletions(-) create mode 100644 __pycache__/update_tool_folders.cpython-312.pyc create mode 100644 tests/__pycache__/test_update_tool_folders.cpython-312.pyc create mode 100644 tests/test_update_tool_folders.py diff --git a/.vscode/settings.json b/.vscode/settings.json index b1506db8..fda052f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,14 @@ { "python.testing.unittestArgs": [ - "-v", - "-s", - "./tests", - "-p", - "test*.py" + "-v", + "-s", + "C:/Users/nils.kohl/Documents/spec-ISiK-Dokumentenaustausch/tests", + "-p", + "test*.py" ], - "python.testing.pytestEnabled": false, - "python.testing.unittestEnabled": true + "python.testing.unittestEnabled": true, + "python.testing.pytestEnabled": false, + "python.testing.nosetestsEnabled": false, + "python.testing.autoTestDiscoverOnSaveEnabled": true + } \ No newline at end of file diff --git a/__pycache__/update_tool_folders.cpython-312.pyc b/__pycache__/update_tool_folders.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d237305c607f7254ef60f596bf40c8b5f369d717 GIT binary patch literal 3364 zcma(TTTB~Q_Fj8zj~~OsgaCmg(?9}F1Ek$Fw1ki)yjnq^8xl1^q?R)?z<}+s?u<*! z4iz6=DUr~|NGsW>8)3ASpklRhS1av)X8%^&A2*mbJ6QX(U;CGmN|pMx=Z>GPkk~uA z=RW4V?m73KbNcXB!NUE;vkyNk9ZoJYs<979Iew< z(K5}5)@hr_h_*S)v|Y4|4j3I`mB@aEr&-bY8Jc#AE`To44bUxm0D2@&xt#=c}|t2tjdd>surD!<5_eaaFEx);9(Jc#10ij|L zt&2Ty^k$7pFq_Ee=yN3603RIk^Y%G<#_SfPW29TAkk3AG$Hy2pbzTYv4Xdyu8dX9d zqD6`1SE5=Zsu_$XJ<OCc;PsmW4TOC z`;H?OOIy-c|9bta>*?-H)y*tB_|jdwdh0cCLPE*6u%I3={oV(YO23O(D|sHgWzkB$ zr7P;eXZEt6V#sHmSgwQX#|uFvEb*P44@n>_%!A!|pOw(F7~It4-P?o1{+qW4CI;U( z+=b=s;SVQ$*kCm&6!D8PQK^1Bsih>fCO5yTM2R5zi4;*t6YQUauATt^W?`x`-t%9C zQvUS7Ul!93p1<+@{pY=znu&d8lGFi;K#x~!rE4C9-2~F{5Q^gme?n-*sugk2QCEJU zaLr3dFwv22-7Oetg*k@4bp6X5^wLF-V={9L{Sopj9_bMesTgM}bhI5K<0u_%MJKEE z74poOT0RM#=_O2D89qEe#WFEV=N>{2atO_UFIMa;jurM8{i=`PWd|!3ec(KX{sO5Y|{Y`2#q$TX*Z0Pq2#DjywBNy4!VkNq5gNx*tXFs-WjI z`rypAKws<6n(ooLqAZNo{0v(AHv?~HEv3~LQ6VWfREE!qTAjIS7!4-bwJGt%+P zK3-HLl@BW#FFle~jhDl`HZSq{XU@}SuF9H1VqHGBVNq0ri3GHHgIQ4IuwgezRKq?e zX*3tGp}?Xy z{#iLF0nhwCqzNJv;df7@{bef&GRpPr!mOzbVaWqUH6Z{|wgTL1+12CP5WQ zhul%o@^Q{Xbu4BA@-|@6FsGh{PzWK;+w|C;t8YkrwEj_IW_>2ru`{w)|BJ`2oSS>v z^Q7l#|C9dY#eMhr+^Lq$_Ko(J zhh8=`r>?(%AFb!Nd$xME`?mVhOj_J)y_RHiZ5Osjw??=e;e9s8%R2Hjb}DJ z8=lm?o!EZkd*32rr})Oz*%lZf-iN0TGTcQdWy8SkxcJQLrwqPkQ07+*?NU^SYo z&6M_MnEW)QmG7li$_hsnEydXR4qCC43m4r|LGJ|SX44@V>Ug)n57X)qzVcfsM@_MU zK89M+TS&!A7L4vA4BuM)BkO&%gv~^1R%x_;DHaD^UCTB3(v6lhk)Q-MoX=)n>U`!j z@0|Az*71!?#^XiP3pK%YUelF47eszOatkVviqMkmE8lpl;U z<2svV_?)x$TW8zX&bF-c!cIqyZAx}z+14C;B7QHqw8LfDt3TL~tNnXBvbi#@mVM^* z4-QyooELsn-M}x^G{9N^&e;Y|Is{mj8m%u(w_SosrQ6DNNVx_nn>U8O#1n8ds;=P} znH(P)zCC4d!}kWq?+y+7M?M%Ip867*wvJc$oGZ1~J!6~=D@9^-ku{KDGwFNXci$SW&i H@~`KA1FXq{ literal 0 HcmV?d00001 diff --git a/tests/__pycache__/test_update_tool_folders.cpython-312.pyc b/tests/__pycache__/test_update_tool_folders.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5519dd97a9c4fd7a20de2f3f21365c89e6e4c103 GIT binary patch literal 5612 zcmdT|U2GIp6u$GbKi%%Olu`ubXZeX`7g`F63JQb(r9^14KNyBiVcvrw}%#T3hE>VcWrAaT|`81c|dwCAqLR!d( zy&^|=a*`XzAO4ymc8Q(fA7O~;KZ?3t>|S<`}FYOv1&GE64DSxN{P8n$;}7fClH zSy41gGjtjF!DUItRh3?&nq{ea?qFF~n^!Ux@iq^GxJhP%WOqwG{OV+Q=i|C9->-jo zD!=paqf3)@@81qS4##F{*50{#XD}b#vLNtP5$IhN`=a*q+IzvN@RoV7KvKmnf;2N1 z>4ZjQ7g59k?m@r{I5&83gMyQwUFRy}2I3{zRPCT8(*e~g@UAd~fW|c#_89dfAJm9-^6P{!l?kAqxQvr)| z1GeEbO#HX(S6tsVw!VyJnwmb~E>hBT$uzPwrAkyCGIDQMSZKwO$^YYu8<$z}Vq{TM zmO+Pehn{KK{^9$UUwaT#ETVo1jl0BhDo1 zjS1V06s%~3!qH3MP~ws8WG^wfYfw<0hq3tNx^SLc;}U`P+@@1HBv(y|JDw0nPcStE zCf?I|+80emMLTj1Q}GE(4Qf}L8f0y?zaNmaqfSEZlr>W|S)d-}Db}8}4upxRCLVVp z^*Tn4=1g4Tg3T4UDAWHST0Q{cCRqrQUHkLVs zzHNPY{SlptcK#`lnqAYe5go|LArOVQb9y3qrUE1RvmfR=q^an|;@D%d*t6=0@KfMu_$7=zTaU>) z)YtJ8RpF>0ZmF3egUXONplWw=>mpH%8b}|ZjxLrv=x#udHlYwvEQwJKC48Z6+zjM) zt$-@8^EohFlpXfv_w`I9&-q!pHWh31XNR5BvBvROn#-TpumrMl(2mpt5qmg0ZiZy*E|l@ z+AZ>1Ad;`%GZAQ+<3oY?yg-6`XR$T6h6JlUjabk?Yp&*nXu3G}<-|Z2Hy15=hv(JF zi#FxwusO%$yEp(Nw#aBkhMkC%sItRZ9S=xMI2-U<&3LB6D7EX$9C|rtLSc*w$Kde5 zp$m^kY!R(etW_4-w8QT@K6992QUx-Jc?86)z;WEKr1lBf@`N-mh!;4ni@Vo0y|HP0 mW77g*e`i1Di5R_|`$bqkBi7w)`|QjoXFlzi6^OWjP4E}&H~Rem literal 0 HcmV?d00001 diff --git a/tests/test-update-tool-folders.py b/tests/test-update-tool-folders.py index 0f80c7f0..f3e50000 100644 --- a/tests/test-update-tool-folders.py +++ b/tests/test-update-tool-folders.py @@ -4,7 +4,7 @@ class TestUpdateToolFolders(unittest.TestCase): - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_no_additional_files_overwritten(self, mock_update_folders): # Verify that files which exist only in the target directory and not in the base directory are not overwritten by the update process. mock_update_folders.return_value = True @@ -12,7 +12,7 @@ def test_no_additional_files_overwritten(self, mock_update_folders): self.assertTrue(result) # Additional assertions to verify no additional files are overwritten - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_excluded_files_not_overwritten(self, mock_update_folders): # Ensure that files specified in the exclusion list are not overwritten during the update process, even if they exist in both the base and target directories. mock_update_folders.return_value = True @@ -20,7 +20,7 @@ def test_excluded_files_not_overwritten(self, mock_update_folders): self.assertTrue(result) # Additional assertions to verify excluded files are not overwritten - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_common_files_overwritten(self, mock_update_folders): # Confirm that files which exist in both the base and target directories are overwritten by the corresponding files from the base directory during the update process. mock_update_folders.return_value = True @@ -28,7 +28,7 @@ def test_common_files_overwritten(self, mock_update_folders): self.assertTrue(result) # Additional assertions to verify common files are overwritten - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_no_folders_to_update(self, mock_update_folders): # Verify that the update process completes successfully even if there are no folders to update. mock_update_folders.return_value = True @@ -36,7 +36,7 @@ def test_no_folders_to_update(self, mock_update_folders): self.assertTrue(result) # Additional assertions to verify process completes successfully - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_missing_folder_in_source_repo(self, mock_update_folders): # Ensure that the update process completes successfully even if a specified folder does not exist in the source repository. mock_update_folders.return_value = True @@ -44,7 +44,7 @@ def test_missing_folder_in_source_repo(self, mock_update_folders): self.assertTrue(result) # Additional assertions to verify process completes successfully - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_missing_folder_in_target_directory(self, mock_update_folders): # Verify that the update process completes successfully even if a specified folder does not exist in the target directory. mock_update_folders.return_value = True @@ -52,42 +52,42 @@ def test_missing_folder_in_target_directory(self, mock_update_folders): self.assertTrue(result) # Additional assertions to verify process completes successfully - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_invalid_source_repo(self, mock_update_folders): # Confirm that the update process fails gracefully if the source repository URL is invalid. mock_update_folders.side_effect = ValueError("Invalid source repository URL") with self.assertRaises(ValueError): update_folders(base_dir='base', target_dir='target', exclude_files=[]) - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_invalid_branch(self, mock_update_folders): # Ensure that the update process fails gracefully if the specified branch does not exist in the source repository. mock_update_folders.side_effect = ValueError("Invalid branch") with self.assertRaises(ValueError): update_folders(base_dir='base', target_dir='target', exclude_files=[]) - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_invalid_folders(self, mock_update_folders): # Verify that the update process fails gracefully if one or more specified folders do not exist in the source repository. mock_update_folders.side_effect = ValueError("Invalid folders") with self.assertRaises(ValueError): update_folders(base_dir='base', target_dir='target', exclude_files=[]) - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_invalid_exclude_files(self, mock_update_folders): # Confirm that the update process fails gracefully if one or more specified exclude files do not exist in the source repository. mock_update_folders.side_effect = ValueError("Invalid exclude files") with self.assertRaises(ValueError): update_folders(base_dir='base', target_dir='target', exclude_files=['invalid_file']) - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_invalid_temp_dir(self, mock_update_folders): # Ensure that the update process fails gracefully if the temporary directory cannot be created. mock_update_folders.side_effect = OSError("Cannot create temporary directory") with self.assertRaises(OSError): update_folders(base_dir='base', target_dir='target', exclude_files=[]) - @patch('update_tool.update_folders') + @patch('update_tool_folders.update_folders') def test_invalid_dest_folder(self, mock_update_folders): # Verify that the update process fails gracefully if the destination folder cannot be created. mock_update_folders.side_effect = OSError("Cannot create destination folder") diff --git a/tests/test_update_tool_folders.py b/tests/test_update_tool_folders.py new file mode 100644 index 00000000..4e0d738f --- /dev/null +++ b/tests/test_update_tool_folders.py @@ -0,0 +1,101 @@ +import unittest +from unittest.mock import patch +from update_tool_folders import update_folders + +class TestUpdateToolFolders(unittest.TestCase): + + @patch('update_tool_folders.update_folders') + def test_no_additional_files_overwritten(self, mock_update_folders): + # Verify that files which exist only in the target directory and not in the base directory are not overwritten by the update process. + mock_update_folders.return_value = True + result = update_folders(folders=['folder1', 'folder2'], exclude_files=[]) + print( + f"result: {result}" + ) + self.assertTrue(result) + # Additional assertions to verify no additional files are overwritten + + @patch('update_tool_folders.update_folders') + def test_excluded_files_not_overwritten(self, mock_update_folders): + # Ensure that files specified in the exclusion list are not overwritten during the update process, even if they exist in both the base and target directories. + mock_update_folders.return_value = True + result = update_folders(base_dir='base', target_dir='target', exclude_files=['excluded_file']) + self.assertTrue(result) + # Additional assertions to verify excluded files are not overwritten + + @patch('update_tool_folders.update_folders') + def test_common_files_overwritten(self, mock_update_folders): + # Confirm that files which exist in both the base and target directories are overwritten by the corresponding files from the base directory during the update process. + mock_update_folders.return_value = True + result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) + self.assertTrue(result) + # Additional assertions to verify common files are overwritten + + @patch('update_tool_folders.update_folders') + def test_no_folders_to_update(self, mock_update_folders): + # Verify that the update process completes successfully even if there are no folders to update. + mock_update_folders.return_value = True + result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) + self.assertTrue(result) + # Additional assertions to verify process completes successfully + + @patch('update_tool_folders.update_folders') + def test_missing_folder_in_source_repo(self, mock_update_folders): + # Ensure that the update process completes successfully even if a specified folder does not exist in the source repository. + mock_update_folders.return_value = True + result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) + self.assertTrue(result) + # Additional assertions to verify process completes successfully + + @patch('update_tool_folders.update_folders') + def test_missing_folder_in_target_directory(self, mock_update_folders): + # Verify that the update process completes successfully even if a specified folder does not exist in the target directory. + mock_update_folders.return_value = True + result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) + self.assertTrue(result) + # Additional assertions to verify process completes successfully + + @patch('update_tool_folders.update_folders') + def test_invalid_source_repo(self, mock_update_folders): + # Confirm that the update process fails gracefully if the source repository URL is invalid. + mock_update_folders.side_effect = ValueError("Invalid source repository URL") + with self.assertRaises(ValueError): + update_folders(base_dir='base', target_dir='target', exclude_files=[]) + + @patch('update_tool_folders.update_folders') + def test_invalid_branch(self, mock_update_folders): + # Ensure that the update process fails gracefully if the specified branch does not exist in the source repository. + mock_update_folders.side_effect = ValueError("Invalid branch") + with self.assertRaises(ValueError): + update_folders(base_dir='base', target_dir='target', exclude_files=[]) + + @patch('update_tool_folders.update_folders') + def test_invalid_folders(self, mock_update_folders): + # Verify that the update process fails gracefully if one or more specified folders do not exist in the source repository. + mock_update_folders.side_effect = ValueError("Invalid folders") + with self.assertRaises(ValueError): + update_folders(base_dir='base', target_dir='target', exclude_files=[]) + + @patch('update_tool_folders.update_folders') + def test_invalid_exclude_files(self, mock_update_folders): + # Confirm that the update process fails gracefully if one or more specified exclude files do not exist in the source repository. + mock_update_folders.side_effect = ValueError("Invalid exclude files") + with self.assertRaises(ValueError): + update_folders(base_dir='base', target_dir='target', exclude_files=['invalid_file']) + + @patch('update_tool_folders.update_folders') + def test_invalid_temp_dir(self, mock_update_folders): + # Ensure that the update process fails gracefully if the temporary directory cannot be created. + mock_update_folders.side_effect = OSError("Cannot create temporary directory") + with self.assertRaises(OSError): + update_folders(base_dir='base', target_dir='target', exclude_files=[]) + + @patch('update_tool_folders.update_folders') + def test_invalid_dest_folder(self, mock_update_folders): + # Verify that the update process fails gracefully if the destination folder cannot be created. + mock_update_folders.side_effect = OSError("Cannot create destination folder") + with self.assertRaises(OSError): + update_folders(base_dir='base', target_dir='target', exclude_files=[]) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From e72b7575bd6c8b1e0e3f36e16766d084752b2119 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Fri, 20 Dec 2024 08:20:54 +0100 Subject: [PATCH 12/19] Updated unit tests. Still failing --- .../test_update_tool_folders.cpython-312.pyc | Bin 5612 -> 4675 bytes tests/test-update-tool-folders-copilot.py | 81 +++++++++ tests/test-update-tool-folders.py | 98 ----------- tests/test_update_tool_folders.py | 166 ++++++++---------- 4 files changed, 154 insertions(+), 191 deletions(-) create mode 100644 tests/test-update-tool-folders-copilot.py delete mode 100644 tests/test-update-tool-folders.py diff --git a/tests/__pycache__/test_update_tool_folders.cpython-312.pyc b/tests/__pycache__/test_update_tool_folders.cpython-312.pyc index 5519dd97a9c4fd7a20de2f3f21365c89e6e4c103..a0706abae87810d388e73cc78f853e7335ce848c 100644 GIT binary patch literal 4675 zcmdT{O>7&-6`uVgmm+CbvSLfF?JB=8Ba?@qS526X`ywSfYbfdKL`JvD+|z{ebV>8(I}peiX+*A5W0x%4JS0RrUI_x6vJv|`=% z)FJrhy_tD4yYKtv&Fr7^`5pr0FN1VS&J*$vG@>Gf%GO7qEE0`qoI%P#&6PRd=F7Za z3uOUn-VjZxEO9tSFj8i^oaP8m#)u})6HTI|`kiR^m2ywXsMawgs?uIz}SQB zF_CsJR5()S>RciHPqZfroF~mzTy+|heYIJw;!@?BZD^D^YUGKv7#drLIeZ~X@Fm~{ zxOoDP&w~`ToF>e3WeFZ2rHS`o92Vb_B1=onljuRBx}5InkxuZCyL!k89+|ElnFNoX zt{y!J9@%=fkoTUtOda=%AIZzMZCnh48HU4;NeUz)x3vla*uhP4O``Z+C^X);V-GiC z6RD!-juM3tW{5x{ZZ;ZJ%|%+fc75KWUESAijkIcSq_yiNsmg6D(lqWKALyEJUyO9% z7b!>+Ue<*;gj{N5Rol9zPnGHw)3^*&lj(IGdhMA)#!H8M^YZk%YSc6!pl(pdlU-`g zqUxp184V3j{&~fril#GB))*-OC{VHE&v*B zkJ4=2lN<_AH@=$)dCBj@SUVR%+#nkR&oBJqruduO#d$&uYA7qEUo2xn}&9ABt`|>S>B?BELjFl$ugC6ZN(0rV!;YKSe{D zZbz&sULwzuQxJwZo+IxO4u05nU3iboaRq+DgeTgw)bgY`rn|I| zVi*Z819YaUYqPp1BlWF{3G|1};{sp33^pk~*STvB24u)DLEy70qkj5^L5-)AW8X2v z$L#{l0pagI81rrLlkt`Qmu_Yr<$D(jcQ38xpZ@sWja>fr*sZaJvDMs>Zv?XMnJ@Ma zwB&(rq*(pd!Ho0!zSlFtA2ZVH2hxq_leUa%*cMeByT(+iFgj~Dh7yO_v-N13so@a^ z(-VTI`dt45D0r+k`Hr*+2)8Xa_Dkmc6uBR#FF=d0#(cnqf)b@x=;snS!B?Z99ra%8 zMTa#e$R&PaiDMYECCSS%>eiU0d{8lJlp*ICW(}{e;y~td6}4g*R8wqArQV_4ZOWYP zPA>@ofqG3_ol(?|0D1?5rk$a8FhD?`fIQD(vQsQusc4$+>b6yZLk@ zQ_J$HRe5wn9t`x>$oTrmmF1But*bv>zp5@@RaBQjXM<9m`L)9jb&o6cY+lnYkAhx6atdCrH z>}nz4mJJ7U2k2+JfZpBpIb85(ApRZZr`Ja>ERSATlP^9o^7=ZRTc&es^7StG|G%dR zA6NEbGI&RQ@KoD0Z7X4~j&^}Bw)dH%yDj-5^~iuzk=E805I{!l}4+c(H4o>=LXbhjXx~a|XoT%x0hT zt;r{L@p*Vz9$u4+y8|32t-Jq0fbr7-LLA>~{FCgz2yt>c3TE$2GzDS8>$Bhx$Ll*> zNy1RF0z7kJCn|eooo9R;OxFRj_k(ua*Ol#mo>rnC2AFs); z?Lr67oc1~M6Qgz2Y}xOx$;`(KzLpy~eE6a8MpnpqvZCN6O;NlaMKNuy1~)Xt%PGqH zwTcn+F#H;4M^L5o>pMo)_Z<1; zbC$L*UfOGIr(^BM@RSbcN7{dBjICJ#Vkj8rnuT`|#|^I0hcPnvZR_QujuPH;{NQ>A z5^k0Lx#-Ert2f{)GKlT>aRw0=VXxtgnD)ZYm{$TYUu9#^h96bVIEYPwBiVcvrw}%#T3hE>VcWrAaT|`81c|dwCAqLR!d( zy&^|=a*`XzAO4ymc8Q(fA7O~;KZ?3t>|S<`}FYOv1&GE64DSxN{P8n$;}7fClH zSy41gGjtjF!DUItRh3?&nq{ea?qFF~n^!Ux@iq^GxJhP%WOqwG{OV+Q=i|C9->-jo zD!=paqf3)@@81qS4##F{*50{#XD}b#vLNtP5$IhN`=a*q+IzvN@RoV7KvKmnf;2N1 z>4ZjQ7g59k?m@r{I5&83gMyQwUFRy}2I3{zRPCT8(*e~g@UAd~fW|c#_89dfAJm9-^6P{!l?kAqxQvr)| z1GeEbO#HX(S6tsVw!VyJnwmb~E>hBT$uzPwrAkyCGIDQMSZKwO$^YYu8<$z}Vq{TM zmO+Pehn{KK{^9$UUwaT#ETVo1jl0BhDo1 zjS1V06s%~3!qH3MP~ws8WG^wfYfw<0hq3tNx^SLc;}U`P+@@1HBv(y|JDw0nPcStE zCf?I|+80emMLTj1Q}GE(4Qf}L8f0y?zaNmaqfSEZlr>W|S)d-}Db}8}4upxRCLVVp z^*Tn4=1g4Tg3T4UDAWHST0Q{cCRqrQUHkLVs zzHNPY{SlptcK#`lnqAYe5go|LArOVQb9y3qrUE1RvmfR=q^an|;@D%d*t6=0@KfMu_$7=zTaU>) z)YtJ8RpF>0ZmF3egUXONplWw=>mpH%8b}|ZjxLrv=x#udHlYwvEQwJKC48Z6+zjM) zt$-@8^EohFlpXfv_w`I9&-q!pHWh31XNR5BvBvROn#-TpumrMl(2mpt5qmg0ZiZy*E|l@ z+AZ>1Ad;`%GZAQ+<3oY?yg-6`XR$T6h6JlUjabk?Yp&*nXu3G}<-|Z2Hy15=hv(JF zi#FxwusO%$yEp(Nw#aBkhMkC%sItRZ9S=xMI2-U<&3LB6D7EX$9C|rtLSc*w$Kde5 zp$m^kY!R(etW_4-w8QT@K6992QUx-Jc?86)z;WEKr1lBf@`N-mh!;4ni@Vo0y|HP0 mW77g*e`i1Di5R_|`$bqkBi7w)`|QjoXFlzi6^OWjP4E}&H~Rem diff --git a/tests/test-update-tool-folders-copilot.py b/tests/test-update-tool-folders-copilot.py new file mode 100644 index 00000000..c7c13e6c --- /dev/null +++ b/tests/test-update-tool-folders-copilot.py @@ -0,0 +1,81 @@ +import unittest +import os +import shutil +import tempfile +from unittest.mock import patch +from update_tool_folders import update_folders + +class TestUpdateToolFolders(unittest.TestCase): + + def setUp(self): + self.folders = ["test_folder"] + self.exclude_files = ["config.yaml"] + self.base_dir = tempfile.mkdtemp() + os.makedirs(os.path.join(self.base_dir, "test_folder"), exist_ok=True) + + def tearDown(self): + shutil.rmtree(self.base_dir, ignore_errors=True) + + def create_file(self, directory, filename, content="test content"): + file_path = os.path.join(directory, filename) + with open(file_path, 'w') as f: + f.write(content) + return file_path + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_no_additional_files_overwritten(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(self.folders, exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, self.folders, []) + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_excluded_files_not_overwritten(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(self.folders, exclude_files=self.exclude_files) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, self.folders, self.exclude_files) + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_common_files_overwritten(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(self.folders, exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, self.folders, []) + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_no_folders_to_update(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders([], exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_not_called() + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_missing_folder_in_source_repo(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(["nonexistent_folder"], exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, ["nonexistent_folder"], []) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test-update-tool-folders.py b/tests/test-update-tool-folders.py deleted file mode 100644 index f3e50000..00000000 --- a/tests/test-update-tool-folders.py +++ /dev/null @@ -1,98 +0,0 @@ -import unittest -from unittest.mock import patch -from update_tool_folders import update_folders - -class TestUpdateToolFolders(unittest.TestCase): - - @patch('update_tool_folders.update_folders') - def test_no_additional_files_overwritten(self, mock_update_folders): - # Verify that files which exist only in the target directory and not in the base directory are not overwritten by the update process. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify no additional files are overwritten - - @patch('update_tool_folders.update_folders') - def test_excluded_files_not_overwritten(self, mock_update_folders): - # Ensure that files specified in the exclusion list are not overwritten during the update process, even if they exist in both the base and target directories. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=['excluded_file']) - self.assertTrue(result) - # Additional assertions to verify excluded files are not overwritten - - @patch('update_tool_folders.update_folders') - def test_common_files_overwritten(self, mock_update_folders): - # Confirm that files which exist in both the base and target directories are overwritten by the corresponding files from the base directory during the update process. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify common files are overwritten - - @patch('update_tool_folders.update_folders') - def test_no_folders_to_update(self, mock_update_folders): - # Verify that the update process completes successfully even if there are no folders to update. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify process completes successfully - - @patch('update_tool_folders.update_folders') - def test_missing_folder_in_source_repo(self, mock_update_folders): - # Ensure that the update process completes successfully even if a specified folder does not exist in the source repository. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify process completes successfully - - @patch('update_tool_folders.update_folders') - def test_missing_folder_in_target_directory(self, mock_update_folders): - # Verify that the update process completes successfully even if a specified folder does not exist in the target directory. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify process completes successfully - - @patch('update_tool_folders.update_folders') - def test_invalid_source_repo(self, mock_update_folders): - # Confirm that the update process fails gracefully if the source repository URL is invalid. - mock_update_folders.side_effect = ValueError("Invalid source repository URL") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_branch(self, mock_update_folders): - # Ensure that the update process fails gracefully if the specified branch does not exist in the source repository. - mock_update_folders.side_effect = ValueError("Invalid branch") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_folders(self, mock_update_folders): - # Verify that the update process fails gracefully if one or more specified folders do not exist in the source repository. - mock_update_folders.side_effect = ValueError("Invalid folders") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_exclude_files(self, mock_update_folders): - # Confirm that the update process fails gracefully if one or more specified exclude files do not exist in the source repository. - mock_update_folders.side_effect = ValueError("Invalid exclude files") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=['invalid_file']) - - @patch('update_tool_folders.update_folders') - def test_invalid_temp_dir(self, mock_update_folders): - # Ensure that the update process fails gracefully if the temporary directory cannot be created. - mock_update_folders.side_effect = OSError("Cannot create temporary directory") - with self.assertRaises(OSError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_dest_folder(self, mock_update_folders): - # Verify that the update process fails gracefully if the destination folder cannot be created. - mock_update_folders.side_effect = OSError("Cannot create destination folder") - with self.assertRaises(OSError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - -if __name__ == '__main__': - unittest.main() \ No newline at end of file diff --git a/tests/test_update_tool_folders.py b/tests/test_update_tool_folders.py index 4e0d738f..c7c13e6c 100644 --- a/tests/test_update_tool_folders.py +++ b/tests/test_update_tool_folders.py @@ -1,101 +1,81 @@ import unittest +import os +import shutil +import tempfile from unittest.mock import patch from update_tool_folders import update_folders class TestUpdateToolFolders(unittest.TestCase): - @patch('update_tool_folders.update_folders') - def test_no_additional_files_overwritten(self, mock_update_folders): - # Verify that files which exist only in the target directory and not in the base directory are not overwritten by the update process. - mock_update_folders.return_value = True - result = update_folders(folders=['folder1', 'folder2'], exclude_files=[]) - print( - f"result: {result}" - ) - self.assertTrue(result) - # Additional assertions to verify no additional files are overwritten - - @patch('update_tool_folders.update_folders') - def test_excluded_files_not_overwritten(self, mock_update_folders): - # Ensure that files specified in the exclusion list are not overwritten during the update process, even if they exist in both the base and target directories. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=['excluded_file']) - self.assertTrue(result) - # Additional assertions to verify excluded files are not overwritten - - @patch('update_tool_folders.update_folders') - def test_common_files_overwritten(self, mock_update_folders): - # Confirm that files which exist in both the base and target directories are overwritten by the corresponding files from the base directory during the update process. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify common files are overwritten - - @patch('update_tool_folders.update_folders') - def test_no_folders_to_update(self, mock_update_folders): - # Verify that the update process completes successfully even if there are no folders to update. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify process completes successfully - - @patch('update_tool_folders.update_folders') - def test_missing_folder_in_source_repo(self, mock_update_folders): - # Ensure that the update process completes successfully even if a specified folder does not exist in the source repository. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify process completes successfully - - @patch('update_tool_folders.update_folders') - def test_missing_folder_in_target_directory(self, mock_update_folders): - # Verify that the update process completes successfully even if a specified folder does not exist in the target directory. - mock_update_folders.return_value = True - result = update_folders(base_dir='base', target_dir='target', exclude_files=[]) - self.assertTrue(result) - # Additional assertions to verify process completes successfully - - @patch('update_tool_folders.update_folders') - def test_invalid_source_repo(self, mock_update_folders): - # Confirm that the update process fails gracefully if the source repository URL is invalid. - mock_update_folders.side_effect = ValueError("Invalid source repository URL") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_branch(self, mock_update_folders): - # Ensure that the update process fails gracefully if the specified branch does not exist in the source repository. - mock_update_folders.side_effect = ValueError("Invalid branch") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_folders(self, mock_update_folders): - # Verify that the update process fails gracefully if one or more specified folders do not exist in the source repository. - mock_update_folders.side_effect = ValueError("Invalid folders") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_exclude_files(self, mock_update_folders): - # Confirm that the update process fails gracefully if one or more specified exclude files do not exist in the source repository. - mock_update_folders.side_effect = ValueError("Invalid exclude files") - with self.assertRaises(ValueError): - update_folders(base_dir='base', target_dir='target', exclude_files=['invalid_file']) - - @patch('update_tool_folders.update_folders') - def test_invalid_temp_dir(self, mock_update_folders): - # Ensure that the update process fails gracefully if the temporary directory cannot be created. - mock_update_folders.side_effect = OSError("Cannot create temporary directory") - with self.assertRaises(OSError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) - - @patch('update_tool_folders.update_folders') - def test_invalid_dest_folder(self, mock_update_folders): - # Verify that the update process fails gracefully if the destination folder cannot be created. - mock_update_folders.side_effect = OSError("Cannot create destination folder") - with self.assertRaises(OSError): - update_folders(base_dir='base', target_dir='target', exclude_files=[]) + def setUp(self): + self.folders = ["test_folder"] + self.exclude_files = ["config.yaml"] + self.base_dir = tempfile.mkdtemp() + os.makedirs(os.path.join(self.base_dir, "test_folder"), exist_ok=True) + + def tearDown(self): + shutil.rmtree(self.base_dir, ignore_errors=True) + + def create_file(self, directory, filename, content="test content"): + file_path = os.path.join(directory, filename) + with open(file_path, 'w') as f: + f.write(content) + return file_path + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_no_additional_files_overwritten(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(self.folders, exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, self.folders, []) + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_excluded_files_not_overwritten(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(self.folders, exclude_files=self.exclude_files) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, self.folders, self.exclude_files) + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_common_files_overwritten(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(self.folders, exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, self.folders, []) + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_no_folders_to_update(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders([], exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_not_called() + + @patch("update_tool_folders.clone_source_repo") + @patch("update_tool_folders.copy_folders") + def test_missing_folder_in_source_repo(self, mock_copy_folders, mock_clone_source_repo): + mock_clone_source_repo.return_value = None + mock_copy_folders.return_value = None + + update_folders(["nonexistent_folder"], exclude_files=[]) + + mock_clone_source_repo.assert_called_once() + mock_copy_folders.assert_called_once_with(mock_clone_source_repo.return_value, ["nonexistent_folder"], []) if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() From 82fc346e0577294b558ea123125bf2946ad21792 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Fri, 20 Dec 2024 08:24:56 +0100 Subject: [PATCH 13/19] Test delete --- .../PR_Template_VersionUpgrade.md | 62 ------------------- .github/workflows/link-check.yml | 40 ------------ 2 files changed, 102 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md delete mode 100644 .github/workflows/link-check.yml diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md b/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md deleted file mode 100644 index 0e438fa1..00000000 --- a/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md +++ /dev/null @@ -1,62 +0,0 @@ -# Version Upgrade Template - - -Version: - -Date: - -## Description - -This is a Pullrequest that requires an increase in the Version number. Therefore, multiple outside-github, related Task have to be performed and checked. - -All jobs with an `x` in the boxes were performed to the best of knowledge. - -## Pre-Merge Activities - -- This PR refers to a versioned Branch with a name and a version number in the form of N.n.n, e.g. "TC_3.2.1". -- This PR has a clean meaningful commit history. Minor commits or commits without description have been squashed, at the latest now. -- The GitHub Actions "TC version update" and "CI (FHIR Validation)" finished successfully; release version and date was updated accordingly by release_publish.py (triggered by action) -- Eventually, increase the dependency of to newer Basis Modul and Basispofil-de and possibly others (package json and sushi-config) -- [ ] All release note items have been annotated as `test modifiying` OR `test stable` (the annotation should already take place within tickets for tracking reasons) -- [ ] the release notes were reviewed with a person responsible for testing -- [ ] New Release Notes were created, alined to the commit history. Possibly, if you want to check the release notes for completeness, check against automatic relesase note generation in GitHub. In Github, go to - - _-> Releases_ then _-> Draft a new release_ with the _Modul Name and Version_, then - - _-> Target the main-Branch_ and _-> enter a new Tag according to the Version_, then click. - - Click _-> Generate Release notes_ , _-> Adjust them if necessary_ and _-> Copy/Paste the Details in the RealeaseNotes.md_ of the very Branch you want to merge. - - Finally _-> Save as Draft_ - -## Merge and Publishing - - -- [ ] With the updated Version, Dates, and Release Notes (as described above) with the last committ into the Branch you want to merge. -- [ ] In GitHub _-> Actions_ the _-> CI (FHIR Validation)_ workflow terminates successfully. -- [ ] Add the Approve / the PR gets positively reviewed by a colleague. -- [ ] Merge (without squash) the PR, delete the Branch. - - -## Post-Merge Activities - - -- [ ] Go to the corresponding SIMPLIFIER Project and _-> Github -> Reimport_ the project. -- [ ] Go to the corresponding SIMPLIFIER Project and _-> Packages -> Expand the Dropdown for Create -> Create new package_ for the project. - - [ ] With the corresponding version number, and - - [ ] The Release notes (from above) and a compare-link to the previous Release. - - [ ] Unlist the old package by _-> clicking on the old package_, _-> go to Administration_ and _-> click on Unlist_ -- [ ] Publish the previously drafted Release, including version number, on GitHub. -- [ ] Publish IG in Simplifier - - [ ] Provide a version in the IG title --> (x.x.x) - - [ ] Scope the IG to the published package - - [ ] Set URL key to isik-[module-name]-version (version without dots) - - [ ] Publish via Simplifier GUI (set to overwritable) - - -## Obsolete - -- Provide / Archive the IG in the corresponding _gh-pages_ branch of the GitHub project. - - Checkout the Branch (no need to merge it later). - - Export from Simplifier via _-> Guides -> Expand the Modul ... -> Export_ - - Add the zip (other tasks are automated by action called "Unzip and Update IG Version in webpage", in order to provide the Archige in the following page . https://gematik.github.io/spec-ISiK-Basismodul/index.html) -- If ISiK Basismodul was updated all depending Modules should be updated with a renewed dependency to the incremented Basismodul version - possibly including and closing technical corrections - - -## Finished diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml deleted file mode 100644 index b2d6dd50..00000000 --- a/.github/workflows/link-check.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Check Links -# This workflow checks for broken links in the repository. - -on: - pull_request: - # Trigger the workflow on any pull request targeting any branch. - branches: - - '**' - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - link_checker: - # Define a job named "link_checker" that runs the link-checking process. - runs-on: ubuntu-latest - # Specify the virtual machine environment to run the job (latest Ubuntu). - - steps: - - name: Checkout repository - # Step 1: Checkout the repository code into the workflow environment. - uses: actions/checkout@v3 - # Use the official GitHub checkout action (version 3). - - - name: Run Link Checker - # Step 2: Run the Lychee link-checking tool. - uses: lycheeverse/lychee-action@v2 - # Use the Lychee GitHub Action (version 2) for link checking. - - with: - fail: true - # Configure the workflow to fail if broken links are found. - # Run the link checker on the current directory and all its contents. - # Exclude links matching the pattern for Jira links (e.g., HL7 Jira). - # Exclude all links in the "ImplementationGuide/style" directory. - # Exclude all links in the "Material" directory. - args: > - . - --exclude-path ImplementationGuide/style - --exclude-path Material - From 9c0461b258f75b4d3dd7892125d693b6d1f20302 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Fri, 20 Dec 2024 08:26:04 +0100 Subject: [PATCH 14/19] Including reimported files --- .../PR_Template_VersionUpgrade.md | 62 +++++++++++++++++++ .github/workflows/link-check.yml | 40 ++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md create mode 100644 .github/workflows/link-check.yml diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md b/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md new file mode 100644 index 00000000..0e438fa1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md @@ -0,0 +1,62 @@ +# Version Upgrade Template + + +Version: + +Date: + +## Description + +This is a Pullrequest that requires an increase in the Version number. Therefore, multiple outside-github, related Task have to be performed and checked. + +All jobs with an `x` in the boxes were performed to the best of knowledge. + +## Pre-Merge Activities + +- This PR refers to a versioned Branch with a name and a version number in the form of N.n.n, e.g. "TC_3.2.1". +- This PR has a clean meaningful commit history. Minor commits or commits without description have been squashed, at the latest now. +- The GitHub Actions "TC version update" and "CI (FHIR Validation)" finished successfully; release version and date was updated accordingly by release_publish.py (triggered by action) +- Eventually, increase the dependency of to newer Basis Modul and Basispofil-de and possibly others (package json and sushi-config) +- [ ] All release note items have been annotated as `test modifiying` OR `test stable` (the annotation should already take place within tickets for tracking reasons) +- [ ] the release notes were reviewed with a person responsible for testing +- [ ] New Release Notes were created, alined to the commit history. Possibly, if you want to check the release notes for completeness, check against automatic relesase note generation in GitHub. In Github, go to + - _-> Releases_ then _-> Draft a new release_ with the _Modul Name and Version_, then + - _-> Target the main-Branch_ and _-> enter a new Tag according to the Version_, then click. + - Click _-> Generate Release notes_ , _-> Adjust them if necessary_ and _-> Copy/Paste the Details in the RealeaseNotes.md_ of the very Branch you want to merge. + - Finally _-> Save as Draft_ + +## Merge and Publishing + + +- [ ] With the updated Version, Dates, and Release Notes (as described above) with the last committ into the Branch you want to merge. +- [ ] In GitHub _-> Actions_ the _-> CI (FHIR Validation)_ workflow terminates successfully. +- [ ] Add the Approve / the PR gets positively reviewed by a colleague. +- [ ] Merge (without squash) the PR, delete the Branch. + + +## Post-Merge Activities + + +- [ ] Go to the corresponding SIMPLIFIER Project and _-> Github -> Reimport_ the project. +- [ ] Go to the corresponding SIMPLIFIER Project and _-> Packages -> Expand the Dropdown for Create -> Create new package_ for the project. + - [ ] With the corresponding version number, and + - [ ] The Release notes (from above) and a compare-link to the previous Release. + - [ ] Unlist the old package by _-> clicking on the old package_, _-> go to Administration_ and _-> click on Unlist_ +- [ ] Publish the previously drafted Release, including version number, on GitHub. +- [ ] Publish IG in Simplifier + - [ ] Provide a version in the IG title --> (x.x.x) + - [ ] Scope the IG to the published package + - [ ] Set URL key to isik-[module-name]-version (version without dots) + - [ ] Publish via Simplifier GUI (set to overwritable) + + +## Obsolete + +- Provide / Archive the IG in the corresponding _gh-pages_ branch of the GitHub project. + - Checkout the Branch (no need to merge it later). + - Export from Simplifier via _-> Guides -> Expand the Modul ... -> Export_ + - Add the zip (other tasks are automated by action called "Unzip and Update IG Version in webpage", in order to provide the Archige in the following page . https://gematik.github.io/spec-ISiK-Basismodul/index.html) +- If ISiK Basismodul was updated all depending Modules should be updated with a renewed dependency to the incremented Basismodul version - possibly including and closing technical corrections + + +## Finished diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml new file mode 100644 index 00000000..b2d6dd50 --- /dev/null +++ b/.github/workflows/link-check.yml @@ -0,0 +1,40 @@ +name: Check Links +# This workflow checks for broken links in the repository. + +on: + pull_request: + # Trigger the workflow on any pull request targeting any branch. + branches: + - '**' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + link_checker: + # Define a job named "link_checker" that runs the link-checking process. + runs-on: ubuntu-latest + # Specify the virtual machine environment to run the job (latest Ubuntu). + + steps: + - name: Checkout repository + # Step 1: Checkout the repository code into the workflow environment. + uses: actions/checkout@v3 + # Use the official GitHub checkout action (version 3). + + - name: Run Link Checker + # Step 2: Run the Lychee link-checking tool. + uses: lycheeverse/lychee-action@v2 + # Use the Lychee GitHub Action (version 2) for link checking. + + with: + fail: true + # Configure the workflow to fail if broken links are found. + # Run the link checker on the current directory and all its contents. + # Exclude links matching the pattern for Jira links (e.g., HL7 Jira). + # Exclude all links in the "ImplementationGuide/style" directory. + # Exclude all links in the "Material" directory. + args: > + . + --exclude-path ImplementationGuide/style + --exclude-path Material + From 675b989a2ad761ce675576b7e582543b235f4eb7 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Fri, 20 Dec 2024 08:57:43 +0100 Subject: [PATCH 15/19] deleted github action yml for automated running of update python script --- .github/workflows/update-tool-folders.yml | 27 ----------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/update-tool-folders.yml diff --git a/.github/workflows/update-tool-folders.yml b/.github/workflows/update-tool-folders.yml deleted file mode 100644 index 300f78eb..00000000 --- a/.github/workflows/update-tool-folders.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Update Tool Folders - -on: - workflow_dispatch: - schedule: - - cron: "0 0 * * *" - -jobs: - update-tool-folders: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Run update_tool_folders.py - run: python update_tool_folders.py \ No newline at end of file From 39f16a9160b03767ad25af435a9721339bf85d21 Mon Sep 17 00:00:00 2001 From: nikohl-de Date: Fri, 20 Dec 2024 10:28:28 +0100 Subject: [PATCH 16/19] fixed broken links --- .lycheeignore | 6 ++++++ .../markdown/Datenobjekte/Bundle/Bundle_Profile.md | 2 +- .../markdown/Datenobjekte/CapabilityStatement.md | 2 +- .../DocumentReference/DocumentReference_Profil.md | 2 +- .../AkteureUndInteraktionen-Dokumentenabfrage.md | 2 +- .../AkteureUndInteraktionen-ErzeugenVonMetadaten.md | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 .lycheeignore diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 00000000..e007fc1f --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,6 @@ +^https?://jira\.hl7\.org +^https?://test\.krankenhaus\.de +^http://hl7\.org/fhir/StructureDefinition/condition-related +^http://hl7\.org/fhir/5\.0/StructureDefinition/extension-Encounter\.plannedStartDate +^http://hl7\.org/fhir/5\.0/StructureDefinition/extension-Encounter\.plannedEndDate +^https://gematik.de/fhir/isik/StructureDefinition/Profile \ No newline at end of file diff --git a/ImplementationGuide/markdown/Datenobjekte/Bundle/Bundle_Profile.md b/ImplementationGuide/markdown/Datenobjekte/Bundle/Bundle_Profile.md index 92bebb08..bac2c21b 100644 --- a/ImplementationGuide/markdown/Datenobjekte/Bundle/Bundle_Profile.md +++ b/ImplementationGuide/markdown/Datenobjekte/Bundle/Bundle_Profile.md @@ -3,7 +3,7 @@ {{tree:https://gematik.de/fhir/isik/StructureDefinition/ISiKDokumentenSuchergebnisse, hybrid}} -[Link Simplifier Profil Übersicht](https://simplifier.net/spec-isik-dokumentenaustausch/isikdokumentensuchergebnisse) +[Link Simplifier Profil Übersicht](https://simplifier.net/spec-isik-dokumentenaustausch-v4/isikdokumentensuchergebnisse) Folgende FHIRPath-Constraints sind im Profil zu beachten: diff --git a/ImplementationGuide/markdown/Datenobjekte/CapabilityStatement.md b/ImplementationGuide/markdown/Datenobjekte/CapabilityStatement.md index 8fdb645d..199b3161 100644 --- a/ImplementationGuide/markdown/Datenobjekte/CapabilityStatement.md +++ b/ImplementationGuide/markdown/Datenobjekte/CapabilityStatement.md @@ -18,7 +18,7 @@ Die Verwendung der [CapabilityStatement-Expectation](https://hl7.org/fhir/R4/ext Canonical: https://gematik.de/fhir/isik/CapabilityStatement/ISiKCapabilityStatementDokumentenaustauschServer -[Link Simplifier Profil Übersicht](https://simplifier.net/isik-dokumentenaustausch-v4/isik-capabilitystatement-dokumentenaustausch-server) +[Link Simplifier Profil Übersicht](https://simplifier.net/isik-dokumentenaustausch-v4/isikcapabilitystatementdokumentenaustauschserver) {{render:https://gematik.de/fhir/isik/CapabilityStatement/ISiKCapabilityStatementDokumentenaustauschServer}} diff --git a/ImplementationGuide/markdown/Datenobjekte/DocumentReference/DocumentReference_Profil.md b/ImplementationGuide/markdown/Datenobjekte/DocumentReference/DocumentReference_Profil.md index 5062b7db..5091ed8e 100644 --- a/ImplementationGuide/markdown/Datenobjekte/DocumentReference/DocumentReference_Profil.md +++ b/ImplementationGuide/markdown/Datenobjekte/DocumentReference/DocumentReference_Profil.md @@ -5,7 +5,7 @@ {{tree:https://gematik.de/fhir/isik/StructureDefinition/ISiKDokumentenMetadaten, hybrid}} -[Link Simplifier Profil Übersicht](https://simplifier.net/spec-isik-dokumentenaustausch/isikdokumentenmetadaten) +[Link Simplifier Profil Übersicht](https://simplifier.net/spec-isik-dokumentenaustausch-v4/isikdokumentenmetadaten)