From 1ca2563e33b1d6eea26862723fe77d7a321fcd20 Mon Sep 17 00:00:00 2001 From: orip Date: Thu, 5 Jun 2025 23:55:56 +0300 Subject: [PATCH 1/3] Add a workflow that builds bdist and sdist and upload them to PyPI --- .github/workflows/build.yml | 86 +++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..7ab3478e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,86 @@ +name: Build And Publish Python Distribution 📦 + +on: push + # push: + # branches: + # - main + # tags: + # - 'v[0-9]+.[0-9]+.[0-9]+' + # pull_request: + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + - name: Download dependecies + run: | + sudo apt-get update + sudo apt-get install python3-dev + + - name: Build frida dependecies + run: | + sudo ln -s /usr/include /usr/lib/include # This is needed because of https://github.com/frida/frida/issues/2972 + make + + - name: Build the package + run: uv build + + - name: Upload build artifact` + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-testpypi: + name: Publish to TestPyPI 🐍 + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/frida-tools + + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + skip-existing: true + + publish-to-pypi: + name: >- + Publish to PyPI 🐍 + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/frida-tools + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 4e3e5ab62d89f1419c9c14a06f0c5b862305a9e2 Mon Sep 17 00:00:00 2001 From: orip Date: Wed, 20 Aug 2025 00:12:49 +0300 Subject: [PATCH 2/3] Simplify the build --- .github/workflows/build.yml | 10 ++-------- Makefile | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ab3478e..97cd4b24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,15 +19,9 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v6 - - name: Download dependecies + - name: Fetch frida dependecies run: | - sudo apt-get update - sudo apt-get install python3-dev - - - name: Build frida dependecies - run: | - sudo ln -s /usr/include /usr/lib/include # This is needed because of https://github.com/frida/frida/issues/2972 - make + make git-submodules - name: Build the package run: uv build diff --git a/Makefile b/Makefile index 8774db73..23b46b68 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PYTHON ?= $(shell which python3 >/dev/null && echo python3 || echo python) -all $(MAKECMDGOALS): +all $(filter-out git-submodules,$(MAKECMDGOALS)):: @$(PYTHON) \ -c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_make import main; main()" \ "$(shell pwd)" \ From a2f7ef026fffecad2eb9dc6e33441ad388fb1c3b Mon Sep 17 00:00:00 2001 From: orip Date: Wed, 20 Aug 2025 01:17:41 +0300 Subject: [PATCH 3/3] Fetch tags to allow for version detection --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 97cd4b24..911f8399 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,9 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Install uv uses: astral-sh/setup-uv@v6