123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- name: acceptance
- on:
- push:
- branches:
- - master
- pull_request:
- jobs:
- jest:
- runs-on: ubuntu-latest
- env:
- VISUAL_SNAPSHOT_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 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
- # Use this to override the django version in the requirements file.
- DJANGO_VERSION: ">=1.11,<1.12"
- # 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:
- # 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))"
- # 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 System Dependencies
- run: |
- sudo apt-get update
- sudo apt-get install libxmlsec1-dev libmaxminddb-dev
- - 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 .artifacts/visual-snapshots/acceptance
- mkdir -p .artifacts/visual-snapshots/acceptance-mobile
- make run-acceptance
- env:
- 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 }}
|