From 5197e080a66a40787c434e04a9513f0c1eab09a2 Mon Sep 17 00:00:00 2001 From: angie Date: Sun, 17 Dec 2023 15:27:27 -0300 Subject: [PATCH 1/2] CI action for uploading with maturin --- .github/workflows/maturin_upload_pypi.yml | 144 ++++++++++++++++++++++ .github/workflows/upload_pypi.yml | 38 ------ 2 files changed, 144 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/maturin_upload_pypi.yml delete mode 100644 .github/workflows/upload_pypi.yml diff --git a/.github/workflows/maturin_upload_pypi.yml b/.github/workflows/maturin_upload_pypi.yml new file mode 100644 index 0000000..f82e6f9 --- /dev/null +++ b/.github/workflows/maturin_upload_pypi.yml @@ -0,0 +1,144 @@ +# This file is autogenerated by maturin v1.4.0 +# To update, run +# +# maturin generate-ci github +# +name: Upload to PyPI + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + fail-fast: false + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + manylinux: auto + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + if-no-files-found: error + + windows: + runs-on: windows-latest + strategy: + matrix: + target: [x64, x86] + fail-fast: false + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + architecture: ${{ matrix.target }} + + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + if-no-files-found: error + + macos: + runs-on: macos-latest + strategy: + matrix: + target: [x86_64, aarch64] + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + if-no-files-found: error + + sdist: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + needs: [linux, windows, macos, sdist] + strategy: + fail-fast: false + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: wheels + + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.pypi_password }} + with: + command: upload + args: --non-interactive --skip-existing * diff --git a/.github/workflows/upload_pypi.yml b/.github/workflows/upload_pypi.yml deleted file mode 100644 index 1fe68db..0000000 --- a/.github/workflows/upload_pypi.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build and upload to PyPI - -# Build on every branch push, tag push, and pull request change: -on: [push, pull_request] - -jobs: - build_wheel: - name: Build wheel - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install build module - run: pip install build - - - name: Build wheel and source - run: python -m build --sdist --wheel --outdir dist/ . - - - uses: actions/upload-artifact@v3 - with: - path: dist/* - - upload_pypi: - needs: [build_wheel] - runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - - uses: pypa/gh-action-pypi-publish@v1.8.10 - with: - user: __token__ - password: ${{ secrets.pypi_password }} From e7f4bad1b912572631a569f908baa3b667c8dabf Mon Sep 17 00:00:00 2001 From: angie Date: Sun, 17 Dec 2023 15:36:03 -0300 Subject: [PATCH 2/2] Use fromName in test --- tests/check_correct_sum.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/check_correct_sum.py b/tests/check_correct_sum.py index 609d35b..183bdb7 100755 --- a/tests/check_correct_sum.py +++ b/tests/check_correct_sum.py @@ -9,21 +9,13 @@ from pathlib import Path import struct -cicsmapping = { - "CIC_6101": ipl3checksum.CICKind.CIC_6101, - "CIC_6102_7101": ipl3checksum.CICKind.CIC_6102_7101, - "CIC_7102": ipl3checksum.CICKind.CIC_7102, - "CIC_X103": ipl3checksum.CICKind.CIC_X103, - "CIC_X105": ipl3checksum.CICKind.CIC_X105, - "CIC_X106": ipl3checksum.CICKind.CIC_X106, -} - print(f"Running ipl3checksum version {ipl3checksum.__version__}") for ipl3folder in sorted(Path("tests/dummytests").iterdir()): print(ipl3folder.name) - kind = cicsmapping[ipl3folder.name] + kind = ipl3checksum.CICKind.fromName(ipl3folder.name) + assert kind is not None for binPath in sorted(ipl3folder.iterdir()): print(binPath)