|
| 1 | +name: Execute tests |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + basepath: |
| 6 | + required: false |
| 7 | + type: string |
| 8 | + os: |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + workpath: |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + |
| 15 | +jobs: |
| 16 | + test: |
| 17 | + runs-on: ${{ inputs.os }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + python-version: ["3.8", "3.9", "3.10"] |
| 22 | + name: Python ${{ matrix.python-version }} |
| 23 | + |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + working-directory: ${{ inputs.workpath }} |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v2 |
| 31 | + |
| 32 | + - name: Change path on Windows |
| 33 | + if: ${{ inputs.os == 'windows-latest' }} |
| 34 | + # Cannot start powershell from a path that does not exist, so change |
| 35 | + # working directory for this step only. |
| 36 | + working-directory: ${{ inputs.basepath }} |
| 37 | + run: | |
| 38 | + mkdir -p ${{ inputs.workpath }} |
| 39 | + mv $env:GITHUB_WORKSPACE\* ${{ inputs.workpath }}\ -Force |
| 40 | +
|
| 41 | + - uses: actions/setup-python@v2 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.python-version }} |
| 44 | + architecture: x64 |
| 45 | + |
| 46 | + - uses: Gr1N/setup-poetry@v8 |
| 47 | + |
| 48 | + - name: Check system dependencies |
| 49 | + run: make doctor |
| 50 | + |
| 51 | + - uses: actions/cache@v2 |
| 52 | + with: |
| 53 | + path: .venv |
| 54 | + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} |
| 55 | + |
| 56 | + - name: Install project dependencies |
| 57 | + run: make install |
| 58 | + |
| 59 | + # Some tests fails intermittently, likely due to the public runners being |
| 60 | + # very slow. Especially any client/server tests seems to be problematic. |
| 61 | + # This is a simple attempt to re-run the tests up to three times if they |
| 62 | + # fail. Does not add any execution time if successful. |
| 63 | + - name: Run tests attempt 1 |
| 64 | + run: make test |
| 65 | + - name: Run tests attempt 2 |
| 66 | + if: ${{ failure() }} |
| 67 | + run: make test |
| 68 | + - name: Run tests attempt 3 |
| 69 | + if: ${{ failure() }} |
| 70 | + run: make test |
| 71 | + |
| 72 | + - name: Upload coverage |
| 73 | + uses: codecov/codecov-action@v1 |
| 74 | + if: ${{ inputs.os == 'ubuntu-latest' && matrix.python-version == '3.9' && github.repository == 'doorstop-dev/doorstop' }} |
| 75 | + with: |
| 76 | + fail_ci_if_error: true |
| 77 | + |
| 78 | + - name: Run checks |
| 79 | + run: make check |
| 80 | + if: ${{ inputs.os == 'ubuntu-latest' }} |
| 81 | + |
| 82 | + - name: Run demo |
| 83 | + run: make demo |
| 84 | + if: ${{ inputs.os == 'ubuntu-latest' }} |
0 commit comments