feat: add array __contains__ support (#377) #114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| name: mainline-only | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| prepare: | |
| name: Prepare | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Detect skip ci and docs changes | |
| id: detect | |
| uses: ./.github/actions/detect-skip-ci | |
| with: | |
| github_event_name: ${{ github.event_name }} | |
| pr_base_ref: ${{ github.event.pull_request.base.ref || '' }} | |
| pr_head_sha: ${{ github.event.pull_request.head.sha || '' }} | |
| clang-tidy: | |
| needs: [prepare] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0 | |
| - uses: ./.github/actions/detect-env-vars | |
| id: env_vars | |
| - name: Run clang-tidy | |
| run: | | |
| uv run --no-project --with "clang-tidy==21.1.1" \ | |
| python tests/lint/clang_tidy_precommit.py \ | |
| --build-dir=build-pre-commit \ | |
| --jobs=${{ steps.env_vars.outputs.cpu_count }} \ | |
| ./src/ ./include ./tests | |
| build-wheels: | |
| name: Build wheels | |
| needs: [prepare] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {os: ubuntu-latest, arch: x86_64, linux_image: manylinux2014, build_sdist: "true"} | |
| - {os: ubuntu-latest, arch: x86_64, linux_image: manylinux_2_28, build_sdist: "false"} | |
| - {os: ubuntu-24.04-arm, arch: aarch64, linux_image: manylinux2014, build_sdist: "false"} | |
| - {os: ubuntu-24.04-arm, arch: aarch64, linux_image: manylinux_2_28, build_sdist: "false"} | |
| - {os: windows-latest, arch: AMD64, linux_image: "", build_sdist: "false"} | |
| - {os: macos-14, arch: arm64, linux_image: "", build_sdist: "false"} | |
| steps: | |
| - name: Checkout repository (for local composite action) | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build wheel | |
| uses: ./.github/actions/build-wheel-for-publish | |
| with: | |
| os: ${{ matrix.os }} | |
| arch: ${{ matrix.arch }} | |
| linux_image: ${{ matrix.linux_image }} | |
| checkout_ref: ${{ github.sha }} | |
| build_sdist: ${{ matrix.build_sdist }} | |
| examples: | |
| name: Run examples | |
| needs: [prepare] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {os: ubuntu-latest, python_version: "3.14"} | |
| - {os: macos-14, python_version: "3.13"} | |
| - {os: windows-latest, python_version: "3.12"} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| activate-environment: true | |
| - uses: ./.github/actions/detect-env-vars | |
| id: env_vars | |
| - name: Install dependencies for examples | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }} | |
| run: | | |
| uv pip install --reinstall --verbose -e ".[torch]" | |
| uv pip install --reinstall --verbose numpy scikit-build-core torch-c-dlpack-ext | |
| - name: Run example/quickstart (CPU) [posix] | |
| if: ${{ runner.os != 'Windows' }} | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }} | |
| run: | | |
| pushd examples/quickstart | |
| rm -rf build | |
| bash run_all_cpu.sh | |
| popd | |
| - name: Run example/quickstart (CPU) [windows] | |
| if: ${{ runner.os == 'Windows' }} | |
| shell: cmd | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }} | |
| run: | | |
| cd examples\quickstart | |
| call run_all_cpu.bat | |
| - name: Run example/stable_c_abi [posix] | |
| if: ${{ runner.os != 'Windows' }} | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }} | |
| run: | | |
| pushd examples/stable_c_abi | |
| rm -rf build | |
| bash run_all.sh | |
| popd | |
| - name: Run example/stable_c_abi [windows] | |
| if: ${{ runner.os == 'Windows' }} | |
| shell: cmd | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }} | |
| run: | | |
| cd examples\stable_c_abi | |
| call run_all.bat | |
| - name: Run example/python_packaging [posix] | |
| if: ${{ runner.os != 'Windows' }} | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }} | |
| run: | | |
| pushd examples/python_packaging | |
| # This directory will be auto-generated in `CMakeLists.txt` by setting `STUB_INIT ON` | |
| rm -rf python/my_ffi_extension | |
| uv pip install --verbose . --no-build-isolation | |
| python run_example.py | |
| popd | |
| - name: Run example/python_packaging [windows] | |
| if: ${{ runner.os == 'Windows' }} | |
| shell: pwsh | |
| env: | |
| CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }} | |
| run: | | |
| Set-Location examples/python_packaging | |
| Remove-Item -Recurse -Force python/my_ffi_extension | |
| uv pip install --verbose . --no-build-isolation | |
| python run_example.py |