|
1 | 1 | name: Tests
|
2 | 2 |
|
3 |
| -on: [push, pull_request] |
| 3 | +on: |
| 4 | + # Allow to manually trigger through github API |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | + # Triggers with push to these branches |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - development |
| 12 | + |
| 13 | + # Triggers with push to pr targeting these branches |
| 14 | + pull_request: |
| 15 | + branches: |
| 16 | + - master |
| 17 | + - development |
| 18 | + |
| 19 | + schedule: |
| 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=600 |
| 30 | + --timeout-method=signal |
| 31 | + -v |
| 32 | +
|
| 33 | + # Arguments used for code-cov which is later used to annotate PR's on github |
| 34 | + code-cov-args: >- |
| 35 | + --cov=autoPyTorch |
| 36 | + --cov-report=xml |
| 37 | + --cov-config=.coveragerc |
4 | 38 |
|
5 | 39 | jobs:
|
6 |
| - ubuntu: |
| 40 | + tests: |
| 41 | + |
| 42 | + name: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }} |
| 43 | + runs-on: ${{ matrix.os }} |
7 | 44 |
|
8 |
| - runs-on: ubuntu-latest |
9 | 45 | strategy:
|
| 46 | + fail-fast: false |
10 | 47 | matrix:
|
11 |
| - python-version: [3.7, 3.8, 3.9] |
| 48 | + os: [windows-latest, macos-latest, ubuntu-latest] |
| 49 | + python-version: ['3.7', '3.8', '3.9', '3.10'] |
| 50 | + kind: ['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 | + |
| 62 | + # Exclude python 3.10 as torch is not support python 3.10 yet |
| 63 | + - python-version: '3.10' |
| 64 | + |
12 | 65 | include:
|
13 |
| - - python-version: 3.8 |
| 66 | + # Add the tag code-cov to ubuntu-3.7-source |
| 67 | + - os: ubuntu-latest |
| 68 | + python-version: 3.7 |
| 69 | + kind: 'source' |
14 | 70 | code-cov: true
|
15 |
| - fail-fast: false |
16 |
| - max-parallel: 2 |
| 71 | + |
| 72 | + # Include one config with dist, ubuntu-3.7-dist |
| 73 | + - os: ubuntu-latest |
| 74 | + python-version: 3.7 |
| 75 | + kind: 'dist' |
17 | 76 |
|
18 | 77 | steps:
|
19 |
| - - uses: actions/checkout@v2 |
20 |
| - with: |
21 |
| - submodules: recursive |
| 78 | + - name: Checkout |
| 79 | + uses: actions/checkout@v2 |
| 80 | + |
22 | 81 | - name: Setup Python ${{ matrix.python-version }}
|
23 | 82 | uses: actions/setup-python@v2
|
24 | 83 | with:
|
25 | 84 | python-version: ${{ matrix.python-version }}
|
26 |
| - - name: Install test dependencies |
| 85 | + |
| 86 | + - name: Source install |
| 87 | + if: matrix.kind == 'source' |
27 | 88 | run: |
|
28 | 89 | python -m pip install --upgrade pip
|
29 | 90 | pip install -e .[test]
|
| 91 | +
|
| 92 | + - name: Dist install |
| 93 | + if: matrix.kind == 'dist' |
| 94 | + run: | |
| 95 | + git submodule update --init --recursive |
| 96 | +
|
| 97 | + python setup.py sdist |
| 98 | + last_dist=$(ls -t dist/autoPyTorch-*.tar.gz | head -n 1) |
| 99 | + pip install $last_dist[test] |
| 100 | +
|
30 | 101 | - name: Store repository status
|
31 | 102 | id: status-before
|
32 | 103 | run: |
|
33 | 104 | echo "::set-output name=BEFORE::$(git status --porcelain -b)"
|
| 105 | +
|
34 | 106 | - name: Run tests
|
35 | 107 | run: |
|
36 | 108 | if [ ${{ matrix.code-cov }} ]; then
|
37 |
| - codecov='--cov=autoPyTorch --cov-report=xml --cov-config=.coveragerc'; |
| 109 | + python -m pytest ${{ env.pytest-args }} ${{ env.code-cov-args }} test |
| 110 | + else |
| 111 | + python -m pytest ${{ env.pytest-args }} test |
38 | 112 | fi
|
39 |
| - python -m pytest --forked --durations=20 --timeout=600 --timeout-method=signal -v $codecov test |
| 113 | +
|
40 | 114 | - name: Check for files left behind by test
|
41 | 115 | if: ${{ always() }}
|
42 | 116 | run: |
|
|
48 | 122 | echo "Not all generated files have been deleted!"
|
49 | 123 | exit 1
|
50 | 124 | fi
|
| 125 | +
|
51 | 126 | - name: Upload coverage
|
52 | 127 | if: matrix.code-cov && always()
|
53 | 128 | uses: codecov/codecov-action@v1
|
|
0 commit comments