From 59267b9ca164d0722fbac3b126a96682c979af42 Mon Sep 17 00:00:00 2001 From: Jo Basevi Date: Thu, 23 May 2024 09:56:49 +1000 Subject: [PATCH] Update CI: Test dist install and test run model-config-tests cmd --- .github/workflows/CI.yml | 27 +++++++++++++++++++++++++-- pyproject.toml | 10 +++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a00ee78..9283a43 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -36,8 +36,31 @@ jobs: - name: Upload distribution artifact uses: actions/upload-artifact@v4 with: + name: release path: dist + install_from_dist: + needs: [ 'pypi-build' ] + name: Test install from distribution + runs-on: ubuntu-latest + steps: + - name: Download distribution + uses: actions/download-artifact@v4 + with: + name: release + path: dist + + - name: Setup Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install model_config_tests + run: python3 -m pip install ./dist/model_config_tests-*.tar.gz + + - name: Run model-config-tests command + run: model-config-tests --collect-only -m "checksum" + tests: name: Tests runs-on: ubuntu-latest @@ -56,11 +79,11 @@ jobs: python-version: ${{ matrix.python-version }} cache: pip - - name: Install model_config_tests + - name: Install model_config_tests with test dependencies run: python3 -m pip install -e '.[test]' - name: Run tests - run: python3 -m pytest -s + run: python3 -m pytest -s --cov=./src --cov-report=xml tests - name: Upload code coverage uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c #v4.4.1 diff --git a/pyproject.toml b/pyproject.toml index 5a27610..17d4c55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "model-config-tests" +name = "model_config_tests" version = "0.0.1" authors = [ { name = "ACCESS-NRI" }, @@ -20,12 +20,12 @@ dependencies = [ "requests", "pytest >=8.0.1", "ruamel.yaml >=0.18.5", + "jsonschema >=4.21.1" ] [project.optional-dependencies] test = [ - "pytest-cov", - "jsonschema >=4.21.1" + "pytest-cov" ] [project.scripts] @@ -41,10 +41,6 @@ requires = [ "setuptools >= 61.0.0", ] -[tool.pytest.ini_options] -addopts = "--cov=./src --cov-report=xml" -testpaths = ["tests"] - [tool.ruff] target-version = "py39" exclude = [