From 287e7980025137193c8d9b7744742e6d5785534b Mon Sep 17 00:00:00 2001 From: Sierra Taylor Moxon Date: Fri, 1 Dec 2023 11:32:17 -0800 Subject: [PATCH 1/6] add a check dependencies action that removes the poetry.lock file and reinstalls the linkml-runtime environment (getting the latest compatible packages in the pyproject.toml specification) and then runs the tests as a round about way of testing the code in a PR on the latest package dependencies --- .github/workflows/check-dependencies.yaml | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/check-dependencies.yaml diff --git a/.github/workflows/check-dependencies.yaml b/.github/workflows/check-dependencies.yaml new file mode 100644 index 00000000..333dd143 --- /dev/null +++ b/.github/workflows/check-dependencies.yaml @@ -0,0 +1,59 @@ +# Built from: +# https://docs.github.com/en/actions/guides/building-and-testing-python +# https://github.com/actions/setup-python/ + +name: Build and test linkml-runtime + +on: [pull_request] + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ["3.7", "3.8", "3.9", "3.10"] + exclude: + - os: windows-latest + python-version: "3.7" + - os: windows-latest + python-version: "3.8" + + runs-on: ${{ matrix.os }} + + steps: + + #---------------------------------------------- + # install poetry + #---------------------------------------------- + - name: Install Poetry + # Pin to 1.3.2 to workaround https://github.com/python-poetry/poetry/issues/7611 + run: pipx install poetry==1.3.2 + + #---------------------------------------------- + # check-out repo and set-up python + #---------------------------------------------- + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'poetry' + + #---------------------------------------------- + # install your root project, if required + #---------------------------------------------- + - name: Install library + run: poetry install --no-interaction + + # this step we remove and rebuild the poetry.lock file to ensure that the tests that follow can be run + # with the latest dependencies + - name: Install dependencies + run: | + rm -rf poetry.lock + poetry install + + - name: Run tests + run: poetry run python -m unittest discover \ No newline at end of file From 05792437e27fbdd4fec5aaa64c71100af88a1bc5 Mon Sep 17 00:00:00 2001 From: Sierra Taylor Moxon Date: Fri, 1 Dec 2023 17:21:16 -0800 Subject: [PATCH 2/6] windoze support - hopefully --- .github/workflows/check-dependencies.yaml | 21 ++++++++++++--------- linkml_runtime/loaders/yaml_loader.py | 3 ++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-dependencies.yaml b/.github/workflows/check-dependencies.yaml index 333dd143..d208a5ef 100644 --- a/.github/workflows/check-dependencies.yaml +++ b/.github/workflows/check-dependencies.yaml @@ -1,8 +1,4 @@ -# Built from: -# https://docs.github.com/en/actions/guides/building-and-testing-python -# https://github.com/actions/setup-python/ - -name: Build and test linkml-runtime +name: Build and test linkml-runtime package dependencies on: [pull_request] @@ -50,10 +46,17 @@ jobs: # this step we remove and rebuild the poetry.lock file to ensure that the tests that follow can be run # with the latest dependencies - - name: Install dependencies - run: | - rm -rf poetry.lock - poetry install + + #---------------------------------------------- + # Remove and Rebuild the poetry.lock File + #---------------------------------------------- + - name: Remove poetry.lock (Unix) + if: runner.os != 'Windows' + run: rm -rf poetry.lock + + - name: Remove poetry.lock (Windows) + if: runner.os == 'Windows' + run: Remove-Item poetry.lock -Force - name: Run tests run: poetry run python -m unittest discover \ No newline at end of file diff --git a/linkml_runtime/loaders/yaml_loader.py b/linkml_runtime/loaders/yaml_loader.py index cf53be9b..eee6e973 100644 --- a/linkml_runtime/loaders/yaml_loader.py +++ b/linkml_runtime/loaders/yaml_loader.py @@ -9,6 +9,7 @@ from linkml_runtime.utils.yamlutils import YAMLRoot, DupCheckYamlLoader from pydantic import BaseModel + class YAMLLoader(Loader): """ A Loader that is capable of instantiating LinkML data objects from a YAML file @@ -34,7 +35,7 @@ def load_as_dict(self, def load_any(self, source: Union[str, dict, TextIO], - target_class: Union[Type[YAMLRoot],Type[BaseModel]], + target_class: Union[Type[YAMLRoot], Type[BaseModel]], *, base_dir: Optional[str] = None, metadata: Optional[FileInfo] = None, **_) -> Union[YAMLRoot, List[YAMLRoot]]: data_as_dict = self.load_as_dict(source, base_dir=base_dir, metadata=metadata) From d12527f3c5b645b9a9ba2e819077dfd1d040de6c Mon Sep 17 00:00:00 2001 From: Sierra Taylor Moxon Date: Mon, 18 Dec 2023 15:30:29 -0800 Subject: [PATCH 3/6] change dependency check to cron schedule --- .github/workflows/check-dependencies.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-dependencies.yaml b/.github/workflows/check-dependencies.yaml index d208a5ef..21095c4c 100644 --- a/.github/workflows/check-dependencies.yaml +++ b/.github/workflows/check-dependencies.yaml @@ -1,6 +1,11 @@ name: Build and test linkml-runtime package dependencies -on: [pull_request] +on: + schedule: + - cron: '0 5 * * *' # once per day at midnight ET + workflow_dispatch: + # Allows you to run this workflow manually from the Actions tab + types: trigger-run-check-dependencies jobs: test: From f4092e468fb7fe285e58807c1cce6eeafa668e64 Mon Sep 17 00:00:00 2001 From: Sierra Taylor Moxon Date: Mon, 18 Dec 2023 15:31:53 -0800 Subject: [PATCH 4/6] change dependency check to cron schedule --- .github/workflows/check-dependencies.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-dependencies.yaml b/.github/workflows/check-dependencies.yaml index 21095c4c..610162af 100644 --- a/.github/workflows/check-dependencies.yaml +++ b/.github/workflows/check-dependencies.yaml @@ -2,7 +2,7 @@ name: Build and test linkml-runtime package dependencies on: schedule: - - cron: '0 5 * * *' # once per day at midnight ET + - cron: '0 5 * * 1' # once per week on Monday at 05:00 UTC workflow_dispatch: # Allows you to run this workflow manually from the Actions tab types: trigger-run-check-dependencies From 30f983f72353c5873d99726590dba9d1c378cfb9 Mon Sep 17 00:00:00 2001 From: Sierra Taylor Moxon Date: Tue, 19 Dec 2023 09:24:13 -0800 Subject: [PATCH 5/6] per code review, remove python 3.7 --- .github/workflows/check-dependencies.yaml | 4 ++-- .github/workflows/main.yaml | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-dependencies.yaml b/.github/workflows/check-dependencies.yaml index 610162af..d418f8bc 100644 --- a/.github/workflows/check-dependencies.yaml +++ b/.github/workflows/check-dependencies.yaml @@ -1,4 +1,4 @@ -name: Build and test linkml-runtime package dependencies +name: Build and test linkml-runtime with latest dependency versions on: schedule: @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10"] exclude: - os: windows-latest python-version: "3.7" diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7a92c1a0..adc087d3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,10 +12,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10"] exclude: - - os: windows-latest - python-version: "3.7" - os: windows-latest python-version: "3.8" From a39fd65a6e9290e343819c96af8c63a00f562982 Mon Sep 17 00:00:00 2001 From: Sierra Taylor Moxon Date: Tue, 19 Dec 2023 09:25:44 -0800 Subject: [PATCH 6/6] remove 3.7 windows check --- .github/workflows/check-dependencies.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/check-dependencies.yaml b/.github/workflows/check-dependencies.yaml index d418f8bc..3a43f463 100644 --- a/.github/workflows/check-dependencies.yaml +++ b/.github/workflows/check-dependencies.yaml @@ -15,8 +15,6 @@ jobs: os: [ubuntu-latest, windows-latest] python-version: ["3.8", "3.9", "3.10"] exclude: - - os: windows-latest - python-version: "3.7" - os: windows-latest python-version: "3.8"