From d6d917d09a72db827c4fda1df492338f2fc6c208 Mon Sep 17 00:00:00 2001 From: sysid Date: Wed, 21 Aug 2024 10:32:53 +0530 Subject: [PATCH] feat: ci/cd --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0aeaa83 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Build and publish wheels + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + python-version: [3.10, 3.11, 3.12] + # Specify the architectures for macOS + architecture: [x86_64, arm64] + + steps: + - uses: actions/checkout@v2 + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: pip install maturin + + - name: Add rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-unknown-linux-gnu' || matrix.architecture == 'x86_64' && 'x86_64-apple-darwin' || 'aarch64-apple-darwin' }} + + - name: Build wheel + run: maturin build --release --target ${{ matrix.os == 'ubuntu-latest' && 'x86_64-unknown-linux-gnu' || matrix.architecture == 'x86_64' && 'x86_64-apple-darwin' || 'aarch64-apple-darwin' }} + + - name: Upload wheel + uses: actions/upload-artifact@v2 + with: + name: wheel + path: ./target/wheels/*.whl + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: pip install twine + + - name: Upload to PyPI + run: twine upload target/wheels/*.whl + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}