| name: Run all unittests |
| |
| on: |
| workflow_call: |
| inputs: |
| docker-image: |
| required: true |
| type: string |
| description: Name of the docker image to use. |
| python-version: |
| required: false |
| type: string |
| default: '3.10' |
| |
| jobs: |
| linux: |
| uses: pytorch/test-infra/.github/workflows/linux_job.yml@main |
| with: |
| runner: linux.2xlarge |
| docker-image: ${{ inputs.docker-image }} |
| submodules: 'true' |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
| timeout: 90 |
| script: | |
| set -eux |
| |
| # The generic Linux job chooses to use base env, not the one setup by the image |
| CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") |
| conda activate "${CONDA_ENV}" |
| |
| # Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate |
| source .ci/scripts/setup-vulkan-linux-deps.sh |
| |
| # Setup MacOS dependencies as there is no Docker support on MacOS atm |
| PYTHON_EXECUTABLE=python \ |
| EXECUTORCH_BUILD_PYBIND=ON \ |
| CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \ |
| .ci/scripts/setup-linux.sh cmake |
| |
| # Run pytest with coverage |
| pytest -n auto --cov=./ --cov-report=xml |
| # Run gtest |
| LLVM_PROFDATA=llvm-profdata-12 LLVM_COV=llvm-cov-12 \ |
| test/run_oss_cpp_tests.sh |
| |
| macos: |
| uses: pytorch/test-infra/.github/workflows/macos_job.yml@main |
| with: |
| runner: macos-m1-stable |
| python-version: '3.11' |
| submodules: 'true' |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
| script: | |
| set -eux |
| |
| bash .ci/scripts/setup-conda.sh |
| |
| # Create temp directory for sccache shims |
| export TMP_DIR=$(mktemp -d) |
| export PATH="${TMP_DIR}:$PATH" |
| trap 'rm -rfv ${TMP_DIR}' EXIT |
| |
| # Setup MacOS dependencies as there is no Docker support on MacOS atm |
| PYTHON_EXECUTABLE=python \ |
| EXECUTORCH_BUILD_PYBIND=ON \ |
| CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \ |
| ${CONDA_RUN} --no-capture-output \ |
| .ci/scripts/setup-macos.sh cmake |
| |
| # Run pytest with coverage |
| ${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml |
| # Run gtest |
| LLVM_PROFDATA="xcrun llvm-profdata" LLVM_COV="xcrun llvm-cov" \ |
| ${CONDA_RUN} test/run_oss_cpp_tests.sh |