11name : Tests
22
33on :
4+ # Manually triggerable in github
5+ workflow_dispatch :
6+
7+ # When a push occurs on either of these branches
48 push :
9+ branches :
10+ - master
11+ - development
12+
13+ # When a push occurs on a PR that targets these branches
514 pull_request :
6- workflow_dispatch :
15+ branches :
16+ - master
17+ - development
18+
719 schedule :
8- # Every Monday at 7AM UTC
9- - cron : ' 0 07 * * 1'
20+ # Every day at 7AM UTC
21+ - cron : ' 0 07 * * *'
22+
23+ env :
24+
25+ # Arguments used for pytest
26+ pytest-args : >-
27+ --forked
28+ --durations=20
29+ --timeout=300
30+ --timeout-method=thread
31+ -s
32+
33+ # Arguments used for code-cov which is later used to annotate PR's on github
34+ code-cov-args : >-
35+ --cov=autosklearn
36+ --cov-report=xml
1037
1138jobs :
39+
1240 ubuntu :
13- runs-on : ubuntu-20.04
41+
42+ name : ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
43+ runs-on : ${{ matrix.os }}
1444
1545 strategy :
46+ fail-fast : false
1647 matrix :
48+ os : [windows-latest, macos-latest, ubuntu-latest]
1749 python-version : ['3.7', '3.8', '3.9', '3.10']
18- use-conda : [true, false]
19- use-dist : [false]
50+ kind : ['conda', 'source', 'dist']
51+
52+ exclude :
53+ # Exclude all configurations *-*-dist, include one later
54+ - kind : ' dist'
55+
56+ # Exclude windows as bash commands wont work in windows runner
57+ - os : windows-latest
58+
59+ # Exclude macos as there are permission errors using conda as we do
60+ - os : macos-latest
61+
2062 include :
21- - python-version : ' 3.8'
63+ # Add the tag code-cov to ubuntu-3.7-source
64+ - os : ubuntu-latest
65+ python-version : 3.7
66+ kind : ' source'
2267 code-cov : true
23- - python-version : ' 3.7'
24- use-conda : false
25- use-dist : true
26- fail-fast : false
68+
69+ # Include one config with dist, ubuntu-3.7-dist
70+ - os : ubuntu-latest
71+ python-version : 3.7
72+ kind : ' dist'
2773
2874 steps :
2975
30- - uses : actions/checkout@v2
76+ - name : Checkout
77+ uses : actions/checkout@v2
3178 with :
3279 submodules : recursive
3380
3481 - name : Setup Python ${{ matrix.python-version }}
3582 uses : actions/setup-python@v2
36- # A note on checkout: When checking out the repository that
37- # triggered a workflow, this defaults to the reference or SHA for that event.
38- # Otherwise, uses the default branch (master) is used.
3983 with :
4084 python-version : ${{ matrix.python-version }}
4185
42- - name : Conda Install test dependencies
43- if : matrix.use-conda == true
86+ - name : Conda install
87+ if : matrix.kind == 'conda'
4488 run : |
4589 # Miniconda is available in $CONDA env var
4690 $CONDA/bin/conda create -n testenv --yes pip wheel gxx_linux-64 gcc_linux-64 swig python=${{ matrix.python-version }}
4791 $CONDA/envs/testenv/bin/python3 -m pip install --upgrade pip
4892 $CONDA/envs/testenv/bin/pip3 install -e .[test]
4993
50- - name : Install test dependencies
51- if : matrix.use-conda == false && matrix.use-dist == false
94+ - name : Source install
95+ if : matrix.kind == 'source'
5296 run : |
5397 python -m pip install --upgrade pip
54- if [[ `python -c 'import platform; print(platform.python_version())' | cut -d '.' -f 2` -eq 6 ]]; then
55- # Numpy 1.20 dropped suppert for Python3.6
56- pip install "numpy<=1.19"
57- fi
5898 pip install -e .[test]
59- sudo apt-get update
60- sudo apt-get remove swig
61- sudo apt-get install swig3.0
62- sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
6399
64- - name : Dist Install test dependencies
65- if : matrix.use-conda == false && matrix.use- dist == true
100+ - name : Dist install
101+ if : matrix.kind == ' dist'
66102 run : |
67103 python -m pip install --upgrade pip
68- sudo apt-get update
69- sudo apt-get remove swig
70- sudo apt-get install swig3.0
71- sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
72- # We need to install for the dependencies, like pytest
73104 python setup.py sdist
74105 last_dist=$(ls -t dist/auto-sklearn-*.tar.gz | head -n 1)
75106 pip install $last_dist[test]
76107
77- - name : Store repository status
108+ - name : Store git status
78109 id : status-before
79110 run : |
80111 echo "::set-output name=BEFORE::$(git status --porcelain -b)"
81112
82- - name : Conda Run tests
113+ - name : Tests
83114 timeout-minutes : 60
84- if : matrix.use-conda == true
85115 run : |
86116 export OPENBLAS_NUM_THREADS=1
87117 export OMP_NUM_THREADS=1
88118 export MKL_NUM_THREADS=1
89- # We activate conda as metalearning uses python directly, so we need
90- # to change the default python
91- export PATH="$CONDA/envs/testenv/bin:$PATH"
92- if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi
93- $CONDA/envs/testenv/bin/python3 -m pytest --durations=20 --timeout=300 --timeout-method=thread -v $codecov test
94119
95- - name : Run tests
96- timeout-minutes : 60
97- if : matrix.use-conda == false
98- run : |
99- export OPENBLAS_NUM_THREADS=1
100- export OMP_NUM_THREADS=1
101- export MKL_NUM_THREADS=1
102- if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi
103- pytest --durations=20 --timeout=300 --timeout-method=thread -v $codecov test
120+ if [[ ${{ matrix.kind }} == 'conda' ]]; then
121+ PYTHON=$CONDA/envs/testenv/bin/python3
122+
123+ # As one of the tests runs a subprocess command and calls `python3`, we must
124+ # explicitly add it to the path
125+ export PATH="$CONDA/envs/testenv/bin:$PATH"
126+
127+ else
128+ PYTHON=$(which python3)
129+ fi
130+
131+ if [ ${{ matrix.code-cov }} ]; then
132+ $PYTHON -m pytest ${{ env.pytest-args }} ${{ env.code-cov-args }} test
133+ else
134+ $PYTHON -m pytest ${{ env.pytest-args }} test
135+ fi
104136
105137 - name : Check for files left behind by test
106138 if : ${{ always() }}
@@ -116,7 +148,7 @@ jobs:
116148
117149 - name : Upload coverage
118150 if : matrix.code-cov && always()
119- uses : codecov/codecov-action@v1
151+ uses : codecov/codecov-action@v2
120152 with :
121153 fail_ci_if_error : true
122154 verbose : true
0 commit comments