From ac62426f8922188e2cf9f5c00127a3ae51473363 Mon Sep 17 00:00:00 2001 From: Omar Miraj Date: Thu, 6 Mar 2025 12:16:02 -0500 Subject: [PATCH 1/3] add wheels yml --- .github/workflows/wheels.yml | 95 ++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 00000000..00cf3330 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,95 @@ +name: Release Builder +on: + pull_request: + branches: + - main + types: + - closed + +jobs: + build_wheels: + name: Build wheels for Python SDK on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'sdk-core/') + strategy: + matrix: + # macOS 13 is an Intel runner and macOS 14 is an Apple Silicon runner + os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-13, macos-14] + steps: + - uses: actions/checkout@v4 + + # Need to grab the SDK version for the wheel name + - name: Extract SDK Version + run: echo "SDK_VERSION=$(python -c 'import version; print(version.SDK_VERSION)')" >> $GITHUB_ENV + + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel + + - name: Build wheels + env: + CIBW_SKIP: pp* *-musllinux_* + CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_34_x86_64" + CIBW_MANYLINUX_AARCH64_IMAGE: "quay.io/pypa/manylinux_2_34_aarch64" + CIBW_ARCHS: "native" + CIBW_TEST_REQUIRES: "pydantic pytest pytest-asyncio" + CIBW_TEST_COMMAND: "python -m pytest {project}/src/onepassword/test_client.py" + MACOSX_DEPLOYMENT_TARGET: 11.0 # Required for building on macOS + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }} + CIBW_ENVIRONMENT_PASS_LINUX: OP_SERVICE_ACCOUNT_TOKEN # to pass in the SA token, for some reason Linux doesn't read the env variables correctly + run: | + python -m cibuildwheel --output-dir dist + + - uses: actions/upload-artifact@v4 + with: + name: onepassword-sdk-${{ env.SDK_VERSION }}-${{ matrix.os }} + path: ./dist/*.whl + + build-sdist: + name: Build source distribution for Python SDK + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'sdk-core/') + steps: + # Need to grab the SDK version for the wheel name + - name: Extract SDK Version + run: echo "SDK_VERSION=$(python -c 'import version; print(version.SDK_VERSION)')" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + - name: Install dependencies + run: pip install build pydantic pytest pytest-asyncio + + - name: Build source distribution + run: python -m build --sdist + + - name: Test Source Distribution + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }} + run: | + python -m pip install dist/*.tar.gz + python -m pytest src/onepassword/test_client.py + + - uses: actions/upload-artifact@v4 + with: + name: onepassword-sdk-${{ env.SDK_VERSION }} + path: ./dist/*.tar.gz + + publish-to-pypi: + name: Publish to PyPI + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'sdk-core/') + environment: + name: testpypi + url: https://test.pypi.org/project/onepassword-sdk/ + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + needs: [build_wheels, build-sdist] + steps: + - uses: actions/download-artifact@v2 + with: + name: python-sdk-release + path: dist + + - name: Publish package distributions to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ From f9b48fefd4522e4e3f945d9204d2c9a228ff2860 Mon Sep 17 00:00:00 2001 From: Omar Miraj Date: Thu, 6 Mar 2025 12:17:42 -0500 Subject: [PATCH 2/3] fake release --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 9e4a7b7a..a3bec87f 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,6 @@ def get_shared_library_data_to_include(): "Operating System :: MacOS", "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", From 07a0d59425e234c86ce4ac65f592f74a51b024b8 Mon Sep 17 00:00:00 2001 From: Omar Miraj Date: Thu, 6 Mar 2025 12:26:33 -0500 Subject: [PATCH 3/3] update test_client --- src/onepassword/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onepassword/test_client.py b/src/onepassword/test_client.py index 8549166c..eec288f1 100644 --- a/src/onepassword/test_client.py +++ b/src/onepassword/test_client.py @@ -18,7 +18,7 @@ async def test_valid_resolve(): integration_version=onepassword_defaults.DEFAULT_INTEGRATION_VERSION, ) result = await client.secrets.resolve( - secret_reference="op://gowwbvgow7kxocrfmfvtwni6vi/6ydrn7ne6mwnqc2prsbqx4i4aq/password" + secret_reference="op://bhld6zk6hkuntyqlsjy3bdawey/yykbqryow5jjqwnghecitxgaie/password" ) assert result == "test_password_42"