From 60be72b90f4f9502421bb68e936324c376647957 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Sun, 19 May 2024 15:08:46 -0400 Subject: [PATCH] ci: added deploy workflow --- .github/workflows/deploy.yml | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..9520d8f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,75 @@ +name: Deploy + +on: + release: + types: [created] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-wheels: + name: Build wheels + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-13, macos-14] + steps: + - name: Check out repo + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Build wheels + run: | + python -m pip install pipx + pipx run cibuildwheel + env: + CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_TERM_COLOR="always"' + CIBW_BEFORE_BUILD: rustup show + CIBW_BEFORE_BUILD_LINUX: > + curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=minimal -y && + rustup show + CIBW_TEST_COMMAND: 'pytest -vv' + CIBW_TEST_REQUIRES: pytest + CIBW_BUILD_VERBOSITY: 1 + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels_${{ github.event.release.tag_name }}_${{ matrix.os }} + retention-days: 1 + path: ./wheelhouse/*.whl + + deploy-pypi: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: [build-wheels] + environment: + name: pypi + url: https://pypi.org/p/cygv + permissions: + id-token: write + steps: + - name: Download wheels + uses: actions/download-artifact@v4 + with: + pattern: wheels_${{ github.event.release.tag_name }}_* + merge-multiple: true + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + deploy-crate: + name: Publish to Crates.io + runs-on: ubuntu-latest + # just to make sure the wheels were built + needs: [build-wheels] + steps: + - name: Check out repo + uses: actions/checkout@v4 + - name: Publish to Crates.io + run: | + cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }} + cargo publish