Test on MapServer 8.2 schema #230
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: Test Python package | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install project and dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | |
pip install .[lark_cython] | |
- name: Lint with flake8 | |
run: | | |
flake8 . | |
- name: Check types with mypy | |
run: | | |
mypy mappyfile tests docs/examples | |
- name: Command line tests | |
run: | | |
mappyfile schema mapfile-schema.json | |
mappyfile schema mapfile-schema-8-2.json --version=8.2 | |
mappyfile validate tests/sample_maps/256_overlay_res.map | |
mappyfile format tests/sample_maps/256_overlay_res.map tests/sample_maps/256_overlay_res_formatted.map | |
- name: Test API examples | |
run: | | |
pytest docs/examples/api/ | |
- name: Test with pytest without lark_cython | |
env: | |
MAPPYFILE_USE_CYTHON: "false" | |
run: | | |
pytest | |
- name: Test with pytest | |
run: | | |
pytest --cov mappyfile --cov-report= tests/ | |
- name: Upload coverage data to coveralls.io | |
run: | | |
coveralls | |
env: | |
COVERALLS_FLAG_NAME: ${{ matrix.test-name }} | |
COVERALLS_PARALLEL: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
- name: Build wheel and source distributions | |
run: | | |
pip install wheel | |
pip install build | |
python -m build --wheel | |
python -m build --sdist | |
- name: Publish package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.python-version == '3.10' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
user: __token__ | |
password: ${{ secrets.MAPPYFILE_DEPLOY }} | |
# see https://github.com/marketplace/actions/coveralls-github-action | |
# we can't use coveralls-github-action as it doesn't support xml output | |
# see https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support | |
coveralls: | |
name: Indicate completion to coveralls.io | |
needs: test | |
runs-on: ubuntu-latest | |
container: python:3-slim | |
steps: | |
- name: Finished | |
run: | | |
pip3 install --upgrade coveralls | |
coveralls --service=github --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |