@@ -17,30 +17,38 @@ inputs:
1717 description : Path to where the PyShp repo was checked out to (to keep separate from Shapefiles & artefacts repo).
1818 required : false
1919 default : ' .'
20- python-version :
21- description : Set to "2.7" to use caddy instead of python -m SimpleHTTPServer
22- required : true
2320
2421
2522
2623runs :
2724 using : " composite"
2825 steps :
2926 # The PyShp repo is required to already be checked out into pyshp_repo_directory,
27+ # and the wheel to be tested in ./dist within it.
3028 # e.g. by the calling workflow using:
3129 # steps:
3230 # - uses: actions/checkout@v4
3331 # with:
3432 # path: ./Pyshp
33+ #
34+ # - name: Build distribution artefacts (wheel and sdist)
35+ # uses: ./Pyshp/.github/actions/build_wheel_and_sdist
36+ #
3537 # and then calling this Action with:
38+ #
3639 # - name: Run tests
3740 # uses: ./Pyshp/.github/actions/test
3841 # with:
3942 # extra_args: ""
4043 # replace_remote_urls_with_localhost: 'yes'
4144 # pyshp_repo_directory: ./Pyshp
4245
43- # The Python to be tested with is required to already be setup, with "python" and "pip" on the system Path
46+ # The Python to be tested with is required to already be setup,
47+ # with "python" and "pip" on the system Path
48+ # (so that this custom Action can be used with both reproducible
49+ # Pythons from Python docker images, and more frequently deprecated Pythons
50+ # from - uses: actions/setup-python@v5)
51+
4452
4553 - name : Checkout shapefiles and zip file artefacts repo
4654 if : ${{ inputs.replace_remote_urls_with_localhost == 'yes' }}
@@ -50,58 +58,47 @@ runs:
5058 path : ./PyShp_test_shapefile
5159
5260 - name : Serve shapefiles and zip file artefacts on localhost
53- if : ${{ inputs.replace_remote_urls_with_localhost == 'yes' && inputs.python-version != '2.7' }}
61+ if : ${{ inputs.replace_remote_urls_with_localhost == 'yes' }}
5462 shell : bash
5563 working-directory : ./PyShp_test_shapefile
5664 run : |
5765 python -m http.server 8000 &
5866 echo "HTTP_SERVER_PID=$!" >> $GITHUB_ENV
5967 sleep 4 # give server time to start
6068
61- - name : Download and unzip Caddy binary
62- if : ${{ inputs.replace_remote_urls_with_localhost == 'yes' && inputs.python-version == '2.7'}}
63- working-directory : .
64- shell : bash
65- run : |
66- curl -L https://github.com/caddyserver/caddy/releases/download/v2.10.0/caddy_2.10.0_linux_amd64.tar.gz --output caddy.tar.gz
67- tar -xzf caddy.tar.gz
69+ - name : Download wheel and sdist (built in previous jobs)
70+ uses : actions/download-artifact@v4
71+ with :
72+ name : PyShp_wheel_and_sdist
73+ path : dist
6874
69- - name : Serve shapefiles and zip file artefacts on localhost using Caddy
70- if : ${{ inputs.replace_remote_urls_with_localhost == 'yes' && inputs.python-version == '2.7'}}
75+ - name : Install PyShp from the wheel (downloaded in prev step)
7176 shell : bash
72- working-directory : .
77+ working-directory : dist/
7378 run : |
74- ./caddy file-server --root ./PyShp_test_shapefile --listen :8000 &
75- echo "HTTP_SERVER_PID=$!" >> $GITHUB_ENV
76- sleep 2 # give server time to start
79+ WHEEL_NAME=$(ls pyshp-*py3-none-any.whl)
80+ python -m pip install $WHEEL_NAME[test]
7781
7882 - name : Doctests
7983 shell : bash
8084 working-directory : ${{ inputs.pyshp_repo_directory }}
8185 env :
8286 REPLACE_REMOTE_URLS_WITH_LOCALHOST : ${{ inputs.replace_remote_urls_with_localhost }}
83- run : python shapefile .py ${{ inputs.extra_args }}
87+ run : python test_shapefile .py ${{ inputs.extra_args }}
8488
85- - name : Install test dependencies .
89+ - name : Show Python and Pytest versions for logs .
8690 shell : bash
87- working-directory : ${{ inputs.pyshp_repo_directory }}
8891 run : |
89- python -m pip install --upgrade pip
90- pip install -r requirements.test.txt
92+ python --version
93+ python -m pytest --version
9194
92- - name : Pytest
95+ - name : Run Pytest
9396 shell : bash
9497 working-directory : ${{ inputs.pyshp_repo_directory }}
9598 env :
9699 REPLACE_REMOTE_URLS_WITH_LOCALHOST : ${{ inputs.replace_remote_urls_with_localhost }}
97- run : |
98- pytest -rA --tb=short ${{ inputs.extra_args }}
100+ run : pytest -rA --tb=short ${{ inputs.extra_args }}
99101
100- - name : Show versions for logs.
101- shell : bash
102- run : |
103- python --version
104- python -m pytest --version
105102
106103
107104 # - name: Test http server
0 commit comments