|  | 
| 1 | 1 | name: Unit-tests on Linux CPU | 
| 2 | 2 | 
 | 
| 3 | 3 | on: | 
| 4 |  | -  pull_request: | 
| 5 |  | -  push: | 
| 6 |  | -    branches: | 
| 7 |  | -      - nightly | 
| 8 |  | -      - main | 
| 9 |  | -      - release/* | 
| 10 |  | -  workflow_dispatch: | 
|  | 4 | +    pull_request: | 
|  | 5 | +    push: | 
|  | 6 | +        branches: | 
|  | 7 | +            - nightly | 
|  | 8 | +            - main | 
|  | 9 | +            - release/* | 
|  | 10 | +    workflow_dispatch: | 
| 11 | 11 | 
 | 
| 12 |  | -jobs: | 
| 13 |  | -  tests: | 
| 14 |  | -    strategy: | 
| 15 |  | -      matrix: | 
| 16 |  | -        # TODO all from 3.9 to 3.13 | 
| 17 |  | -        python_version: ["3.11"] | 
| 18 |  | -      fail-fast: false | 
| 19 |  | -    uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main | 
| 20 |  | -    permissions: | 
| 21 |  | -      id-token: write | 
| 22 |  | -      contents: read | 
| 23 |  | -    with: | 
| 24 |  | -      runner: linux.12xlarge | 
| 25 |  | -      repository: pytorch/audio | 
| 26 |  | -      timeout: 120 | 
| 27 |  | -      script: | | 
| 28 |  | -        echo '::group::Setup Environment Variables' | 
| 29 |  | -        # Mark Build Directory Safe | 
| 30 |  | -        git config --global --add safe.directory /__w/audio/audio | 
| 31 |  | -
 | 
| 32 |  | -        # Set up Environment Variables | 
| 33 |  | -        export PYTHON_VERSION="${{ matrix.python_version }}" | 
| 34 |  | -        export PIP_PROGRESS_BAR=off | 
| 35 |  | -        export CONDA_QUIET=1 | 
| 36 |  | -        export CUDA_TESTS_ONLY="0" | 
| 37 |  | -        unset CUDA_VERSION | 
|  | 12 | +permissions: | 
|  | 13 | +    id-token: write | 
|  | 14 | +    contents: write | 
| 38 | 15 | 
 | 
| 39 |  | -        # Set CHANNEL | 
| 40 |  | -        if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then | 
| 41 |  | -          export UPLOAD_CHANNEL=test | 
| 42 |  | -        else | 
| 43 |  | -          export UPLOAD_CHANNEL=nightly | 
| 44 |  | -        fi | 
|  | 16 | +defaults: | 
|  | 17 | +    run: | 
|  | 18 | +        shell: bash -l -eo pipefail {0} | 
| 45 | 19 | 
 | 
| 46 |  | -        export PATH="${PWD}/third_party/install/bin/:${PATH}" | 
| 47 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true | 
| 48 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true | 
| 49 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true | 
| 50 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS=true | 
| 51 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS=true | 
| 52 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI=true | 
| 53 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA=true | 
| 54 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL=true | 
| 55 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310=true | 
| 56 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE=true | 
| 57 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS=true | 
| 58 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true | 
| 59 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true | 
| 60 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true | 
| 61 |  | -        export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true | 
| 62 |  | -        echo '::endgroup::' | 
|  | 20 | +jobs: | 
|  | 21 | +    generate-matrix: | 
|  | 22 | +        uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | 
|  | 23 | +        with: | 
|  | 24 | +            package-type: wheel | 
|  | 25 | +            os: linux | 
|  | 26 | +            test-infra-repository: pytorch/test-infra | 
|  | 27 | +            test-infra-ref: main | 
|  | 28 | +            with-cpu: disable | 
|  | 29 | +            with-xpu: disable | 
|  | 30 | +            with-rocm: disable | 
|  | 31 | +            with-cuda: disable | 
|  | 32 | +            build-python-only: "disable" | 
|  | 33 | +    build: | 
|  | 34 | +        needs: generate-matrix | 
|  | 35 | +        strategy: | 
|  | 36 | +            fail-fast: false | 
|  | 37 | +        name: Build and Upload wheel | 
|  | 38 | +        uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main | 
|  | 39 | +        with: | 
|  | 40 | +            repository: pytorch/audio | 
|  | 41 | +            ref: "" | 
|  | 42 | +            test-infra-repository: pytorch/test-infra | 
|  | 43 | +            test-infra-ref: main | 
|  | 44 | +            build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | 
|  | 45 | +            pre-script: packaging/pre_build_script.sh | 
|  | 46 | +            post-script: packaging/post_build_script.sh | 
|  | 47 | +            smoke-test-script: packaging/fake_smoke_test.py | 
|  | 48 | +            package-name: torchaudio | 
|  | 49 | +            trigger-event: ${{ github.event_name }} | 
|  | 50 | +            build-platform: "python-build-package" | 
|  | 51 | +            build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=0 python -m build --wheel -vvv --no-isolation" | 
| 63 | 52 | 
 | 
| 64 |  | -        set -euxo pipefail | 
|  | 53 | +    run-tests: | 
|  | 54 | +        runs-on: ubuntu-latest | 
|  | 55 | +        strategy: | 
|  | 56 | +            fail-fast: false | 
|  | 57 | +            matrix: | 
|  | 58 | +                # 3.10 corresponds to the minimum python version for which we build | 
|  | 59 | +                # the wheel unless the label cliflow/binaries/all is present in the | 
|  | 60 | +                # PR. | 
|  | 61 | +                python-version: ["3.10"] | 
|  | 62 | +                ffmpeg-version-for-tests: ["7"] | 
|  | 63 | +        container: | 
|  | 64 | +            image: "pytorch/manylinux2_28-builder:cpu" | 
|  | 65 | +        needs: build | 
|  | 66 | +        steps: | 
|  | 67 | +            - name: Setup env vars | 
|  | 68 | +              run: | | 
|  | 69 | +                  python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g') | 
|  | 70 | +                  echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV | 
|  | 71 | +            - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | 
|  | 72 | +              with: | 
|  | 73 | +                  name: pytorch_audio__${{ matrix.python-version }}_x86_64 | 
|  | 74 | +                  path: pytorch/audio/dist/ | 
|  | 75 | +            - name: Setup miniconda using test-infra | 
|  | 76 | +              uses: pytorch/test-infra/.github/actions/setup-miniconda@main | 
|  | 77 | +              with: | 
|  | 78 | +                  python-version: ${{ matrix.python-version }} | 
|  | 79 | +                  # We install conda packages at the start because otherwise conda may have conflicts with dependencies. | 
|  | 80 | +                  default-packages: "conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" | 
|  | 81 | +            - name: Check env | 
|  | 82 | +              run: | | 
|  | 83 | +                  ${CONDA_RUN} env | 
|  | 84 | +                  ${CONDA_RUN} conda info | 
|  | 85 | +                  ${CONDA_RUN} nvidia-smi | 
|  | 86 | +                  ${CONDA_RUN} conda list | 
|  | 87 | +            - name: Assert ffmpeg exists | 
|  | 88 | +              run: | | 
|  | 89 | +                  ${CONDA_RUN} ffmpeg -buildconf | 
|  | 90 | +            - name: Update pip | 
|  | 91 | +              run: ${CONDA_RUN} python -m pip install --upgrade pip | 
|  | 92 | +            - name: Install PyTorch | 
|  | 93 | +              run: | | 
|  | 94 | +                  ${CONDA_RUN} python -m pip install --pre torch torchcodec --index-url https://download.pytorch.org/whl/nightly/cpu | 
|  | 95 | +                  ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' | 
|  | 96 | +                  ${CONDA_RUN} python -m pip install parameterized requests coverage pytest pytest-cov scipy numpy expecttest | 
|  | 97 | +            - name: Install torchaudio from the wheel | 
|  | 98 | +              run: | | 
|  | 99 | +                  wheel_path=`find pytorch/audio/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"` | 
|  | 100 | +                  echo Installing $wheel_path | 
|  | 101 | +                  ${CONDA_RUN} python -m pip install $wheel_path -vvv | 
| 65 | 102 | 
 | 
| 66 |  | -        echo '::group::Install PyTorch and Torchaudio' | 
| 67 |  | -        ./.github/scripts/unittest-linux/install.sh | 
| 68 |  | -        echo '::endgroup::' | 
|  | 103 | +            - name: Check out repo | 
|  | 104 | +              uses: actions/checkout@v3 | 
| 69 | 105 | 
 | 
| 70 |  | -        echo '::group::Run Tests' | 
| 71 |  | -        ./.github/scripts/unittest-linux/run_test.sh | 
| 72 |  | -        echo '::endgroup::' | 
|  | 106 | +            - name: Run tests | 
|  | 107 | +              run: | | 
|  | 108 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING=true | 
|  | 109 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS=true | 
|  | 110 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS=true | 
|  | 111 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS=true | 
|  | 112 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS=true | 
|  | 113 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI=true | 
|  | 114 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA=true | 
|  | 115 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL=true | 
|  | 116 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310=true | 
|  | 117 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE=true | 
|  | 118 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS=true | 
|  | 119 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true | 
|  | 120 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true | 
|  | 121 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true | 
|  | 122 | +                  export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true | 
|  | 123 | +                  pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs ${PYTEST_K_EXTRA}" | 
0 commit comments