|
| 1 | +name: Continuous Integration Workflow |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - '*' |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + run-tests: |
| 13 | + |
| 14 | + name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }} |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] |
| 21 | + python-version: ['3.6', '3.7', '3.8'] |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v2 |
| 25 | + - uses: goanpeca/setup-miniconda@v1 |
| 26 | + with: |
| 27 | + auto-update-conda: true |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + |
| 30 | + - name: Install core dependencies. |
| 31 | + shell: bash -l {0} |
| 32 | + run: conda install -c conda-forge tox-conda coverage |
| 33 | + |
| 34 | + - name: Validate codecov.yml |
| 35 | + if: runner.os == 'Linux' && matrix.python-version == '3.7' |
| 36 | + shell: bash -l {0} |
| 37 | + run: cat codecov.yml | curl --data-binary @- https://codecov.io/validate |
| 38 | + |
| 39 | + # Unit, integration, and end-to-end tests. |
| 40 | + |
| 41 | + - name: Run unit tests and doctests. |
| 42 | + shell: bash -l {0} |
| 43 | + run: tox -e pytest -- -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml |
| 44 | + |
| 45 | + - name: Upload coverage report for unit tests and doctests. |
| 46 | + if: runner.os == 'Linux' && matrix.python-version == '3.7' |
| 47 | + shell: bash -l {0} |
| 48 | + run: bash <(curl -s https://codecov.io/bash) -F unit -c |
| 49 | + |
| 50 | + - name: Run integration tests. |
| 51 | + shell: bash -l {0} |
| 52 | + run: tox -e pytest -- -m integration --cov=./ --cov-report=xml |
| 53 | + |
| 54 | + - name: Upload coverage reports of integration tests. |
| 55 | + if: runner.os == 'Linux' && matrix.python-version == '3.7' |
| 56 | + shell: bash -l {0} |
| 57 | + run: bash <(curl -s https://codecov.io/bash) -F integration -c |
| 58 | + |
| 59 | + - name: Run end-to-end tests. |
| 60 | + shell: bash -l {0} |
| 61 | + run: tox -e pytest -- -m end_to_end --cov=./ --cov-report=xml |
| 62 | + |
| 63 | + - name: Upload coverage reports of end-to-end tests. |
| 64 | + if: runner.os == 'Linux' && matrix.python-version == '3.7' |
| 65 | + shell: bash -l {0} |
| 66 | + run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c |
| 67 | + |
| 68 | + |
| 69 | + pre-commit: |
| 70 | + |
| 71 | + name: Run pre-commit. |
| 72 | + runs-on: ubuntu-latest |
| 73 | + |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v2 |
| 76 | + |
| 77 | + - name: Set up Python 3.7 |
| 78 | + uses: actions/setup-python@v1 |
| 79 | + with: |
| 80 | + python-version: 3.7 |
| 81 | + |
| 82 | + - name: Install dependencies |
| 83 | + run: pip install tox |
| 84 | + |
| 85 | + - name: Run pre-commit |
| 86 | + run: tox -e pre-commit |
| 87 | + |
| 88 | + |
| 89 | + docs: |
| 90 | + |
| 91 | + name: Run documentation. |
| 92 | + runs-on: ubuntu-latest |
| 93 | + |
| 94 | + steps: |
| 95 | + - uses: actions/checkout@v2 |
| 96 | + - uses: goanpeca/setup-miniconda@v1 |
| 97 | + with: |
| 98 | + auto-update-conda: true |
| 99 | + python-version: 3.7 |
| 100 | + |
| 101 | + - name: Install core dependencies. |
| 102 | + shell: bash -l {0} |
| 103 | + run: conda install -c conda-forge tox-conda |
| 104 | + |
| 105 | + - name: Build docs |
| 106 | + shell: bash -l {0} |
| 107 | + run: tox -e sphinx |
0 commit comments