diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6e91fc4..b6c130e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: pipx install poetry - name: Install dependencies run: | - poetry install + make install - name: Run tests run: | - poetry run pytest -s -x + make test diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 1e90f9b..c97ca9a 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -25,4 +25,5 @@ jobs: restore-keys: | mkdocs-material- - run: pip install mkdocs-material + - run: make gen-docs - run: mkdocs gh-deploy --force diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 55e795f..a7b71d3 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -21,7 +21,7 @@ jobs: pipx install poetry - name: Install dependencies run: | - poetry install + make install - name: Start Kind Cluster uses: helm/kind-action@v1 with: @@ -29,9 +29,9 @@ jobs: - name: Start distribution-registry run: | ./e2e/deploy_distribution_registry.sh - - name: Run tests + - name: Run E2E tests run: | - poetry run pytest --e2e -s -x + make test-e2e e2e-zot: runs-on: ubuntu-latest steps: @@ -46,7 +46,7 @@ jobs: pipx install poetry - name: Install dependencies run: | - poetry install + make install - name: Start Kind Cluster uses: helm/kind-action@v1 with: @@ -54,6 +54,6 @@ jobs: - name: Start Zot run: | ./e2e/deploy_zot.sh - - name: Run tests + - name: Run E2E tests run: | - poetry run pytest --e2e -s -x + make test-e2e diff --git a/.gitignore b/.gitignore index 8671f9d..0e069cf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,9 @@ tmp efi-variable-store *.onnx mr-integration/config/ml-metadata/metadata.sqlite.db + +# Generated python library wheels dist + +# Mkdocs +site diff --git a/Makefile b/Makefile index cda7423..ddf353f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,28 @@ +.PHONY: install +install: + poetry install + +.PHONY: gen-docs +gen-docs: install + poetry run python docs/appendixes/gen-appendix-links.py docs/ + .PHONY: docs-live -docs-live: +docs-live: gen-docs docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material +.PHONY: docs-build +docs-build: gen-docs + docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material build + +.PHONY: build +build: install + poetry build + +.PHONY: test +test: + poetry run pytest -s -x -rA + +.PHONY: test-e2e +test-e2e: + poetry run pytest --e2e -s -x -rA diff --git a/docs/appendixes/appendix-links.md b/docs/appendixes/appendix-links.md new file mode 100644 index 0000000..eb333db --- /dev/null +++ b/docs/appendixes/appendix-links.md @@ -0,0 +1,14 @@ + +# Appendix "All links" + +This is a collection of all the links from this website: + +- https://docs.sigstore.dev/ +- https://github.com/kubeflow/community/pull/682#issuecomment-2130072374 +- https://github.com/kubernetes/enhancements/pull/4639 +- https://github.com/lampajr/oci-storage-initializer/blob/main/GET_STARTED.md +- https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidelines-for-artifact-usage +- https://www.cncf.io/projects/confidential-containers +- https://www.kubeflow.org/docs/components/model-registry +- https://www.openpolicyagent.org/ + diff --git a/docs/appendixes/gen-appendix-links.py b/docs/appendixes/gen-appendix-links.py new file mode 100644 index 0000000..cbfcdd1 --- /dev/null +++ b/docs/appendixes/gen-appendix-links.py @@ -0,0 +1,42 @@ +from markdown_it.tree import SyntaxTreeNode +from markdown_it import MarkdownIt + +import os +import fnmatch +import click + +@click.command() +@click.argument('dir', required=True) +def parse_markdown_files(dir): + all_href = get_all_hrefs(dir) + with open(f"{dir}/appendixes/appendix-links.md", "w") as appendix: + appendix.write(""" +# Appendix "All links" + +This is a collection of all the links from this website: + +""" + ) + for e in all_href: + appendix.write(f"- {e}\n") + appendix.write("\n") + +def get_all_hrefs(dir): + md = MarkdownIt("commonmark") + all_href = [] + for root, _, files in os.walk(dir): + for filename in fnmatch.filter(files, '*.md'): + if filename == "appendix-links.md": + continue # skip appendix-links file itself + with open(f"{root}/{filename}", "r") as f: + tokens = md.parse(f.read()) + node = SyntaxTreeNode(tokens) + for n in node.walk(): + if n.type == "link": + all_href.append(n.attrs["href"]) + all_href.sort() + print(all_href) + return all_href + +if __name__ == '__main__': + parse_markdown_files() diff --git a/mkdocs.yml b/mkdocs.yml index 85ac9a1..a8e973d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -19,6 +19,8 @@ nav: - 'Demo 3: Signature and Attestation': 'demos/demo3.md' - Use Cases: 'use-cases.md' - Glossary: 'glossary.md' + - Appendixes: + - 'All links': 'appendixes/appendix-links.md' extra: social: - icon: fontawesome/brands/github diff --git a/poetry.lock b/poetry.lock index e842c5b..1b7ee9d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -708,6 +708,30 @@ files = [ {file = "jupyterlab_pygments-0.3.0.tar.gz", hash = "sha256:721aca4d9029252b11cfa9d185e5b5af4d54772bb8072f9b7036f4170054d35d"}, ] +[[package]] +name = "markdown-it-py" +version = "3.0.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = false +python-versions = ">=3.8" +files = [ + {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, + {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + [[package]] name = "markupsafe" version = "2.1.5" @@ -791,6 +815,17 @@ files = [ [package.dependencies] traitlets = "*" +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + [[package]] name = "mistune" version = "3.0.2" @@ -1781,4 +1816,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "7785e680936a46daa82fb2db74edeef4dd8b694397328a41ff85bb3542c49372" +content-hash = "9b7cc03e0be0b3ba8a30976b1c277d7d9205fd5532d1985a19e7917c09131f21" diff --git a/pyproject.toml b/pyproject.toml index db149e8..81521d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ pytest-mock = "^3.14.0" jq = "^1.7.0" scikit-learn = "^1.5.0" ipykernel = "^6.29.4" +markdown-it-py = "^3.0.0" [tool.poetry.scripts] omlmd = "omlmd.cli:cli" diff --git a/tests/conftest.py b/tests/conftest.py index ae420c5..7ba656f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,12 +3,12 @@ def pytest_collection_modifyitems(config, items): if config.getoption("--e2e"): - skip_not_e2e = pytest.mark.skip(reason="skipping non-e2e tests") + skip_not_e2e = pytest.mark.skip(reason="skipping non-e2e tests; opt-out of --e2e option to run.") for item in items: if "e2e" not in item.keywords: item.add_marker(skip_not_e2e) return - skip_e2e = pytest.mark.skip(reason="test requires --e2e option to run") + skip_e2e = pytest.mark.skip(reason="this is an end-to-end test, requires explicit opt-in --e2e option to run.") for item in items: if "e2e" in item.keywords: item.add_marker(skip_e2e)