Skip to content

Store cache

Store cache #42

name: Store cache
on:
workflow_dispatch:
inputs:
os:
description: "Operating system"
required: true
default: "ubuntu-latest"
type: choice
options:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
description: "Python version"
required: true
default: "3.12"
type: string
torch-version:
description: "PyTorch version"
required: true
default: "2.6.0"
type: string
jobs:
package-and-recipes:
name: Run package tests
runs-on: ${{ inputs.os }}
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies (Windows)
if: ${{ inputs.os == 'windows-latest' }}
run: |
powershell -File tests/scripts/install_windows_dependencies.ps1
- name: Install dependencies (Ubuntu)
if: ${{ inputs.os == 'ubuntu-latest' }}
run: |
. tests/scripts/install_ubuntu_dependencies.sh
- name: Install dependencies (MacOS)
if: ${{ inputs.os == 'macos-13' || inputs.os == 'macos-latest' }}
run: |
. tests/scripts/install_macos_dependencies.sh
- name: Show version of FFmpeg
run: |
ffmpeg -version
- name: Overwrite torch version in pyproject.toml (Windows)
id: windows_torch_installation
if: ${{ inputs.os == 'windows-latest' }}
env:
TORCH_VERSION: ${{ inputs.torch-version }}
run: |
python tests/scripts/overwrite_pyproject_toml.py --path pyproject.toml --torch-version ${env:TORCH_VERSION}
- name: Overwrite torch version in pyproject.toml (Ubuntu & MacOS)
if: steps.windows_torch_installation.conclusion == 'skipped'
env:
TORCH_VERSION: ${{ inputs.torch-version }}
run: |
python tests/scripts/overwrite_pyproject_toml.py --path pyproject.toml --torch-version ${TORCH_VERSION}
- name: Install dependencies
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,tests]"
- name: Install dependencies (Windows)
if: ${{ inputs.os == 'windows-latest' }}
run: |
pip install soundfile
- name: Show dependencies
run: |
pip list
- name: Verify version of torch (Windows)
id: windows_torch_verification
if: ${{ inputs.os == 'windows-latest' }}
env:
TORCH_VERSION: ${{ inputs.torch-version }}
run: |
python tests/scripts/verify_torch_version.py --torch-version ${env:TORCH_VERSION}
- name: Verify version of torch (Ubuntu & MacOS)
if: steps.windows_torch_verification.conclusion == 'skipped'
env:
TORCH_VERSION: ${{ inputs.torch-version }}
run: |
python tests/scripts/verify_torch_version.py --torch-version ${TORCH_VERSION}
- name: Show backend of torchaudio
run: |
python -c "import torchaudio; print(torchaudio.list_audio_backends())"
python -c "import torchaudio; assert len(torchaudio.list_audio_backends()) > 0"
- name: Pytest for updating package (Windows)
if: ${{ inputs.os == 'windows-latest' }}
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
USE_LIBUV: 0
run: |
pytest -vvv -p no:faulthandler tests/package/
- name: Pytest for updating package (Ubuntu & MacOS)
if: ${{ inputs.os != 'windows-latest' }}
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
pytest -vvv --log-cli-level=ERROR tests/package/
- name: Recipe test
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
cd tests/recipes/
. ./test_all.sh
- name: Store cache
uses: actions/cache/save@v4
with:
path: |
~/.cache/audyn
~/.cache/audyn_test
key: audyn-${{ runner.os }}-${{ github.sha }}