|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + ubuntu: |
| 7 | + |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + python-version: [3.6, 3.7, 3.8] |
| 12 | + use-conda: [true, false] |
| 13 | + use-dist: [false] |
| 14 | + include: |
| 15 | + - python-version: 3.8 |
| 16 | + code-cov: true |
| 17 | + - python-version: 3.7 |
| 18 | + use-conda: false |
| 19 | + use-dist: true |
| 20 | + fail-fast: false |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - name: Setup Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v2 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + - name: Conda Install test dependencies |
| 29 | + if: matrix.use-conda == true |
| 30 | + run: | |
| 31 | + # Miniconda is available in $CONDA env var |
| 32 | + $CONDA/bin/conda create -n testenv --yes pip wheel gxx_linux-64 gcc_linux-64 swig python=${{ matrix.python-version }} |
| 33 | + $CONDA/envs/testenv/bin/python3 -m pip install --upgrade pip |
| 34 | + $CONDA/envs/testenv/bin/pip3 install -e .[test] |
| 35 | + - name: Install test dependencies |
| 36 | + if: matrix.use-conda == false && matrix.use-dist == false |
| 37 | + run: | |
| 38 | + python -m pip install --upgrade pip |
| 39 | + if [[ `python -c 'import platform; print(platform.python_version())' | cut -d '.' -f 2` -eq 6 ]]; then |
| 40 | + # Numpy 1.20 dropped suppert for Python3.6 |
| 41 | + pip install "numpy<=1.19" |
| 42 | + fi |
| 43 | + pip install -e .[test] |
| 44 | + sudo apt-get update |
| 45 | + sudo apt-get remove swig |
| 46 | + sudo apt-get install swig3.0 |
| 47 | + sudo ln -s /usr/bin/swig3.0 /usr/bin/swig |
| 48 | + - name: Dist Install test dependencies |
| 49 | + if: matrix.use-conda == false && matrix.use-dist == true |
| 50 | + run: | |
| 51 | + python -m pip install --upgrade pip |
| 52 | + sudo apt-get update |
| 53 | + sudo apt-get remove swig |
| 54 | + sudo apt-get install swig3.0 |
| 55 | + sudo ln -s /usr/bin/swig3.0 /usr/bin/swig |
| 56 | + # We need to install for the dependencies, like pytest |
| 57 | + pip install -e .[test] |
| 58 | + # Then we remove autosklearn and install from DIST |
| 59 | + pip uninstall --yes auto-sklearn |
| 60 | + python setup.py sdist |
| 61 | + last_dist=$(ls -t dist/auto-sklearn-*.tar.gz | head -n 1) |
| 62 | + pip install $last_dist |
| 63 | + - name: Store repository status |
| 64 | + id: status-before |
| 65 | + run: | |
| 66 | + echo "::set-output name=BEFORE::$(git status --porcelain -b)" |
| 67 | + - name: Conda Run tests |
| 68 | + if: matrix.use-conda == true |
| 69 | + run: | |
| 70 | + export OPENBLAS_NUM_THREADS=1 |
| 71 | + export OMP_NUM_THREADS=1 |
| 72 | + export MKL_NUM_THREADS=1 |
| 73 | + # We activate conda as metalearning uses python directly, so we need |
| 74 | + # to change the default python |
| 75 | + export PATH="$CONDA/envs/testenv/bin:$PATH" |
| 76 | + if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi |
| 77 | + $CONDA/envs/testenv/bin/python3 -m pytest --durations=20 --timeout=300 --timeout-method=thread -v $codecov test |
| 78 | + - name: Run tests |
| 79 | + if: matrix.use-conda == false |
| 80 | + run: | |
| 81 | + export OPENBLAS_NUM_THREADS=1 |
| 82 | + export OMP_NUM_THREADS=1 |
| 83 | + export MKL_NUM_THREADS=1 |
| 84 | + if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi |
| 85 | + pytest --durations=20 --timeout=300 --timeout-method=thread -v $codecov test |
| 86 | + - name: Check for files left behind by test |
| 87 | + if: ${{ always() }} |
| 88 | + run: | |
| 89 | + before="${{ steps.status-before.outputs.BEFORE }}" |
| 90 | + after="$(git status --porcelain -b)" |
| 91 | + if [[ "$before" != "$after" ]]; then |
| 92 | + echo "git status from before: $before" |
| 93 | + echo "git status from after: $after" |
| 94 | + echo "Not all generated files have been deleted!" |
| 95 | + exit 1 |
| 96 | + fi |
| 97 | + - name: Upload coverage |
| 98 | + if: matrix.code-cov && always() |
| 99 | + uses: codecov/codecov-action@v1 |
| 100 | + with: |
| 101 | + fail_ci_if_error: true |
| 102 | + verbose: true |
0 commit comments