Add ci #40
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
name: CI/CD Workflow | |
on: | |
pull_request: | |
branches: | |
- "main" | |
permissions: | |
contents: read | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python 3.8.13 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.8.13" | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: 3.8.13 | |
auto-activate-base: false | |
- name: Create test env | |
shell: bash -l {0} | |
run: | | |
conda create -n test_env python=3.8.13 libgdal=3.5.2 -c conda-forge -c defaults -y | |
conda activate test_env | |
PIP_NO_BINARY=rasterio pip install . | |
pip install pylint mccabe | |
- name: code quality | |
shell: bash -l {0} | |
run: | | |
conda activate test_env | |
pylint --disable=all --fail-under=10 --enable=too-many-statements src/eolab/georastertools/ | |
pylint --disable=all --fail-under=10 --enable=too-many-nested-blocks src/eolab/georastertools/ | |
./continuous_integration/scripts/check_mccabe_complexity.sh 25 src/eolab/georastertools | |
- name: test | |
shell: bash -l {0} | |
run: | | |
conda activate test_env | |
pytest --compare | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/georastertools | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python 3.8.13 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.8.13" | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: 3.8.13 | |
auto-activate-base: false | |
- name: Build package | |
shell: bash -l {0} | |
run: | | |
conda create -n deploy_env python=3.8.13 libgdal=3.5.2 build twine -c conda-forge -y | |
conda activate deploy_env | |
python -m build --wheel | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
verbose: true | |
password: ${{ secrets.TEST_PYPI_PASSWORD }} | |
repository-url: https://test.pypi.org/legacy/ |