123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- name: python
- on:
- push:
- branches:
- - master
- - releases/**
- pull_request:
- paths:
- # Matches all python files regardless of directory depth.
- - '**.py'
- - requirements*.txt
- jobs:
- check-missing-migration:
- # Not necessary for this job to run on the push branches.
- if: ${{ github.ref != 'refs/heads/master' || contains(github.ref, 'releases/') }}
- name: Check Migration Required
- runs-on: ubuntu-16.04
- env:
- PIP_DISABLE_PIP_VERSION_CHECK: on
- SENTRY_LIGHT_BUILD: 1
- SENTRY_SKIP_BACKEND_VALIDATION: 1
- MIGRATIONS_TEST_MIGRATE: 0
- # The hostname used to communicate with the PostgreSQL from sentry
- DATABASE_URL: postgresql://postgres:postgres@localhost/sentry
- services:
- postgres:
- image: postgres:9.6
- env:
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: postgres
- ports:
- # Maps tcp port 5432 on service container to the host
- - 5432:5432
- # needed because the postgres container does not provide a healthcheck
- options: >-
- --health-cmd pg_isready
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
- steps:
- - name: Install System Dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends \
- libxmlsec1-dev \
- libmaxminddb-dev
- - uses: actions/checkout@v2
- - name: Set up outputs
- id: config
- env:
- MATRIX_INSTANCE: ${{ matrix.instance }}
- run: |
- echo "::set-output name=python-version::2.7.17"
- - name: Set up Python ${{ steps.config.outputs.python-version }}
- uses: actions/setup-python@v2
- with:
- python-version: ${{ steps.config.outputs.python-version}}
- - name: Setup pip
- uses: ./.github/actions/setup-pip
- id: pip
- - name: pip cache
- uses: actions/cache@v2
- with:
- path: ${{ steps.pip.outputs.pip-cache-dir }}
- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-
- - 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]"
- psql -c 'create database sentry;' -h localhost -U postgres
- sentry init
- - name: Check if a migration is required
- env:
- SENTRY_LOG_LEVEL: ERROR
- PGPASSWORD: postgres
- run: |
- # Below will exit with non-zero status if model changes are missing migrations
- sentry django makemigrations -n ci_test --check --dry-run --no-input || (echo '::error::Error: Migration required -- to generate a migration, run `sentry django makemigrations -n <some_name>`' && exit 1)
- test-py3:
- name: 'python3.6 backend'
- runs-on: ubuntu-16.04
- timeout-minutes: 30
- strategy:
- matrix:
- instance: [0, 1, 2]
- env:
- MIGRATIONS_TEST_MIGRATE: 1
- steps:
- - uses: actions/checkout@v2
- - uses: volta-cli/action@v1
- - name: Set python version output
- id: python-version
- run: |
- echo "::set-output name=python-version::$(awk 'FNR == 2' .python-version)"
- # Until GH composite actions can use `uses`, we need to setup python here
- - uses: actions/setup-python@v2
- with:
- python-version: ${{ steps.python-version.outputs.python-version }}
- - name: Setup pip
- uses: ./.github/actions/setup-pip
- id: pip
- - name: pip cache
- uses: actions/cache@v2
- with:
- path: ${{ steps.pip.outputs.pip-cache-dir }}
- key: ${{ runner.os }}-pip-py${{ steps.python-version.outputs.python-version }}-${{ hashFiles('**/requirements-*.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-py${{ steps.python-version.outputs.python-version }}
- - name: Setup sentry env
- uses: ./.github/actions/setup-sentry
- id: setup
- with:
- python: 3
- - name: Python 3.6 backend (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
- if: always()
- run: |
- make travis-test-postgres
- test-py3-snuba:
- name: '[ignore fails] python3.6 backend (snuba)'
- runs-on: ubuntu-16.04
- continue-on-error: true
- timeout-minutes: 30
- strategy:
- matrix:
- instance: [0]
- env:
- # Note: `USE_SNUBA` is only used for the Snuba test suite because we have some failing acceptance tests with Snuba enabled.
- USE_SNUBA: 1
- MIGRATIONS_TEST_MIGRATE: 1
- steps:
- - uses: actions/checkout@v2
- - uses: volta-cli/action@v1
- - name: Set python version output
- id: python-version
- run: |
- echo "::set-output name=python-version::$(awk 'FNR == 2' .python-version)"
- # Until GH composite actions can use `uses`, we need to setup python here
- - uses: actions/setup-python@v2
- with:
- python-version: ${{ steps.python-version.outputs.python-version }}
- - name: Setup pip
- uses: ./.github/actions/setup-pip
- id: pip
- - name: pip cache
- uses: actions/cache@v2
- with:
- path: ${{ steps.pip.outputs.pip-cache-dir }}
- key: ${{ runner.os }}-pip-py${{ steps.python-version.outputs.python-version }}-${{ hashFiles('**/requirements-*.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-py${{ steps.python-version.outputs.python-version }}
- - name: Setup sentry env
- uses: ./.github/actions/setup-sentry
- id: setup
- with:
- python: 3
- kafka: true
- - name: Python 3.6 snuba backend (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
- if: always()
- run: |
- make travis-test-snuba
|