|
| 1 | +# Do not edit this YAML file. This file is generated automatically by executing |
| 2 | +# python scripts/split_tox_gh_actions/split_tox_gh_actions.py |
| 3 | +# The template responsible for it is in |
| 4 | +# scripts/split_tox_gh_actions/templates/base.jinja |
| 5 | +name: Test AWS |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + - release/** |
| 11 | + - potel-base |
| 12 | + # XXX: We are using `pull_request_target` instead of `pull_request` because we want |
| 13 | + # this to run on forks with access to the secrets necessary to run the test suite. |
| 14 | + # Prefer to use `pull_request` when possible. |
| 15 | + pull_request_target: |
| 16 | + types: [labeled, opened, reopened, synchronize] |
| 17 | +# Cancel in progress workflows on pull_requests. |
| 18 | +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 21 | + cancel-in-progress: true |
| 22 | +permissions: |
| 23 | + contents: read |
| 24 | + # `write` is needed to remove the `Trigger: tests using secrets` label |
| 25 | + pull-requests: write |
| 26 | +env: |
| 27 | + SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }} |
| 28 | + SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }} |
| 29 | + BUILD_CACHE_KEY: ${{ github.sha }} |
| 30 | + CACHED_BUILD_PATHS: | |
| 31 | + ${{ github.workspace }}/dist-serverless |
| 32 | +jobs: |
| 33 | + check-permissions: |
| 34 | + name: permissions check |
| 35 | + runs-on: ubuntu-20.04 |
| 36 | + steps: |
| 37 | + |
| 38 | + with: |
| 39 | + persist-credentials: false |
| 40 | + - name: Check permissions on PR |
| 41 | + if: github.event_name == 'pull_request_target' |
| 42 | + run: | |
| 43 | + python3 -uS .github/workflows/scripts/trigger_tests_on_label.py \ |
| 44 | + --repo-id ${{ github.event.repository.id }} \ |
| 45 | + --pr ${{ github.event.number }} \ |
| 46 | + --event ${{ github.event.action }} \ |
| 47 | + --username "$ARG_USERNAME" \ |
| 48 | + --label-names "$ARG_LABEL_NAMES" |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + # these can contain special characters |
| 52 | + ARG_USERNAME: ${{ github.event.pull_request.user.login }} |
| 53 | + ARG_LABEL_NAMES: ${{ toJSON(github.event.pull_request.labels.*.name) }} |
| 54 | + - name: Check permissions on repo branch |
| 55 | + if: github.event_name == 'push' |
| 56 | + run: true |
| 57 | + test-aws-pinned: |
| 58 | + name: AWS (pinned) |
| 59 | + timeout-minutes: 30 |
| 60 | + runs-on: ${{ matrix.os }} |
| 61 | + strategy: |
| 62 | + fail-fast: false |
| 63 | + matrix: |
| 64 | + python-version: ["3.9"] |
| 65 | + # python3.6 reached EOL and is no longer being supported on |
| 66 | + # new versions of hosted runners on Github Actions |
| 67 | + # ubuntu-20.04 is the last version that supported python3.6 |
| 68 | + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 |
| 69 | + os: [ubuntu-20.04] |
| 70 | + needs: check-permissions |
| 71 | + steps: |
| 72 | + |
| 73 | + with: |
| 74 | + ref: ${{ github.event.pull_request.head.sha || github.ref }} |
| 75 | + - uses: actions/setup-python@v5 |
| 76 | + with: |
| 77 | + python-version: ${{ matrix.python-version }} |
| 78 | + allow-prereleases: true |
| 79 | + - name: Setup Test Env |
| 80 | + run: | |
| 81 | + pip install "coverage[toml]" tox |
| 82 | + - name: Erase coverage |
| 83 | + run: | |
| 84 | + coverage erase |
| 85 | + - name: Test aws_lambda pinned |
| 86 | + run: | |
| 87 | + set -x # print commands that are executed |
| 88 | + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-aws_lambda" |
| 89 | + - name: Generate coverage XML (Python 3.6) |
| 90 | + if: ${{ !cancelled() && matrix.python-version == '3.6' }} |
| 91 | + run: | |
| 92 | + export COVERAGE_RCFILE=.coveragerc36 |
| 93 | + coverage combine .coverage-sentry-* |
| 94 | + coverage xml --ignore-errors |
| 95 | + - name: Generate coverage XML |
| 96 | + if: ${{ !cancelled() && matrix.python-version != '3.6' }} |
| 97 | + run: | |
| 98 | + coverage combine .coverage-sentry-* |
| 99 | + coverage xml |
| 100 | + - name: Upload coverage to Codecov |
| 101 | + if: ${{ !cancelled() }} |
| 102 | + |
| 103 | + with: |
| 104 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 105 | + files: coverage.xml |
| 106 | + # make sure no plugins alter our coverage reports |
| 107 | + plugin: noop |
| 108 | + verbose: true |
| 109 | + - name: Upload test results to Codecov |
| 110 | + if: ${{ !cancelled() }} |
| 111 | + uses: codecov/test-results-action@v1 |
| 112 | + with: |
| 113 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 114 | + files: .junitxml |
| 115 | + verbose: true |
| 116 | + check_required_tests: |
| 117 | + name: All pinned AWS tests passed |
| 118 | + needs: test-aws-pinned |
| 119 | + # Always run this, even if a dependent job failed |
| 120 | + if: always() |
| 121 | + runs-on: ubuntu-20.04 |
| 122 | + steps: |
| 123 | + - name: Check for failures |
| 124 | + if: contains(needs.test-aws-pinned.result, 'failure') || contains(needs.test-aws-pinned.result, 'skipped') |
| 125 | + run: | |
| 126 | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 |
0 commit comments