diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..9dea9b06 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,74 @@ +name: Publish + +on: + workflow_run: + workflows: Test + branches: master + types: completed + +jobs: + publish: + # `if` required because a workflow run is triggered regardless of + # the result of the previous workflow (see the documentation page) + if: ${{ github.event.workflow_run.conclusion == 'success' }} + needs: [test] + strategy: + fail-fast: false + matrix: + os: ["ubuntu-20.04", "windows-2019", "macos-11"] + cp: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"] + + + name: ${{ matrix.os }} - ${{ matrix.cp }} + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel setuptools + python -m pip install --upgrade twine build + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.2 + env: + CIBW_ARCHS_LINUX: auto aarch64 + CIBW_ARCHS_MACOS: x86_64 arm64 universal2 + CIBW_BUILD: | + ${{ matrix.cp }}-manylinux_x86_64 + ${{ matrix.cp }}-manylinux_i686 + ${{ matrix.cp }}-manylinux_aarch64 + ${{ matrix.cp }}-win_amd64 + ${{ matrix.cp }}-win32 + ${{ matrix.cp }}-macosx_x86_64 + ${{ matrix.cp }}-macosx_arm64 + ${{ matrix.cp }}-macosx_universal2 + # Disabled repair wheel since the fmob lib is not compatible + CIBW_REPAIR_WHEEL_COMMAND: "" + CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'mv {wheel} {dest_dir}/"$(basename {wheel} | sed "s/-linux_/-manylinux_2_17_/")"' + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: pytest -v -s {package}/tests + CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-manylinux_i686 *-win32" + + - name: Publish to PyPI + if: success() && github.event_name == 'push' && env.TWINE_PASSWORD != '' && github.ref == 'refs/heads/master' + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + twine upload ./wheelhouse/*.whl --skip-existing + python -m build --sdist + twine upload ./dist/*.tar.gz --skip-existing diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 531590a7..00000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Test and Publish - -on: [push, pull_request, workflow_dispatch] - -jobs: - test: - strategy: - fail-fast: false - matrix: - os: ["ubuntu-latest", "macOS-latest", "windows-latest"] - - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.7" - - - name: Install Dependencies - run: | - python -m pip install --upgrade pip pytest - - - name: Install UnityPy - run: | - pip install . - - - name: Run tests - run: | - pytest -v -s - - release: - if: github.ref == 'refs/heads/master' - needs: [test] - strategy: - fail-fast: false - matrix: - os: ["ubuntu-20.04", "windows-2019", "macos-11"] - cp: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"] - - timeout-minutes: 30 - - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - ${{ matrix.cp }} - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip wheel setuptools - python -m pip install --upgrade twine build - - - name: Set up QEMU - if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 - env: - CIBW_ARCHS_LINUX: auto aarch64 - CIBW_ARCHS_MACOS: x86_64 arm64 universal2 - CIBW_BUILD: | - ${{ matrix.cp }}-manylinux_x86_64 - ${{ matrix.cp }}-manylinux_i686 - ${{ matrix.cp }}-manylinux_aarch64 - ${{ matrix.cp }}-win_amd64 - ${{ matrix.cp }}-win32 - ${{ matrix.cp }}-macosx_x86_64 - ${{ matrix.cp }}-macosx_arm64 - ${{ matrix.cp }}-macosx_universal2 - # Disabled repair wheel since the fmob lib is not compatible - CIBW_REPAIR_WHEEL_COMMAND: "" - CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'mv {wheel} {dest_dir}/"$(basename {wheel} | sed "s/-linux_/-manylinux_2_17_/")"' - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest -v -s {package}/tests - CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-manylinux_i686 *-win32" - - - name: Publish to PyPI - if: success() && github.event_name == 'push' && env.TWINE_PASSWORD != '' && github.ref == 'refs/heads/master' - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - twine upload ./wheelhouse/*.whl --skip-existing - python -m build --sdist - twine upload ./dist/*.tar.gz --skip-existing diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..c56b5df2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,40 @@ +name: Test + +on: + push: + branches: + - master + pull_request: {} + + + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macOS-latest", "windows-latest"] + + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.7" + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip pytest + + - name: Install UnityPy + run: | + pip install . + + - name: Run tests + run: | + pytest -v -s