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 separate workflows for building and publishing Python package #4

Merged
merged 9 commits into from
Sep 20, 2024
38 changes: 21 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
name: Publish Python Package
name: Build and Test Python Package

on:
push:
tags:
- 'v*.*.*'
branches:
- main
pull_request:
branches:
- main

jobs:
release:
test:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.x'
auto-update-conda: true
python-version: "3.10"
channels: conda-forge

- name: Install build dependencies
- name: Create Conda environment with Python 3.10 and PDAL
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
conda create --name pyforestscan_env python=3.10 pdal gdal -c conda-forge -v

- name: Run tests
- name: Activate Conda environment and install dependencies
shell: bash -l {0}
run: |
conda activate pyforestscan_env
pip install -r requirements.txt
pip install -r requirements-dev.txt
pytest

- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: Run tests
shell: bash -l {0}
run: |
python setup.py sdist bdist_wheel
twine upload dist/* -u __token__ -p $PYPI_TOKEN
conda activate pyforestscan_env
pytest
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Python Package

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

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine

- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/* -u __token__ -p $PYPI_TOKEN
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pip install pyforestscan
> You MUST have installed PDAL to use PyForestScan. If you use conda to install PDAL, make sure you install pyforestscan in the conda environment with PDAL. See https://pdal.io/en/latest/ for more information.

- PDAL >= 2.7
- Python >= 3.8
- Python >= 3.10

## Quick Start

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Operating System :: OS Independent",
],
packages=setuptools.find_packages(),
python_requires=">=3.8",
python_requires=">=3.10",
install_requires=[
'rasterio>=1.3.11',
'pdal>=3.4.5',
Expand Down
Binary file removed test_data/output.tif
Binary file not shown.
Loading