|
| 1 | +name: "Run Tests" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - '*' |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: testing-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + # Determine if tests should be run based on commit message. |
| 17 | + check_skip: |
| 18 | + name: Determine if CI should be skipped |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + skip: ${{ steps.result_step.outputs.ci-skip }} |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + - id: result_step |
| 27 | + uses: mstachniuk/ci-skip@master |
| 28 | + with: |
| 29 | + commit-filter: '[skip ci];[ci skip];[skip github]' |
| 30 | + commit-filter-separator: ';' |
| 31 | + |
| 32 | + run_unit_tests: |
| 33 | + name: Unit tests |
| 34 | + needs: check_skip |
| 35 | + if: ${{ needs.check_skip.outputs.skip == 'false' }} |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + os: ["ubuntu-latest", "macos-latest"] |
| 41 | + python-version: ["3.7", "3.8", "3.9", "3.10"] |
| 42 | + defaults: |
| 43 | + run: |
| 44 | + shell: bash |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v2 |
| 47 | + - name: 'Set up python' |
| 48 | + uses: actions/setup-python@v2 |
| 49 | + with: |
| 50 | + python-version: ${{ matrix.python-version }} |
| 51 | + - name: 'Install IDConn' |
| 52 | + shell: bash {0} |
| 53 | + run: pip install -e .[tests] |
| 54 | + - name: 'Run tests' |
| 55 | + shell: bash {0} |
| 56 | + run: py.test --cov-append --cov-report=xml --cov=idconn idconn |
| 57 | + - name: Upload artifacts |
| 58 | + uses: actions/upload-artifact@v2 |
| 59 | + with: |
| 60 | + name: unit_${{ matrix.os }}_${{ matrix.python-version }} |
| 61 | + path: coverage.xml |
| 62 | + if: success() |
| 63 | + |
| 64 | + upload_to_codecov: |
| 65 | + name: Upload coverage |
| 66 | + needs: [run_unit_tests] |
| 67 | + runs-on: "ubuntu-latest" |
| 68 | + steps: |
| 69 | + - name: Checkout |
| 70 | + uses: actions/checkout@v2 |
| 71 | + - name: Download artifacts |
| 72 | + uses: actions/download-artifact@v2 |
| 73 | + - name: Upload to CodeCov |
| 74 | + uses: codecov/codecov-action@v2 |
| 75 | + with: |
| 76 | + fail_ci_if_error: true |
0 commit comments