Skip to content

Feature/new rio tiler #117

Feature/new rio tiler

Feature/new rio tiler #117

Workflow file for this run

name: CI
# On every pull request, but only on push to main
on:
push:
branches:
- main
tags:
- '*'
pull_request:
env:
LATEST_PY_VERSION: '3.11'
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .["test"]
- name: Run tests
run: python -m pytest --cov tilebench --cov-report xml --cov-report term-missing
- name: run pre-commit
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
run: |
python -m pip install pre-commit
pre-commit run --all-files
- name: Upload Results
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
name: ${{ matrix.python-version }}
fail_ci_if_error: false
publish:
needs: [tests]
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.LATEST_PY_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.LATEST_PY_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install hatch
python -m hatch build
- name: Set tag version
id: tag
run: |
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Set module version
id: module
run: |
echo "version=$(hatch --quiet version)" >> $GITHUB_OUTPUT
- name: Show version
run: |
echo "${{ steps.tag.outputs.version }}"
echo "${{ steps.module.outputs.version }}"
- name: publish
if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}}
env:
HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }}
HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m hatch publish
publish-docker:
needs: [tests]
if: github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set tag version
id: tag
run: |
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
# Push `latest` when commiting to main
- name: Build and push
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
context: .
file: Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
# Push `{VERSION}` when pushing a new tag
- name: Build and push
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: docker/build-push-action@v2
with:
# See https://github.com/developmentseed/titiler/discussions/387
platforms: linux/amd64
context: .
file: Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.version }}