Skip to content

Commit

Permalink
Add ci-cd for package
Browse files Browse the repository at this point in the history
  • Loading branch information
GratienDSX committed Dec 12, 2024
1 parent 8d70cad commit 788ead3
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 13 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: Package CI/CD
on:
push:
branches:
- main
tags:
- '*' # Later: \b[0-9]\.[0-9]+\.[0-9]+[ab]?[0-9]?\b
pull_request:
types:
- opened
- synchronize
branches:
- main

jobs:
pre-commit:
name: Apply pre-commit hooks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install extra dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,test]
- name: Cache pre-commit hooks
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit hooks
run: pre-commit run --all-files
publish:
needs: pre-commit
if: success() && startsWith(github.ref, 'refs/tags')
name: Publish release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build package
run: |
python -m pip install --upgrade build
python -m build
- name: Upload package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion docs/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="col-sm-4 entete sidebar">
<div class="sidebar-container">
<div class="sidebar-content">
<img alt="logo meteole" src="assets/img/svg/meteole-fond-clair.svg">
<img alt="logo meteole" src="assets/img/svg/meteole-fond-clair.svg" style="max-width:450px">
</div>
</div>
</div>
Expand Down
19 changes: 7 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ authors = [
]

classifiers = [ #
"Development Status :: 5 - Production/Stable",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
# "Programming Language :: Python :: 3.12", no wheels 3.12 for dependency ecmwflibs
"Topic :: Software Development :: Libraries :: Python Modules",
]

dependencies = [
Expand All @@ -36,22 +36,17 @@ dependencies = [

[project.optional-dependencies]
test = ["pytest", "coverage"]
doc = ["mkdocs-material", "mkdocstrings[python]"]
doc = ["mkdocs-material", "mkdocstrings[python]", "jinja2==3.0.3"]
mypy = ["mypy"]
ruff = ["ruff"]
all = [
"meteole[test]",
"meteole[doc]",
"meteole[mypy]",
"meteole[ruff]",
"pre-commit",
]
dev = ["mypy", "pre-commit", "ruff"]
all = ["meteole[test,dev,doc,mypy,ruff]"]

[tool.setuptools]
package-dir = { "" = "src" } #
package-dir = { "" = "src" }

[tool.pytest.ini_options]
pythonpath = ["src"] #
pythonpath = ["src"]
testpaths = ["tests"]

[tool.mypy]
Expand Down

0 comments on commit 788ead3

Please sign in to comment.