diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9218f3e..9ca9985 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,8 +20,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-22.04, windows-latest, macos-latest ] - python: [ "3.9", "3.10", "3.11", "3.12" ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + python: [ "3.10", "3.11", "3.12", "3.13" ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 91950b4..5b9bf5b 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -18,5 +18,5 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.9" - - uses: pre-commit/action@v2.0.3 + python-version: "3.10" + - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/pypi-wheels.yml b/.github/workflows/pypi-wheels.yml new file mode 100644 index 0000000..5c3f98f --- /dev/null +++ b/.github/workflows/pypi-wheels.yml @@ -0,0 +1,130 @@ +name: pypi wheel and upload + +on: + workflow_dispatch: + inputs: + PyPiDeployTarget: + description: 'Environment to deploy to' + required: true + type: choice + options: + - 'No' + - 'test.pypi.org' + - 'pypi' + pull_request: + push: + tags: + # Matches tags like 1.0.0.1 or 12.34.56.78 + - '[0-9]+.[0-9]+.[0-9]+.[0-9]+' + + +permissions: + contents: read + + +jobs: + build_wheels: + if: github.ref_name != '' + runs-on: ${{ matrix.os }} + strategy: + matrix: + os : ["ubuntu-latest", "windows-latest", "macos-latest"] + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: recursive + fetch-depth: 0 + + - name: Build wheels + uses: pypa/cibuildwheel@v3.3.1 # Note: Ensure you use a valid version + with: + output-dir: wheelhouse + env: + CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*" + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: wheelhouse-${{ matrix.os }} + path: ./wheelhouse/*.whl + + build_sdist: + strategy: + fail-fast: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Setup Python 3.13 + uses: actions/setup-python@v4 + with: + python-version: 3.13 + - name: Install build dependencies + run: | + python -m pip install build + - name: Build eigency + run: | + python -m build --sdist . + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: wheelhouse-sdist + path: ./dist/*.tar.gz + + publish: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.PyPiDeployTarget != 'No') + + steps: + - uses: actions/checkout@v4 + + - name: Download Linux wheels + uses: actions/download-artifact@v4 + with: + name: wheelhouse-ubuntu-latest + path: artifacts + + - name: Download macOS wheels + uses: actions/download-artifact@v4 + with: + name: wheelhouse-macos-latest + path: artifacts + + - name: Download Windows wheels + uses: actions/download-artifact@v4 + with: + name: wheelhouse-windows-latest + path: artifacts + + - name: Download SDist + uses: actions/download-artifact@v4 + with: + name: wheelhouse-sdist + path: artifacts + + - name: Install twine + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade twine + + - name: Upload to PyPI + env: + TWINE_USERNAME: __token__ + TEST_PYPI_TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} + PYPI_TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + ls -la artifacts || true + + if [ "${{ github.event.inputs.PyPiDeployTarget }}" == "pypi.org" ]; then + echo "Deploy to testpypi " + python -m twine upload artifacts/* -u "$TWINE_USERNAME" -p "$TEST_PYPI_TWINE_PASSWORD" --non-interactive --verbose + else + python -m twine upload --repository testpypi artifacts/* -u "$TWINE_USERNAME" -p "$PYPI_TWINE_PASSWORD" --non-interactive --verbose + fi + shell: bash diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml index 323a514..786a644 100644 --- a/.github/workflows/setup.yml +++ b/.github/workflows/setup.yml @@ -21,8 +21,8 @@ jobs: matrix: # Disable MacOS testing because it's being dumb # os: [ ubuntu-20.04, ubuntu-22.04, windows-latest, macos-latest ] - os: [ ubuntu-20.04, ubuntu-22.04, windows-latest ] - python: [ "3.9", "3.10", "3.11", "3.12" ] + os: [ ubuntu-latest, windows-latest ] + python: [ "3.10", "3.11", "3.12", "3.13" ] runs-on: ${{ matrix.os }} steps: - name: Install MSBuild diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index e1ebc3d..ecf5e8a 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -20,8 +20,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-22.04, windows-latest, macos-latest ] - python: [ "3.9", "3.10", "3.11", "3.12" ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + python: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d2783f..0101d6a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,6 @@ repos: hooks: - id: flake8 - repo: https://github.com/PyCQA/bandit - rev: 1.7.5 + rev: 1.8.0 hooks: - id: bandit