-
-
Notifications
You must be signed in to change notification settings - Fork 20
94 lines (87 loc) · 2.97 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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 }}