generated from ACCESS-NRI/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from ACCESS-NRI/3-Package-model-config-tests
Package model-config-tests
- Loading branch information
Showing
23 changed files
with
642 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
pypi-build: | ||
name: Build package for PyPI | ||
if: github.repository == 'access-nri/model-config-tests' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install build dependencies | ||
run: python3 -m pip install --upgrade build | ||
|
||
- name: Build distributions | ||
run: python3 -m build | ||
|
||
- name: Upload distribution artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release | ||
path: dist | ||
|
||
pypi-publish: | ||
# Split build and publish to restrict trusted publishing to just this workflow | ||
needs: ['pypi-build'] | ||
name: Publish to PyPI.org | ||
runs-on: ubuntu-latest | ||
environment: release | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: release | ||
path: dist | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1 | ||
|
||
pypi-build: | ||
name: Build package for PyPI | ||
if: github.repository == 'access-nri/model-config-tests' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
cache: 'pip' | ||
|
||
- name: Install build dependencies | ||
run: python3 -m pip install --upgrade build | ||
|
||
- name: Build distributions | ||
run: python3 -m build | ||
|
||
- 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 | ||
|
||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11" ] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: pip | ||
|
||
- name: Install model_config_tests with test dependencies | ||
run: python3 -m pip install -e '.[test]' | ||
|
||
- name: Run tests | ||
run: python3 -m pytest -s --cov=./src --cov-report=xml tests | ||
|
||
- name: Upload code coverage | ||
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c #v4.4.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.pyc | ||
/__pycache__ | ||
/build | ||
/dist | ||
*.egg-info | ||
.coverage | ||
.ipynb_checkpoints | ||
.vscode | ||
.idea | ||
/tests/tmp/ | ||
coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.4.4 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.4.2 | ||
hooks: | ||
- id: black | ||
language_version: python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
[project] | ||
name = "model_config_tests" | ||
version = "0.0.1" | ||
authors = [ | ||
{ name = "ACCESS-NRI" }, | ||
] | ||
description = "Test for ACCESS model (payu) configurations" | ||
readme = "README.md" | ||
requires-python = ">=3.9" | ||
license = { text = "Apache-2.0" } | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: POSIX :: Linux", | ||
] | ||
dependencies = [ | ||
"f90nml >=0.16", | ||
"requests", | ||
"PyYAML", | ||
"requests", | ||
"pytest >=8.0.1", | ||
"ruamel.yaml >=0.18.5", | ||
"jsonschema >=4.21.1" | ||
] | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"pytest-cov" | ||
] | ||
|
||
[project.scripts] | ||
model-config-tests = "model_config_tests.__main__:main" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/ACCESS-NRI/model-config-tests/" | ||
Issues = "https://github.com/ACCESS-NRI/model-config-tests/issues" | ||
|
||
[build-system] | ||
build-backend = "setuptools.build_meta" | ||
requires = [ | ||
"setuptools >= 61.0.0", | ||
] | ||
|
||
[tool.ruff] | ||
target-version = "py39" | ||
exclude = [ | ||
".bzr", | ||
".direnv", | ||
".eggs", | ||
".git", | ||
".git-rewrite", | ||
".hg", | ||
".ipynb_checkpoints", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pyenv", | ||
".pytest_cache", | ||
".pytype", | ||
".ruff_cache", | ||
".svn", | ||
".tox", | ||
".venv", | ||
".vscode", | ||
"__pypackages__", | ||
"_build", | ||
"buck-out", | ||
"build", | ||
"dist", | ||
"node_modules", | ||
"site-packages", | ||
"venv", | ||
] | ||
|
||
[tool.ruff.lint] | ||
# E402: module level import not at top of file | ||
# E501: line too long - let black worry about that | ||
ignore = [ | ||
"E402", | ||
"E501", | ||
] | ||
select = [ | ||
# Pyflakes | ||
"F", | ||
# Pycodestyle | ||
"E", | ||
"W", | ||
# isort | ||
"I", | ||
# Pyupgrade | ||
"UP", | ||
] | ||
|
||
[tool.ruff.lint.mccabe] | ||
max-complexity = 18 | ||
|
||
[tool.ruff.lint.isort] | ||
known-first-party = ["model_config_tests"] |
This file was deleted.
Oops, something went wrong.
Empty file.
Oops, something went wrong.