From f94e7e38bf6fa710c98002b85fd6e1f80d378a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sun, 5 May 2024 16:36:52 +0100 Subject: [PATCH] Build wheels from github action --- .github/workflows/wheels.yaml | 85 +++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/wheels.yaml diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml new file mode 100644 index 0000000..6f9486a --- /dev/null +++ b/.github/workflows/wheels.yaml @@ -0,0 +1,85 @@ +name: Build Python distributions + +on: + push: + pull_request: + schedule: + - cron: "0 6 * * *" # Daily 6AM UTC build + +jobs: + build-wheels: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + fail-fast: true + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build wheels + run: python -m build --wheel + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + path: ./dist/*.whl + + build-sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build sdist + run: python -m build --sdist + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + path: ./dist/*.tar.gz + + test-sdist: + needs: + - build-sdist + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v5 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install twine + - name: Download sdist + uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - name: Test sdist + run: twine check dist/* + - name: Test installation from sdist + run: pip install dist/*.tar.gz + + publish: + runs-on: ubuntu-latest + needs: + - build-wheels + - build-sdist + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/fastbencode + steps: + - name: Download distributions + uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1