Skip to content

Commit

Permalink
Merge pull request #65 from MiraGeoscience/DEVOPS-551
Browse files Browse the repository at this point in the history
DEVOPS-551: add auto-deploy workflows to las-geoh5
  • Loading branch information
sebhmg committed Oct 31, 2024
1 parent f4bcc55 commit 2e60b3a
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 4 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/python_deploy_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy python package in development

on:
push:
tags:
- 'v*' # Push events to every version tag (eg. v1.0.0)

jobs:
call-workflow-conda-publish:
name: Publish development conda package on JFrog Artifactory
uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_conda_package.yml@main
with:
package-name: 'las-geoh5'
python-version: '3.10'
virtual-repo-names: '["public-conda-dev"]'
secrets:
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
call-workflow-pypi-publish:
name: Publish development pypi package (JFrog Artifactory and TestPyPI)
uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_pypi_package.yml@main
with:
package-manager: 'poetry'
package-name: 'las-geoh5'
version-tag: ${{ github.ref_name }}
python-version: '3.10'
virtual-repo-names: '["public-pypi-dev", "test-pypi"]'
secrets:
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/python_deploy_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy python package in production

on:
release:
types: [published]

jobs:
call-workflow-conda-publish:
name: Publish production conda package on JFrog Artifactory
uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_conda_package.yml@main
with:
package-name: 'las-geoh5'
python-version: '3.10'
virtual-repo-names: '["public-conda-prod"]'
secrets:
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
call-workflow-pypi-publish:
name: Publish production pypi package (JFrog Artifactory and PyPI)
uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_pypi_package.yml@main
with:
package-manager: 'poetry'
package-name: 'las-geoh5'
version-tag: ${{ github.ref_name }}
python-version: '3.10'
virtual-repo-names: '["public-pypi-prod", "pypi"]'
secrets:
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ repos:
pydantic==2.5.*,
tomli, # to read config from pyproject.toml
types-toml,
types-PyYAML,
]
exclude: ^(docs|las_geoh5-assets)/
- repo: https://github.com/codingjoe/relint
Expand Down Expand Up @@ -78,6 +79,7 @@ repos:
exclude_types: [jupyter]
- id: check-toml
- id: check-yaml
exclude: ^meta.yaml$
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
Expand Down
60 changes: 60 additions & 0 deletions meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{% set name = "las-geoh5" %}
{% set version = "0.3.0a2" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
# url: https://github.com/MiraGeoscience/{{ name }}/archive/v{{ version }}.tar.gz
# sha256: 1c20e6bb021516ef89de8551dc1f47f944bc98ea83d3da393d13e71469add43d
path: ../{{ name }}

build:
noarch: python
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
number: 0
entry_points:
- geoh5_to_las = las_geoh5.scripts.geoh5_to_las:main
- las_to_geoh5 = las_geoh5.scripts.las_to_geoh5:main

requirements:
host:
- pip
- python >=3.10.0,<3.11
- poetry-core >=1.0.0
- setuptools
- setuptools_scm
run:
- python >=3.9.0,<3.11
- geoh5py >=0.10.0a1,<0.11.0
- lasio >=0.31
- numpy >=1.26.0,<1.27.0
- pydantic >=2.5.2,<2.6.0
- tqdm >=4.66.1,<4.67.0

test:
imports:
- las_geoh5
commands:
- pip list
- pip check
requires:
- pip

about:
home: https://www.mirageoscience.com/mining-industry-software/python-integration/
summary: 'Import/Export LAS files to/from geoh5 format.'
description: |
Import/Export LAS files to/from geoh5 format.
This package allows for import and export of LAS files to and from a drillhole group. There is a module each for import and export operations. Each of these includes a driver and a ui.json that parameterizes the driver and renders a UI for use within Geoscience ANALYST Pro. Read on to learn how to install las-geoh5 and get started importing and exporting LAS files.
license: MIT
license_file:
- LICENSE
doc_url: https://mirageoscience-las-geoh5.readthedocs-hosted.com/en/stable/
dev_url: https://github.com/MiraGeoscience/las-geoh5

extra:
recipe-maintainers:
- SophieCurinier
- sebhmg
66 changes: 64 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Pygments = "*"
pylint = "*"
pytest = "*"
pytest-cov = "*"
pyyaml = '*'
jinja2 = '*'
packaging = '*'
tomli = "*"
sphinx = "*"
sphinx-autodoc-typehints = "*"
Expand Down
38 changes: 36 additions & 2 deletions tests/version_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,46 @@
from __future__ import annotations

import re
from pathlib import Path

import tomli as toml
import yaml
from jinja2 import Template
from packaging.version import Version

import las_geoh5


def test_version_is_consistent(pyproject: dict):
assert las_geoh5.__version__ == pyproject["tool"]["poetry"]["version"]
def get_version():
path = Path(__file__).resolve().parents[1] / "pyproject.toml"

with open(str(path), encoding="utf-8") as file:
pyproject = toml.loads(file.read())

return pyproject["tool"]["poetry"]["version"]


def get_conda_recipe_version():
path = Path(__file__).resolve().parents[1] / "meta.yaml"

with open(str(path), encoding="utf-8") as file:
content = file.read()

template = Template(content)
rendered_yaml = template.render()

recipe = yaml.safe_load(rendered_yaml)

return recipe["package"]["version"]


def test_version_is_consistent():
assert las_geoh5.__version__ == get_version()


def test_conda_version_is_pep440():
version = Version(get_conda_recipe_version())
assert version is not None


def test_version_is_semver():
Expand Down

0 comments on commit 2e60b3a

Please sign in to comment.