diff --git a/.github/workflows/backend-check.yaml b/.github/workflows/backend-check.yaml index 241b70c7..06c7f517 100644 --- a/.github/workflows/backend-check.yaml +++ b/.github/workflows/backend-check.yaml @@ -73,13 +73,14 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - uses: Gr1N/setup-poetry@v9 - name: Install dependencies run: | - python -m pip install --upgrade pip + cd backend + poetry install - name: Run functional tests in pod run: | cd backend diff --git a/.github/workflows/build-push.yaml b/.github/workflows/build-push.yaml index b2580dba..87f9fb0f 100644 --- a/.github/workflows/build-push.yaml +++ b/.github/workflows/build-push.yaml @@ -16,7 +16,12 @@ jobs: fetch-depth: 10 - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.9" + - uses: Gr1N/setup-poetry@v9 + - name: Install dependencies + run: | + cd backend + poetry install - name: Build Frontend Image id: build-front @@ -39,7 +44,9 @@ jobs: password: ${{ secrets.QUAY_TOKEN }} - name: Generate version file - run: ./backend/scripts/version.py + run: | + cd backend + poetry run scripts/version.py - name: Build Backend Image id: build-back diff --git a/.github/workflows/frontend-check.yaml b/.github/workflows/frontend-check.yaml index fcbea36d..06b1c54f 100644 --- a/.github/workflows/frontend-check.yaml +++ b/.github/workflows/frontend-check.yaml @@ -21,8 +21,15 @@ jobs: run: working-directory: ./frontend steps: - - name: checkout project - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.9" + - uses: Gr1N/setup-poetry@v9 + - name: Install dependencies + run: | + cd ../backend + poetry install - name: build tests image run: podman build -t cypress -f e2e_frontend.containerfile . - name: Make e2e script executable @@ -35,4 +42,3 @@ jobs: with: name: cypress-coverage-report path: frontend/coverage - diff --git a/.github/workflows/poetry-check.yaml b/.github/workflows/poetry-check.yaml index 821e61ea..3e4e618a 100644 --- a/.github/workflows/poetry-check.yaml +++ b/.github/workflows/poetry-check.yaml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.9" - uses: Gr1N/setup-poetry@v9 - name: verify poetry instalation run: poetry --version diff --git a/.github/workflows/release-build-push.yaml b/.github/workflows/release-build-push.yaml index b2a1eda4..9ebcb9ee 100644 --- a/.github/workflows/release-build-push.yaml +++ b/.github/workflows/release-build-push.yaml @@ -17,7 +17,12 @@ jobs: fetch-depth: 10 - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.9" + - uses: Gr1N/setup-poetry@v9 + - name: Install dependencies + run: | + cd backend + poetry install - name: Build Frontend Image id: build-front @@ -40,7 +45,9 @@ jobs: password: ${{ secrets.QUAY_TOKEN }} - name: Generate version file - run: ./backend/scripts/version.py + run: | + cd backend + poetry run scripts/version.py - name: Build Backend Image id: build-back diff --git a/backend/VERSION b/backend/VERSION deleted file mode 100644 index 0c62199f..00000000 --- a/backend/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.2.1 diff --git a/backend/poetry.lock b/backend/poetry.lock index 16ad1d28..da656719 100644 --- a/backend/poetry.lock +++ b/backend/poetry.lock @@ -2173,6 +2173,18 @@ files = [ {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] +[[package]] +name = "tomlkit" +version = "0.13.3" +description = "Style preserving TOML library" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "tomlkit-0.13.3-py3-none-any.whl", hash = "sha256:c89c649d79ee40629a9fda55f8ace8c6a1b42deb912b2a8fd8d942ddadb606b0"}, + {file = "tomlkit-0.13.3.tar.gz", hash = "sha256:430cf247ee57df2b94ee3fbe588e71d362a941ebb545dec29b53961d61add2a1"}, +] + [[package]] name = "tox" version = "4.25.0" @@ -2628,4 +2640,4 @@ propcache = ">=0.2.1" [metadata] lock-version = "2.1" python-versions = ">=3.9,<3.10" -content-hash = "3652bbf33feaae574dfd87563b35b51bbb18ba002a0538069f80f52a7ea1b1f2" +content-hash = "d19ed5a01b36a99f4767a2669481bd2b736a99c64e2128fe3089e4376ee2001f" diff --git a/backend/pyproject.toml b/backend/pyproject.toml index dbf19506..fb6594ed 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -2,8 +2,8 @@ name = "openshift_perfscale_api" requires-python = ">=3.9,<3.10" dynamic = ["dependencies"] -version = "0.1.1" -description = "Python transformer of OpenShift performance and scale test results" +version = "0.2.2" +description = "Aggregator for Performance & Scale CPT data" authors = [{name = "mleader", email = "mleader@redhat.com"}] [tool.poetry] @@ -35,6 +35,7 @@ trio = "^0.28.0" uvicorn = "^0.34.0" uvloop = "^0.21.0" vyper-config = "1.0.0" +tomlkit = "^0.13.3" [tool.poetry.group.dev.dependencies] black = "^24.4.2" diff --git a/backend/scripts/version.py b/backend/scripts/version.py index 24b2ffe3..07d0c696 100755 --- a/backend/scripts/version.py +++ b/backend/scripts/version.py @@ -12,6 +12,8 @@ import sys from typing import Optional +import tomlkit + def do(cmd: list[str]) -> list[str]: result = subprocess.run(cmd, text=True, capture_output=True) @@ -32,7 +34,9 @@ def getone(cmd: list[str], if_none: Optional[str] = None) -> str: def main(): top = Path(getone(["git", "rev-parse", "--show-toplevel"])) backend = top / "backend" - version = (backend / "VERSION").read_text().strip() + with (backend / "pyproject.toml").open() as tml: + config = tomlkit.load(tml) + version = config["project"]["version"] sha = getone(["git", "rev-parse", "--short", "HEAD"]) branch = getone(["git", "branch", "--show-current"], if_none="CI") display = f"v{version}-{sha}" @@ -53,8 +57,4 @@ def main(): if __name__ == "__main__": - try: - sys.exit(main()) - except Exception as exc: - print(f"Failed with {str(exc)!r}", file=sys.stderr) - sys.exit(1) + sys.exit(main()) diff --git a/testing/pod_setup.sh b/testing/pod_setup.sh index 0aaf9768..b32f1348 100755 --- a/testing/pod_setup.sh +++ b/testing/pod_setup.sh @@ -62,7 +62,7 @@ echo "Creating pod ${POD_NAME}" podman pod create --name=${POD_NAME} ${PUBLISH} echo "Creating version" -${BACKEND}/scripts/version.py +( cd ${BACKEND}; poetry run scripts/version.py ) podman build -f backend.containerfile --tag backend "${BACKEND}" podman build -f frontend.containerfile --tag frontend "${FRONTEND}" podman build -f ${TESTING}/functional.containerfile --tag functional "${BRANCH}"