Skip to content

Commit c07f26f

Browse files
authored
replace python-package.yml with test.yml -> publish.yml (#218)
1 parent 1890ff3 commit c07f26f

File tree

3 files changed

+114
-97
lines changed

3 files changed

+114
-97
lines changed

.github/workflows/publish.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish
2+
3+
on:
4+
workflow_run:
5+
workflows: Test
6+
branches: master
7+
types: completed
8+
9+
jobs:
10+
publish:
11+
# `if` required because a workflow run is triggered regardless of
12+
# the result of the previous workflow (see the documentation page)
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
14+
needs: [test]
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: ["ubuntu-20.04", "windows-2019", "macos-11"]
19+
cp: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]
20+
21+
22+
name: ${{ matrix.os }} - ${{ matrix.cp }}
23+
runs-on: ${{ matrix.os }}
24+
timeout-minutes: 60
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: "3.10"
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip wheel setuptools
37+
python -m pip install --upgrade twine build
38+
39+
- name: Set up QEMU
40+
if: runner.os == 'Linux'
41+
uses: docker/setup-qemu-action@v2
42+
with:
43+
platforms: all
44+
45+
- name: Build wheels
46+
uses: pypa/[email protected]
47+
env:
48+
CIBW_ARCHS_LINUX: auto aarch64
49+
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
50+
CIBW_BUILD: |
51+
${{ matrix.cp }}-manylinux_x86_64
52+
${{ matrix.cp }}-manylinux_i686
53+
${{ matrix.cp }}-manylinux_aarch64
54+
${{ matrix.cp }}-win_amd64
55+
${{ matrix.cp }}-win32
56+
${{ matrix.cp }}-macosx_x86_64
57+
${{ matrix.cp }}-macosx_arm64
58+
${{ matrix.cp }}-macosx_universal2
59+
# Disabled repair wheel since the fmob lib is not compatible
60+
CIBW_REPAIR_WHEEL_COMMAND: ""
61+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'mv {wheel} {dest_dir}/"$(basename {wheel} | sed "s/-linux_/-manylinux_2_17_/")"'
62+
CIBW_TEST_REQUIRES: pytest
63+
CIBW_TEST_COMMAND: pytest -v -s {package}/tests
64+
CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-manylinux_i686 *-win32"
65+
66+
- name: Publish to PyPI
67+
if: success() && github.event_name == 'push' && env.TWINE_PASSWORD != '' && github.ref == 'refs/heads/master'
68+
env:
69+
TWINE_USERNAME: __token__
70+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
71+
run: |
72+
twine upload ./wheelhouse/*.whl --skip-existing
73+
python -m build --sdist
74+
twine upload ./dist/*.tar.gz --skip-existing

.github/workflows/python-package.yml

-97
This file was deleted.

.github/workflows/test.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request: {}
8+
9+
10+
11+
jobs:
12+
test:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
17+
18+
runs-on: ${{ matrix.os }}
19+
name: ${{ matrix.os }}
20+
timeout-minutes: 10
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.7"
29+
30+
- name: Install Dependencies
31+
run: |
32+
python -m pip install --upgrade pip pytest
33+
34+
- name: Install UnityPy
35+
run: |
36+
pip install .
37+
38+
- name: Run tests
39+
run: |
40+
pytest -v -s

0 commit comments

Comments
 (0)