|
| 1 | +name: Test strawberry |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - release/** |
| 8 | + |
| 9 | + pull_request: |
| 10 | + |
| 11 | +# Cancel in progress workflows on pull_requests. |
| 12 | +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +env: |
| 21 | + BUILD_CACHE_KEY: ${{ github.sha }} |
| 22 | + CACHED_BUILD_PATHS: | |
| 23 | + ${{ github.workspace }}/dist-serverless |
| 24 | +
|
| 25 | +jobs: |
| 26 | + test: |
| 27 | + name: strawberry, python ${{ matrix.python-version }}, ${{ matrix.os }} |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + timeout-minutes: 30 |
| 30 | + |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + python-version: ["3.8","3.9","3.10","3.11"] |
| 35 | + # python3.6 reached EOL and is no longer being supported on |
| 36 | + # new versions of hosted runners on Github Actions |
| 37 | + # ubuntu-20.04 is the last version that supported python3.6 |
| 38 | + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 |
| 39 | + os: [ubuntu-20.04] |
| 40 | + |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - uses: actions/setup-python@v4 |
| 44 | + with: |
| 45 | + python-version: ${{ matrix.python-version }} |
| 46 | + |
| 47 | + - name: Setup Test Env |
| 48 | + run: | |
| 49 | + pip install coverage "tox>=3,<4" |
| 50 | +
|
| 51 | + - name: Test strawberry |
| 52 | + uses: nick-fields/retry@v2 |
| 53 | + with: |
| 54 | + timeout_minutes: 15 |
| 55 | + max_attempts: 2 |
| 56 | + retry_wait_seconds: 5 |
| 57 | + shell: bash |
| 58 | + command: | |
| 59 | + set -x # print commands that are executed |
| 60 | + coverage erase |
| 61 | +
|
| 62 | + # Run tests |
| 63 | + ./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch && |
| 64 | + coverage combine .coverage* && |
| 65 | + coverage xml -i |
| 66 | +
|
| 67 | + - uses: codecov/codecov-action@v3 |
| 68 | + with: |
| 69 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 70 | + files: coverage.xml |
| 71 | + |
| 72 | + |
| 73 | + check_required_tests: |
| 74 | + name: All strawberry tests passed or skipped |
| 75 | + needs: test |
| 76 | + # Always run this, even if a dependent job failed |
| 77 | + if: always() |
| 78 | + runs-on: ubuntu-20.04 |
| 79 | + steps: |
| 80 | + - name: Check for failures |
| 81 | + if: contains(needs.test.result, 'failure') |
| 82 | + run: | |
| 83 | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 |
0 commit comments