Skip to content

Commit 03f94aa

Browse files
authored
Merge pull request #299 from JamesParrott/Synced_with_PyShp
Define test running in a reuseable action. Rename build.yml. Test before deployment. Only deploy from this repo, and only test on MacOS and Windows here..
2 parents 89498e4 + 8c9bd56 commit 03f94aa

File tree

4 files changed

+119
-53
lines changed

4 files changed

+119
-53
lines changed

.github/actions/test/action.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name:
2+
Test
3+
4+
description:
5+
Run pytest, and run the doctest runner (shapefile.py as a script).
6+
7+
runs:
8+
using: "composite"
9+
steps:
10+
# The Repo is required to already be checked out, e.g. by the calling workflow
11+
12+
# The Python to be tested with is required to already be setup, with "python" and "pip" on the system Path
13+
14+
- name: Doctests
15+
shell: bash
16+
run: python shapefile.py
17+
18+
- name: Install test dependencies.
19+
shell: bash
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements.test.txt
23+
24+
- name: Pytest
25+
shell: bash
26+
run: |
27+
pytest
28+
29+
- name: Show versions for logs.
30+
shell: bash
31+
run: |
32+
python --version
33+
python -m pytest --version

.github/workflows/build.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,24 @@ jobs:
2323
uses: actions/setup-python@v2
2424
with:
2525
python-version: '3.x'
26+
27+
# In general tests should be run after building a distribution, to test that distribution.
28+
# However as long as PyShp is a pure Python library, with pure Python deps (or no deps)
29+
# then it's not crucial.
30+
31+
# Prevent deployment of releases that fail any hooks (e.g. linting) or that fail any tests.
32+
- name: Run tests and hooks
33+
uses: ./.github/workflows/run_tests_and_hooks.yml
34+
2635
- name: Install dependencies
2736
run: |
2837
python -m pip install --upgrade pip
2938
pip install build
3039
- name: Build package
3140
run: python -m build
41+
3242
- name: Publish package
43+
if: github.repository == 'GeospatialPython/pyshp'
3344
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
3445
with:
3546
user: __token__
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This workflow will run the pre-commit hooks (including linters), and the tests with a variety of Python versions
2+
3+
name: Run pre-commit hooks and tests
4+
5+
on:
6+
push:
7+
pull_request:
8+
branches: [ master ]
9+
workflow_call:
10+
workflow_dispatch:
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
- uses: pre-commit/[email protected]
19+
20+
test_in_slim_Python_containers:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
python-version: [
25+
"2.7",
26+
"3.5",
27+
"3.6",
28+
"3.7",
29+
"3.8",
30+
"3.9",
31+
"3.10",
32+
"3.11",
33+
"3.12",
34+
"3.13.0a2",
35+
]
36+
37+
runs-on: ubuntu-latest
38+
container:
39+
image: python:${{ matrix.python-version }}-slim
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Run tests
45+
uses: ./.github/actions/test
46+
47+
48+
test_on_MacOS_and_Windows:
49+
if: github.repository == 'GeospatialPython/pyshp'
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
python-version: [
54+
"3.12",
55+
]
56+
os: [
57+
"macos-latest",
58+
"windows-latest",
59+
]
60+
# include:
61+
# - os: "windows-latest"
62+
# python-version: "3.13"
63+
# - os: "macos-latest"
64+
# python-version: "3.13"
65+
66+
runs-on: matrix.os
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- uses: actions/setup-python@v5
71+
with:
72+
python-version: ${{ inputs.python_version }}
73+
74+
- name: Run tests
75+
uses: ./.github/actions/test

0 commit comments

Comments
 (0)