Skip to content

feat: add __bool__ support for Array and Map #1666

feat: add __bool__ support for Array and Map

feat: add __bool__ support for Array and Map #1666

Workflow file for this run

# 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: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
# dev branch is used for testing purposes
- dev
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
should_skip_ci_commit: ${{ steps.detect.outputs.should_skip_ci_commit }}
should_skip_ci_docs_only: ${{ steps.detect.outputs.should_skip_ci_docs_only }}
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 || '' }}
lint:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
doc:
needs: [lint, 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
with:
python-version: 3.13
- name: Generate docs
run: |
sudo apt install doxygen
BUILD_CPP_DOCS=1 uv run --group docs sphinx-build -W --keep-going -b html docs docs/_build/html
test:
needs: [lint, prepare]
if: >
needs.prepare.outputs.should_skip_ci_commit != 'true' &&
needs.prepare.outputs.should_skip_ci_docs_only != 'true'
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- {os: ubuntu-latest, arch: x86_64, python_version: '3.14t'}
- {os: ubuntu-24.04-arm, arch: aarch64, python_version: '3.8'}
- {os: windows-latest, arch: AMD64, python_version: '3.9'}
- {os: macos-14, arch: arm64, python_version: '3.13'}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Print current commit
run: git log -1 --oneline
# Detect CPU count
- uses: ./.github/actions/detect-env-vars
id: env_vars
- name: Print CPU count
run: |
echo "CPU count: ${{ steps.env_vars.outputs.cpu_count }}"
# Run C++ tests
- name: Run cpp tests
if: ${{ matrix.os != 'windows-latest' }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
cmake . -B build_test -DTVM_FFI_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build build_test --clean-first --config Debug --target tvm_ffi_tests
ctest -V -C Debug --test-dir build_test --output-on-failure
- name: Run cpp tests[windows]
if: ${{ matrix.os == 'windows-latest' }}
shell: cmd
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: >
cmake . -B build_test -DTVM_FFI_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug &&
cmake --build build_test --clean-first --config Debug --target tvm_ffi_tests &&
ctest -V -C Debug --test-dir build_test --output-on-failure
- name: Locate and Set VsDevCmd Path [windows]
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
# Captures the output (path) from your Python script
$vsPath = python .github/workflows/utils/locate_vsdevcmd_bat.py
# Sets an environment variable for all subsequent steps in this job
"VS_DEV_CMD_PATH=$vsPath" | Out-File -FilePath $env:GITHUB_ENV -Append
# Run Python tests
- name: Setup Python ${{ matrix.python_version }}
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
with:
python-version: ${{ matrix.python_version }}
activate-environment: true
- name: Build and install python package
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
run: |
uv pip install --reinstall --verbose -e ".[test]"
- name: Run python tests
if: ${{ matrix.os != 'windows-latest' }}
run: |
pytest -vvs tests/python
- name: Run python tests [windows]
if: ${{ matrix.os == 'windows-latest' }}
shell: cmd
run: |
call "%VS_DEV_CMD_PATH%"
pytest -vvs tests/python
# Run Rust tests, must happen after installing the pip package.
- name: Run rust tests
working-directory: rust
run: |
cargo test