123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- name: acceptance
- on:
- push:
- branches:
- - master
- pull_request:
- jobs:
- parse-commit-message:
- if: ${{ github.ref != 'refs/heads/master' }}
- runs-on: ubuntu-16.04
- outputs:
- commit: ${{ steps.commit.outputs.message }}
- steps:
- - uses: actions/checkout@v2
- with:
- ref: ${{ github.event.pull_request.head.sha }}
- - name: Parse commit message
- id: commit
- run: |
- echo "::set-output name=message::$(git show -s --format=%B)"
- getsentry:
- needs: parse-commit-message
- if: ${{ contains(needs.parse-commit-message.outputs.commit, '#test-getsentry') }}
- runs-on: ubuntu-16.04
- steps:
- - name: getsentry token
- id: getsentry
- uses: getsentry/action-github-app-token@v1
- with:
- app_id: ${{ secrets.SENTRY_INTERNAL_APP_ID }}
- private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
- # Notify getsentry
- - name: Dispatch getsentry tests
- uses: actions/github-script@v3
- with:
- github-token: ${{ steps.getsentry.outputs.token }}
- script: |
- github.actions.createWorkflowDispatch({
- owner: 'getsentry',
- repo: 'getsentry',
- workflow_id: 'acceptance.yml',
- ref: 'master',
- inputs: {
- sha: '${{ github.event.pull_request.head.sha }}',
- }
- })
- jest:
- runs-on: ubuntu-latest
- env:
- VISUAL_HTML_ENABLE: 1
- steps:
- # Checkout codebase
- - uses: actions/checkout@v2
- # Install/setup node
- - uses: volta-cli/action@v1
- # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
- - name: Get yarn cache directory path
- id: yarn-cache-dir-path
- run: echo "::set-output name=dir::$(yarn cache dir)"
- # yarn cache
- - uses: actions/cache@v1
- id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- with:
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- restore-keys: |
- ${{ runner.os }}-yarn-
- - name: Install dependencies
- run: yarn install --frozen-lockfile
- - name: jest
- run: |
- NODE_ENV=production yarn build-css
- yarn test-ci --forceExit
- - name: Save HTML artifacts
- uses: actions/upload-artifact@v2
- with:
- name: jest-html
- path: .artifacts/visual-snapshots/jest
- - name: Create Images from HTML
- uses: getsentry/action-html-to-image@main
- with:
- base-path: .artifacts/visual-snapshots/jest
- css-path: src/sentry/static/sentry/dist/sentry.css
- - name: Save snapshots
- if: always()
- uses: getsentry/action-visual-snapshot@v2
- with:
- save-only: true
- snapshot-path: .artifacts/visual-snapshots
- acceptance:
- runs-on: ubuntu-16.04
- continue-on-error: true
- strategy:
- matrix:
- instance: [0, 1, 2]
- env:
- PIP_DISABLE_PIP_VERSION_CHECK: on
- # PIP_QUIET: 1
- SENTRY_LIGHT_BUILD: 1
- SENTRY_SKIP_BACKEND_VALIDATION: 1
- MIGRATIONS_TEST_MIGRATE: 0
- # Node configuration
- NODE_OPTIONS: --max-old-space-size=4096
- NODE_ENV: development
- PYTEST_SENTRY_DSN: https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
- PYTEST_ADDOPTS: "--reruns 5"
- # services configuration
- SENTRY_KAFKA_HOSTS: kafka:9093
- SENTRY_ZOOKEEPER_HOSTS: zookeeper:2182
- SENTRY_REDIS_HOST: redis
- # The hostname used to communicate with the PostgreSQL from sentry
- DATABASE_URL: postgresql://postgres:postgres@localhost/sentry
- # Number of matrix instances
- TOTAL_TEST_GROUPS: ${{ strategy.job-total }}
- VISUAL_SNAPSHOT_ENABLE: 1
- steps:
- - name: Install System Dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends \
- libxmlsec1-dev \
- libmaxminddb-dev
- # Checkout codebase
- - uses: actions/checkout@v2
- # Install node
- - uses: volta-cli/action@v1
- # Yarn
- # - See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
- # Python
- # Use `.python-version` to avoid duplication
- # XXX: can't actually read from .python-version because GitHub Actions
- # does not support our version (2.7.16)
- #
- # XXX: Using `2.7` as GHA image only seems to keep one minor version around and will break
- # CI if we pin it to a specific patch version.
- - name: Set up outputs
- id: config
- env:
- MATRIX_INSTANCE: ${{ matrix.instance }}
- run: |
- echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
- echo "::set-output name=python-version::2.7"
- echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
- echo "::set-output name=acceptance-dir::.artifacts/visual-snapshots/acceptance"
- # yarn cache
- - uses: actions/cache@v1
- id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- with:
- path: ${{ steps.config.outputs.yarn-cache-dir }}
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- restore-keys: |
- ${{ runner.os }}-yarn-
- # setup python
- - name: Set up Python ${{ steps.config.outputs.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ steps.config.outputs.python-version}}
- # setup pip
- - name: Install pip
- run: |
- pip install --no-cache-dir --upgrade "pip>=20.0.2"
- # pip cache
- - name: Get pip cache dir
- id: pip-cache
- run: |
- echo "::set-output name=dir::$(pip cache dir)"
- - name: pip cache
- uses: actions/cache@v1
- with:
- path: ${{ steps.pip-cache.outputs.dir }}
- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-
- - name: Install Javascript Dependencies
- run: |
- yarn install --frozen-lockfile
- - name: Install Python Dependencies
- env:
- PGPASSWORD: postgres
- run: |
- python setup.py install_egg_info
- pip install wheel # GitHub Actions does not have this installed by default (unlike Travis)
- pip install -U -e ".[dev]"
- - name: Start devservices
- run: |
- sentry init
- sentry devservices up postgres redis clickhouse snuba
- - name: webpack
- run: |
- yarn webpack --display errors-only
- # Setup custom pytest matcher, see https://github.com/actions/setup-node/issues/97
- - name: Add pytest log matcher
- if: always()
- run: |
- echo "::remove-matcher owner=pytest::"
- echo "::add-matcher::.github/pytest.json"
- - name: Run acceptance tests (#${{ steps.config.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
- if: always()
- run: |
- mkdir -p ${{ steps.config.outputs.acceptance-dir }}
- mkdir -p ${{ steps.config.outputs.acceptance-dir }}-mobile
- mkdir -p ${{ steps.config.outputs.acceptance-dir }}-tooltips
- [ "$GITHUB_REF" = "refs/heads/master" ] && export PYTEST_SENTRY_ALWAYS_REPORT=1
- make run-acceptance
- env:
- PYTEST_SNAPSHOTS_DIR: ${{ steps.config.outputs.acceptance-dir }}
- USE_SNUBA: 1
- TEST_GROUP: ${{ matrix.instance }}
- - name: Save snapshots
- if: always()
- uses: getsentry/action-visual-snapshot@v2
- with:
- save-only: true
- snapshot-path: .artifacts/visual-snapshots
- visual-diff:
- if: ${{ github.ref != 'refs/heads/master' }}
- needs: [acceptance, jest]
- runs-on: ubuntu-16.04
- steps:
- - name: Diff snapshots
- id: visual-snapshots-diff
- uses: getsentry/action-visual-snapshot@v2
- with:
- api-token: ${{ secrets.VISUAL_SNAPSHOT_SECRET }}
- github-token: ${{ secrets.GITHUB_TOKEN }}
- gcs-bucket: 'sentry-visual-snapshots'
- gcp-service-account-key: ${{ secrets.SNAPSHOT_GOOGLE_SERVICE_ACCOUNT_KEY }}
|