Skip to content

Commit

Permalink
Update CI: Test dist install and test run model-config-tests cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-basevi committed May 23, 2024
1 parent 9d012ed commit 59267b9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "model-config-tests"
name = "model_config_tests"
version = "0.0.1"
authors = [
{ name = "ACCESS-NRI" },
Expand All @@ -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]
Expand All @@ -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 = [
Expand Down

0 comments on commit 59267b9

Please sign in to comment.