Add tensorrt test workflow #8
This file contains 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
name: Build and test Torch-TensorRT on Linux | |
on: | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
jobs: | |
generate-matrix: | |
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | |
with: | |
package-type: wheel | |
os: linux | |
test-infra-repository: pytorch/test-infra | |
test-infra-ref: main | |
with-rocm: false | |
with-cpu: false | |
generate-tensorrt-matrix: | |
needs: [generate-matrix] | |
outputs: | |
matrix: ${{ steps.generate.outputs.matrix }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- uses: actions/checkout@v3 | |
with: | |
repository: pytorch/tensorrt | |
- name: Generate tensorrt matrix | |
id: generate | |
run: | | |
set -eou pipefail | |
MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }} | |
MATRIX_BLOB="$(python3 .github/scripts/generate-tensorrt-test-matrix.py --matrix "${MATRIX_BLOB}")" | |
echo "${MATRIX_BLOB}" | |
echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}" | |
build: | |
needs: [generate-tensorrt-matrix] | |
name: Build torch-tensorrt whl package | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- repository: pytorch/tensorrt | |
pre-script: packaging/pre_build_script.sh | |
env-var-script: packaging/env_vars.txt | |
post-script: packaging/post_build_script.sh | |
smoke-test-script: packaging/smoke_test_script.sh | |
package-name: torch_tensorrt | |
uses: ./.github/workflows/build-tensorrt-linux.yml | |
with: | |
repository: ${{ matrix.repository }} | |
ref: "" | |
test-infra-repository: pytorch/test-infra | |
test-infra-ref: main | |
build-matrix: ${{ needs.generate-tensorrt-matrix.outputs.matrix }} | |
pre-script: ${{ matrix.pre-script }} | |
env-var-script: ${{ matrix.env-var-script }} | |
post-script: ${{ matrix.post-script }} | |
package-name: ${{ matrix.package-name }} | |
smoke-test-script: ${{ matrix.smoke-test-script }} | |
trigger-event: ${{ github.event_name }} | |
upload-artifact: torch_tensorrt_${{ matrix.tensorrt.version }}_py${{ matrix.python_version }}_${{ matrix.desired_cuda }} | |
tests-py-torchscript-fe: | |
name: Test torchscript frontend [Python] | |
needs: [generate-tensorrt-matrix, build] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- repository: pytorch/tensorrt | |
package-name: torch_tensorrt | |
pre-script: packaging/pre_build_script.sh | |
post-script: packaging/post_build_script.sh | |
smoke-test-script: packaging/smoke_test_script.sh | |
uses: ./.github/workflows/linux-test.yml | |
with: | |
job-name: tests-py-torchscript-fe | |
repository: "pytorch/tensorrt" | |
ref: "" | |
test-infra-repository: pytorch/test-infra | |
test-infra-ref: main | |
build-matrix: ${{ needs.generate-tensorrt-matrix.outputs.matrix }} | |
pre-script: ${{ matrix.pre-script }} | |
download-artifact: torch_tensorrt_${{ matrix.tensorrt.version }}_py${{ matrix.python_version }}_${{ matrix.desired_cuda }} | |
script: | | |
export USE_HOST_DEPS=1 | |
export CI_BUILD=1 | |
export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH | |
pushd . | |
cd tests/modules | |
python hub.py | |
popd | |
pushd . | |
cd tests/py/ts | |
python -m pytest -ra --junitxml=${RUNNER_TEST_RESULTS_DIR}/ts_api_test_results.xml api/ | |
python -m pytest -ra --junitxml=${RUNNER_TEST_RESULTS_DIR}/ts_models_test_results.xml models/ | |
python -m pytest -ra --junitxml=${RUNNER_TEST_RESULTS_DIR}/ts_integrations_test_results.xml integrations/ | |
popd |