@@ -55,17 +55,37 @@ jobs:
5555 - uses : actions/checkout@v3
5656 - name : Checkout submodules
5757 run : git submodule update --init --recursive --depth 1
58- - name : Install Python dependencies
58+ - name : Install typing dependencies
5959 run : pip install mypy pytest -r requirements.txt
60- - name : Fake initialize package
61- run : |
62- echo '__version__ = ""' > tcod/version.py
6360 - name : Mypy
6461 uses : liskin/gh-problem-matcher-wrap@v2
6562 with :
6663 linters : mypy
6764 run : mypy --show-column-numbers
6865
66+ sdist :
67+ runs-on : ubuntu-latest
68+ steps :
69+ - name : APT update
70+ run : sudo apt-get update
71+ - name : Install APT dependencies
72+ run : sudo apt-get install libsdl2-dev
73+ - uses : actions/checkout@v3
74+ with :
75+ fetch-depth : ${{ env.git-depth }}
76+ - name : Checkout submodules
77+ run : git submodule update --init --recursive --depth 1
78+ - name : Install build
79+ run : pip install build
80+ - name : Build source distribution
81+ run : python -m build --sdist
82+ - uses : actions/upload-artifact@v3
83+ with :
84+ name : sdist
85+ path : dist/tcod-*.tar.gz
86+ retention-days : 7
87+
88+
6989 # This makes sure that the latest versions of the SDL headers parse correctly.
7090 parse_sdl :
7191 needs : [black, isort, flake8, mypy]
@@ -133,7 +153,7 @@ jobs:
133153 - name : Initialize package
134154 run : |
135155 pip install -e . # Install the package in-place.
136- - name : Build package.
156+ - name : Build package
137157 run : |
138158 python -m build
139159 - name : Test with pytest
@@ -148,12 +168,6 @@ jobs:
148168 if : runner.os != 'Windows'
149169 run : cat /tmp/xvfb.log
150170 - uses : codecov/codecov-action@v3
151- - uses : actions/upload-artifact@v3
152- if : runner.os == 'Linux'
153- with :
154- name : sdist
155- path : dist/tcod-*.tar.gz
156- retention-days : 7
157171 - uses : actions/upload-artifact@v3
158172 if : runner.os == 'Windows'
159173 with :
@@ -162,7 +176,7 @@ jobs:
162176 retention-days : 7
163177
164178 isolated : # Test installing the package from source.
165- needs : build
179+ needs : [black, isort, flake8, mypy, sdist]
166180 runs-on : ${{ matrix.os }}
167181 strategy :
168182 matrix :
@@ -192,8 +206,7 @@ jobs:
192206 python -c "import tcod"
193207
194208 linux-wheels :
195- needs : build # These take a while to build/test, so wait for normal tests to pass first.
196- if : startsWith(github.event.ref, 'refs/tags/')
209+ needs : [black, isort, flake8, mypy]
197210 runs-on : " ubuntu-latest"
198211 strategy :
199212 matrix :
@@ -232,6 +245,8 @@ jobs:
232245 yum install -y SDL2-devel
233246 CIBW_BEFORE_TEST : pip install numpy
234247 CIBW_TEST_COMMAND : python -c "import tcod"
248+ # Skip test on emulated architectures
249+ CIBW_TEST_SKIP : " *_aarch64"
235250 - name : Archive wheel
236251 uses : actions/upload-artifact@v3
237252 with :
@@ -252,15 +267,11 @@ jobs:
252267 fetch-depth : ${{ env.git-depth }}
253268 - name : Checkout submodules
254269 run : git submodule update --init --recursive --depth 1
255- - name : Print git describe
256- # "--tags" is required to workaround actions/checkout's broken annotated tag handing.
257- # https://github.com/actions/checkout/issues/290
258- run : git describe --tags
259270 - name : Install Python dependencies
260271 run : pip3 install -r requirements.txt
261272 - name : Prepare package
262273 # Downloads SDL2 for the later step.
263- run : python3 setup .py || true
274+ run : python3 build_sdl .py
264275 - name : Build wheels
265276 uses : pypa/cibuildwheel@v2.12.3
266277 env :
@@ -278,7 +289,7 @@ jobs:
278289 retention-days : 7
279290
280291 publish :
281- needs : [build]
292+ needs : [sdist, build, build-macos, linux-wheels ]
282293 runs-on : ubuntu-latest
283294 if : startsWith(github.ref, 'refs/tags/')
284295 environment :
@@ -295,42 +306,14 @@ jobs:
295306 with :
296307 name : wheels-windows
297308 path : dist/
309+ - uses : actions/download-artifact@v3
310+ with :
311+ name : wheels-macos
312+ path : dist/
313+ - uses : actions/download-artifact@v3
314+ with :
315+ name : wheels-linux
316+ path : dist/
298317 - uses : pypa/gh-action-pypi-publish@release/v1
299318 with :
300319 skip-existing : true
301-
302- publish-macos :
303- needs : [build-macos]
304- runs-on : ubuntu-latest
305- if : startsWith(github.ref, 'refs/tags/')
306- environment :
307- name : release
308- url : https://pypi.org/p/tcod
309- permissions :
310- id-token : write
311- steps :
312- - uses : actions/download-artifact@v3
313- with :
314- name : wheels-macos
315- path : dist/
316- - uses : pypa/gh-action-pypi-publish@release/v1
317- with :
318- skip-existing : true
319-
320- publish-linux :
321- needs : [linux-wheels]
322- runs-on : ubuntu-latest
323- if : startsWith(github.ref, 'refs/tags/')
324- environment :
325- name : release
326- url : https://pypi.org/p/tcod
327- permissions :
328- id-token : write
329- steps :
330- - uses : actions/download-artifact@v3
331- with :
332- name : wheels-linux
333- path : dist/
334- - uses : pypa/gh-action-pypi-publish@release/v1
335- with :
336- skip-existing : true
0 commit comments