Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gh-action to create a release on v*.*.* tags #13

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cicd_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build docker image
run: docker build -t ${{ env.DOCKER_IMAGE_NAME }}:test .
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/cicd_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
tags:
- "v*.*.*"

jobs:
release-github:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Release on github
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
make_latest: true

deploy-pypi:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/pdal-ign-macro/
permissions:
contents: read
packages: write
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- name: Checkout branch
uses: actions/checkout@v4

# See https://github.com/marketplace/actions/setup-micromamba
- name: setup-micromamba
uses: mamba-org/[email protected]
with:
environment-file: environment.yml
environment-name: pdal_ign_plugin # activate the environment
cache-environment: true
cache-downloads: true
generate-run-shell: true

- name: Build pip package
shell: micromamba-shell {0}
run: |
rm -rf tmp
rm -rf pdal_ign_macro.egg-info
rm -rf dist
python -m build

- name: pypi-publish
uses: pypa/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/cicd_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install cppunit
run: sudo apt install -y libcppunit-dev
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ xcode
.vscode
build
install
dist

# all pycache directories
__pycache__
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ ENV PROJ_LIB=/opt/conda/envs/pdal_ign_plugin/share/proj/
ENV PDAL_DRIVER_PATH=/pdal_ign_plugin/install/lib

# Install python macro module
COPY macro /pdal_ign_plugin/macro
COPY pdal_ign_macro /pdal_ign_plugin/pdal_ign_macro
COPY pyproject.toml /pdal_ign_plugin/pyproject.toml
WORKDIR /pdal_ign_plugin
RUN pip install .

# Add example scripts + test data (to be able to test inside the docker image)
COPY scripts /pdal_ign_plugin/scripts
COPY test /pdal_ign_plugin/test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ docker image.
### Syntax to use it in a python script

```python
from macro import macro
from pdal_ign_macro import macro

marco.my_macro(...)
```
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dependencies:
- isort # import sorting
- flake8 # code analysis
- pytest
- build
- twine
alavenant marked this conversation as resolved.
Show resolved Hide resolved
# --------- pip & pip libraries --------- #
- pip
- pip:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pdal

from macro import macro
from pdal_ign_macro import macro

"""
This tool applies a pdal pipeline to select points for DSM and DTM calculation
Expand Down Expand Up @@ -42,7 +42,9 @@ def parse_args():
return parser.parse_args()


def main(input_las, output_las, dsm_dimension, dtm_dimension, output_dsm, output_dtm):
def mark_points_to_use_for_digital_models_with_new_dimension(
input_las, output_las, dsm_dimension, dtm_dimension, output_dsm, output_dtm
):
pipeline = pdal.Pipeline() | pdal.Reader.las(input_las)

# 0 - ajout de dimensions temporaires et de sortie
Expand Down Expand Up @@ -192,4 +194,4 @@ def main(input_las, output_las, dsm_dimension, dtm_dimension, output_dsm, output

if __name__ == "__main__":
args = parse_args()
main(**vars(args))
mark_points_to_use_for_digital_models_with_new_dimension(**vars(args))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pdal

from macro import macro
from pdal_ign_macro import macro

"""
This tool shows how to use functions of macro in a pdal pipeline
Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[project]
name = "pdal_ign_macro"
dynamic = ["version"]
readme = "README.md"
description = "Macros and pipelines for Pdal based on the https://github.com/IGNF/pdal-ign-plugin plugin"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comme c'est la description du package python, j'aurai mis un truc qui fait la difference entre le python et le c++, comme ça :

"Python examples to use C++ PDAL plugin https://github.com/IGNF/pdal-ign-plugin"

Enfin c'est qu'une suggestion, c'est comme tu préfères.

dependencies = []
authors = [
{ name = "Antoine Lavenant", email = "[email protected]" },
{ name = "Léa Vauchier", email = "[email protected]" },
]

[tool.setuptools.dynamic]
version = { attr = "macro.version.__version__" }
version = { attr = "pdal_ign_macro.version.__version__" }

[tool.setuptools]
packages = ["macro"]
packages = ["pdal_ign_macro"]

[tool.black]
line-length = 99
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
import numpy as np
import pdal

from scripts.mark_points_to_use_for_digital_models_with_new_dimension import main
from pdal_ign_macro.mark_points_to_use_for_digital_models_with_new_dimension import (
mark_points_to_use_for_digital_models_with_new_dimension,
)


def test_main():
ini_las = "test/data/4_6.las"
dsm_dimension = "dsm_marker"
dtm_dimension = "dtm_marker"
with tempfile.NamedTemporaryFile(suffix="_mark_points_output.las") as las_output:
main(ini_las, las_output.name, dsm_dimension, dtm_dimension, "", "")
mark_points_to_use_for_digital_models_with_new_dimension(
ini_las, las_output.name, dsm_dimension, dtm_dimension, "", ""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

niveau lecture, on sait pas trop à quoi ça correspond "", ""

ce serait plus lisible avec les noms des parametres

output_dsm=""

output_dtm=""

)
pipeline = pdal.Pipeline()
pipeline |= pdal.Reader.las(las_output.name)
assert dsm_dimension in pipeline.quickinfo["readers.las"]["dimensions"].split(", ")
Expand Down