# This file is autogenerated by maturin v1.7.1 # To update, run # # maturin generate-ci github # name: CI on: push: branches: - main - master tags: - '*' pull_request: workflow_dispatch: permissions: contents: read id-token: write env: GHCR_REPO: ghcr.io/tuna2134/sbv2-api jobs: linux: runs-on: ${{ matrix.platform.runner }} strategy: matrix: platform: - runner: ubuntu-latest target: x86_64 - runner: ubuntu-latest target: aarch64 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.x - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} args: --release --out dist --find-interpreter sccache: 'true' manylinux: auto working-directory: sbv2_bindings - name: Upload wheels uses: actions/upload-artifact@v4 with: name: wheels-linux-${{ matrix.platform.target }} path: sbv2_bindings/dist windows: runs-on: ${{ matrix.platform.runner }} strategy: matrix: platform: - runner: windows-latest target: x64 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.x architecture: ${{ matrix.platform.target }} - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} args: --release --out dist --find-interpreter sccache: 'true' working-directory: sbv2_bindings - name: Upload wheels uses: actions/upload-artifact@v4 with: name: wheels-windows-${{ matrix.platform.target }} path: sbv2_bindings/dist macos: runs-on: ${{ matrix.platform.runner }} strategy: matrix: platform: - runner: macos-14 target: aarch64 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.x - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} args: --release --out dist --find-interpreter sccache: 'true' working-directory: sbv2_bindings - name: Upload wheels uses: actions/upload-artifact@v4 with: name: wheels-macos-${{ matrix.platform.target }} path: sbv2_bindings/dist sdist: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build sdist uses: PyO3/maturin-action@v1 with: command: sdist args: --out dist working-directory: sbv2_bindings - name: Upload sdist uses: actions/upload-artifact@v4 with: name: wheels-sdist path: sbv2_bindings/dist release: name: Release runs-on: ubuntu-latest if: "startsWith(github.ref, 'refs/tags/')" needs: [linux, windows, macos, sdist] environment: release steps: - uses: actions/download-artifact@v4 - name: Publish to PyPI uses: PyO3/maturin-action@v1 with: command: upload args: --non-interactive --skip-existing wheels-*/* build: runs-on: ${{ matrix.machine.runner }} strategy: fail-fast: false matrix: machine: - platform: amd64 runner: ubuntu-latest - platform: arm64 runner: ubuntu-24.04-arm64 tag: [cpu, cuda] steps: - name: Prepare run: | platform=${{ matrix.machine.platform }} echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: | ${{ env.GHCR_REPO }} - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push by digest id: build uses: docker/build-push-action@v6 with: labels: ${{ steps.meta.outputs.labels }} file: docker/${{ matrix.tag }}.Dockerfile push: true tags: | ${{ env.GHCR_REPO }}:latest-${{ matrix.tag }}-${{ matrix.machine.platform }} merge: runs-on: ubuntu-latest needs: - build steps: - name: Download digests uses: actions/download-artifact@v4 with: path: ${{ runner.temp }}/digests pattern: digests-* merge-multiple: true - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Merge run: | docker buildx imagetools create -t ${{ env.GHCR_REPO }}:cuda \ ${{ env.GHCR_REPO }}:latest-cuda-amd64 \ ${{ env.GHCR_REPO }}:latest-cuda-arm64 docker buildx imagetools create -t ${{ env.GHCR_REPO }}:cpu \ ${{ env.GHCR_REPO }}:latest-cpu-amd64 \ ${{ env.GHCR_REPO }}:latest-cpu-arm64