|
| 1 | +# This is a workflow for Unit, Integration, and Regression Tests |
| 2 | + |
| 3 | +name: Unit, Integration and Regression Tests |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + unit_and_integration_tests: |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + python-version: [3.11] |
| 17 | + os: [ubuntu-latest] |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + - uses: actions/setup-python@v4 |
| 22 | + with: |
| 23 | + python-version: ${{ matrix.python-version }} |
| 24 | + - name: Making virtual environment, linting |
| 25 | + run: | |
| 26 | + make testenv |
| 27 | + - name: Downloading test data |
| 28 | + run: | |
| 29 | + make get_test_data |
| 30 | + - name: Running tests |
| 31 | + run: | |
| 32 | + source .venv/bin/activate |
| 33 | + coverage run --source=jwave -m pytest -xvs --ignore=tests/regression_tests |
| 34 | + - name: "Upload coverage data for unit and integration tests" |
| 35 | + uses: actions/upload-artifact@v2 |
| 36 | + with: |
| 37 | + name: coverage-unit |
| 38 | + path: ./.coverage |
| 39 | + |
| 40 | + regression_tests: |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + python-version: [3.11] |
| 44 | + os: [ubuntu-latest] |
| 45 | + runs-on: ${{ matrix.os }} |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v3 |
| 48 | + - uses: actions/setup-python@v4 |
| 49 | + with: |
| 50 | + python-version: ${{ matrix.python-version }} |
| 51 | + - name: Making virtual environment, linting |
| 52 | + run: | |
| 53 | + make testenv |
| 54 | + - name: Downloading test data |
| 55 | + run: | |
| 56 | + make get_test_data |
| 57 | + - name: Running tests |
| 58 | + run: | |
| 59 | + source .venv/bin/activate |
| 60 | + coverage run --source=jwave -m pytest -xvs ./tests/regression_tests |
| 61 | + - name: "Upload coverage data for regression tests" |
| 62 | + uses: actions/upload-artifact@v2 |
| 63 | + with: |
| 64 | + name: coverage-regression |
| 65 | + path: ./.coverage |
| 66 | + |
| 67 | + combine_coverage: |
| 68 | + needs: [unit_and_integration_tests, regression_tests] |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v3 |
| 72 | + - uses: actions/setup-python@v4 |
| 73 | + with: |
| 74 | + python-version: 3.11 |
| 75 | + - name: Install coverage |
| 76 | + run: pip install coverage |
| 77 | + - name: Download coverage data |
| 78 | + uses: actions/download-artifact@v2 |
| 79 | + with: |
| 80 | + name: coverage-unit |
| 81 | + path: unit |
| 82 | + - name: Download coverage data |
| 83 | + uses: actions/download-artifact@v2 |
| 84 | + with: |
| 85 | + name: coverage-regression |
| 86 | + path: regression |
| 87 | + - name: Combine coverage data |
| 88 | + run: | |
| 89 | + mv unit/.coverage .coverage.unit |
| 90 | + mv regression/.coverage .coverage.regression |
| 91 | + coverage combine |
| 92 | + coverage xml |
| 93 | + - name: "Upload combined coverage to Codecov" |
| 94 | + uses: codecov/codecov-action@v3 |
| 95 | + with: |
| 96 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 97 | + files: ./coverage.xml |
| 98 | + name: codecov-umbrella |
0 commit comments