Skip to content

tests better setup #1437

tests better setup

tests better setup #1437

Workflow file for this run

name: CI
on:
push:
branches:
- master
- main
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- 3.7
tf-version:
- 2.3.0
action:
- TEST=asr_gt
- TEST=asr_specaugment
- TEST=hello
- TEST=nn_array
- TEST=nn_attention
- TEST=nn_base
- TEST=nn_cond
- TEST=nn_conformer
- TEST=nn_const
- TEST=nn_container
- TEST=nn_conv
- TEST=nn_debug_eager_mode
- TEST=nn_encoder
- TEST=nn_generated_layers
- TEST=nn_loop
- TEST=nn_loss
- TEST=nn_masked_computation
- TEST=nn_math
- TEST=nn_normalization
- TEST=nn_rand
- TEST=nn_rec
- TEST=nn_transformer
- TEST=nn_utils
- RUN="time python3 -m tests.test_nn_transformer" # benchmark
include:
- action: RUN=tests/pycharm-inspect.py
python-version: 3.7
tf-version: 2.3.0
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.cache
~/.local
key: cache-${{ runner.os }}-py${{ matrix.python-version }}-tf${{ matrix.tf-version }}
restore-keys: |
cache-${{ runner.os }}-py${{ matrix.python-version }}-
- name: Setup dependencies
run: |
echo "PATH=$PATH:~/.local/bin" >> $GITHUB_ENV
echo "Python ${{matrix.python-version}}"
echo "pip: $(type pip)"
pip install --user --upgrade pip setuptools wheel
pip install --user typing typing_extensions | cat
# pip install --user -r requirements.txt | cat
pip install --user --upgrade tensorflow==${{ matrix.tf-version }} | cat
pip install --user pytest
pip install --user dm-tree
sudo apt-get install libsndfile1
pip install --user pysoundfile
pip install --user --upgrade returnn
- name: Test Python/Numpy/TF/RETURNN versions.
run: |
echo "Python env: $(type python) $(python --version)"
python -c "import numpy; print('NumPy:', numpy.version.full_version)"
python -c "import tensorflow as tf; print('TensorFlow:', tf.__git_version__, tf.__version__, tf.__file__)"
python -c "import tensorflow as tf; assert tf.__version__ == '${{ matrix.tf-version }}'"
python -c "import returnn; print('RETURNN:', returnn.__version__)"
- name: Cache PyCharm
if: matrix.action == 'RUN=tests/pycharm-inspect.py'
uses: actions/cache@v2
with:
path: |
~/.cache/JetBrains
key: cache-pycharm-${{ runner.os }}-py${{ matrix.python-version }}-tf${{ matrix.tf-version }}
- name: Run test
run: |
export ${{ matrix.action }}
if [[ ! -z "$TEST" ]]; then python -m pytest tests/test_$TEST.py; fi
if [[ ! -z "$RUN" ]]; then $RUN; fi