Fix: Clotho check for metadata and audio files. #289
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
# Template: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python package using Pip | |
on: | |
push: | |
branches: [ main, dev ] | |
pull_request: | |
branches: [ main, dev ] | |
env: | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
AAC_DATASETS_ROOT: "$HOME/.cache/data" | |
# Cancel workflow if a new push occurs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.7", "3.11"] | |
steps: | |
# --- INSTALLATIONS --- | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install package | |
shell: bash | |
# note: ${GITHUB_REF##*/} gives the branch name | |
# note 2: dev is NOT the branch here, but the dev dependencies | |
run: | | |
python -m pip install "aac-datasets[dev] @ git+https://github.com/Labbeti/aac-datasets@${GITHUB_REF##*/}" | |
- name: Install soundfile for torchaudio, ffmpeg and yt-dlp for AudioCaps download | |
run: | | |
sudo apt-get update | |
sudo apt-get install libsndfile1 | |
sudo apt-get install ffmpeg yt-dlp | |
# --- TESTS --- | |
- name: Compile python files | |
run: | | |
python -m compileall src | |
- name: Lint with flake8 | |
run: | | |
python -m flake8 --config .flake8 --exit-zero --show-source --statistics src | |
- name: Check format with Black | |
run: | | |
python -m black --check --diff src | |
- name: Print install info | |
run: | | |
aac-datasets-info | |
- name: Test with pytest | |
run: | | |
python -m pytest -v | |
- name: Build data root | |
run: | | |
dataroot=`eval echo $AAC_DATASETS_ROOT` | |
echo "Building directory '$dataroot'..." | |
mkdir -p "$dataroot" | |
- name: Try to download Clotho val | |
run: | | |
aac-datasets-download --verbose 2 clotho --subsets val | |
- name: Try to download AudioCaps val | |
run: | | |
aac-datasets-download --verbose 2 audiocaps --subsets val | |
- name: Check data root | |
run: | | |
aac-datasets-check --verbose 2 --datasets clotho audiocaps |