Browse Source

build(gha): Refactor to use composite actions for workflows (#21203)

This refactors our actions to use a [composite run step](https://github.blog/changelog/2020-08-07-github-actions-composite-run-steps/) for setting up the python test environment for Sentry. This should remove a bunch of boilerplate from our workflows.

Currently only updates acceptance and python workflows, will update others after this is merged.
Billy Vong 4 years ago
parent
commit
dd0f68e84e
3 changed files with 220 additions and 307 deletions
  1. 148 0
      .github/actions/setup-sentry/action.yml
  2. 40 164
      .github/workflows/acceptance.yml
  3. 32 143
      .github/workflows/python.yml

+ 148 - 0
.github/actions/setup-sentry/action.yml

@@ -0,0 +1,148 @@
+name: 'Sentry Setup'
+description: 'Sets up a Sentry test environment'
+inputs:
+  python:
+    description: 'python version (2 or 3)'
+    required: false
+    default: '3'
+  snuba:
+    description: 'Is snuba required?'
+    required: false
+    default: 'true'
+  kafka:
+    description: 'Is kafka required?'
+    required: false
+    default: 'false'
+
+outputs:
+  yarn-cache-dir:
+    description: "Path to yarn cache"
+    value: ${{ steps.config.outputs.yarn-cache-dir }}
+  pip-cache-dir:
+    description: "Path to pip cache"
+    value: ${{ steps.pip-cache.outputs.pip-cache }}
+  acceptance-dir:
+    description: "Path to acceptance visual snapshot artifacts"
+    value: ${{ steps.config.outputs.acceptance-dir }}
+  matrix-instance-number:
+    description: "The matrix instance number (starting at 1)"
+    value: ${{ steps.config.outputs.matrix-instance-number }}
+
+runs:
+  using: "composite"
+  steps:
+    - name: Setup default environment variables
+      shell: bash
+      env:
+        PYTHON_VERSION: ${{ inputs.python }}
+        NEED_KAFKA: ${{ inputs.kafka }}
+        MATRIX_INSTANCE: ${{ matrix.instance }}
+        MATRIX_INSTANCE_TOTAL: ${{ strategy.job-total }}
+      run: |
+        echo "PIP_DISABLE_PIP_VERSION_CHECK=on" >> $GITHUB_ENV
+        echo "MIGRATIONS_TEST_MIGRATE=0" >> $GITHUB_ENV
+        echo "SENTRY_LIGHT_BUILD=1" >> $GITHUB_ENV
+        echo "SENTRY_SKIP_BACKEND_VALIDATION=1" >> $GITHUB_ENV
+
+        [ "$PYTHON_VERSION" = "3" ] && echo "SENTRY_PYTHON3=1" >> $GITHUB_ENV || true
+
+        ### node configuration ###
+        echo "NODE_ENV=development" >> $GITHUB_ENV
+        echo "NODE_OPTIONS=--max-old-space-size=4096" >> $GITHUB_ENV
+
+        ### pytest-sentry configuration ###
+        echo "PYTEST_SENTRY_DSN=https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079" >> $GITHUB_ENV
+        echo "PYTEST_ADDOPTS=--reruns 5" >> $GITHUB_ENV
+        # this handles pytest test sharding
+        if [ "$MATRIX_INSTANCE" ]; then
+          echo "TEST_GROUP=$MATRIX_INSTANCE" >> $GITHUB_ENV
+          echo "TOTAL_TEST_GROUPS=$MATRIX_INSTANCE_TOTAL" >> $GITHUB_ENV
+        fi
+        # This records failures on master to sentry in order to detect flakey tests, as it's
+        # expected that people have failing tests on their PRs
+        [ "$GITHUB_REF" = "refs/heads/master" ] && echo "PYTEST_SENTRY_ALWAYS_REPORT=1" >> $GITHUB_ENV || true
+
+        ### services configuration ###
+        # Note: some backend tests (e.g. tests/sentry/eventstream/kafka/test_consumer.py) will behave
+        # differently if these are set.
+        if [ "$NEED_KAFKA" = "true" ]; then
+          echo "SENTRY_KAFKA_HOSTS=127.0.0.1:9092" >> $GITHUB_ENV
+          echo "SENTRY_ZOOKEEPER_HOSTS=127.0.0.1:2181" >> $GITHUB_ENV
+        fi
+
+    # Setup custom pytest matcher, see https://github.com/actions/setup-node/issues/97
+    - name: Add pytest log matcher
+      shell: bash
+      run: |
+        echo "::remove-matcher owner=pytest::"
+        echo "::add-matcher::.github/pytest.json"
+
+    - name: Install system dependencies
+      shell: bash
+      run: |
+        sudo apt-get update
+        sudo apt-get install -y --no-install-recommends \
+          libxmlsec1-dev \
+          libmaxminddb-dev
+
+    - name: Set up outputs
+      id: config
+      env:
+        MATRIX_INSTANCE: ${{ matrix.instance }}
+      shell: bash
+      run: |
+        echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
+        echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
+        echo "::set-output name=acceptance-dir::.artifacts/visual-snapshots/acceptance"
+
+    - name: Install pip
+      shell: bash
+      run: |
+        pip install --no-cache-dir --upgrade "pip>=20.0.2"
+
+    - name: Get pip cache dir
+      id: pip-cache
+      shell: bash
+      run: |
+        echo "::set-output name=pip-cache::$(pip cache dir)"
+
+    - name: Install python dependencies
+      shell: bash
+      run: |
+        python setup.py install_egg_info
+        pip install wheel # GitHub Actions does not have `wheel` installed by default (unlike Travis)
+        pip install -U -e ".[dev]"
+
+    - name: Start devservices
+      shell: bash
+      env:
+        NEED_KAFKA: ${{ inputs.kafka }}
+        NEED_SNUBA: ${{ inputs.snuba }}
+      run: |
+        sentry init
+
+        # TODO: Use devservices kafka. See https://github.com/getsentry/sentry/pull/20986#issuecomment-704510570
+        if [ "$NEED_KAFKA" = "true" ]; then
+          docker run \
+            --name sentry_zookeeper \
+            -d --network host \
+            -e ZOOKEEPER_CLIENT_PORT=2181 \
+            confluentinc/cp-zookeeper:4.1.0
+
+          docker run \
+            --name sentry_kafka \
+            -d --network host \
+            -e KAFKA_ZOOKEEPER_CONNECT=127.0.0.1:2181 \
+            -e KAFKA_LISTENERS=INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9092 \
+            -e KAFKA_ADVERTISED_LISTENERS=INTERNAL://127.0.0.1:9093,EXTERNAL://127.0.0.1:9092 \
+            -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT \
+            -e KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL \
+            -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
+            confluentinc/cp-kafka:5.1.2
+        fi
+
+        if [ "$NEED_SNUBA" = "true" ]; then
+          sentry devservices up postgres redis clickhouse snuba
+        fi
+
+        docker ps -a

+ 40 - 164
.github/workflows/acceptance.yml

@@ -51,7 +51,7 @@ jobs:
               })
 
     jest:
-      runs-on: ubuntu-latest
+      runs-on: ubuntu-16.04
       env:
         VISUAL_HTML_ENABLE: 1
       steps:
@@ -107,79 +107,36 @@ jobs:
           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_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
-
         - uses: actions/checkout@v2
 
         - uses: volta-cli/action@v1
 
-        - 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.17"
-            echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
-            echo "::set-output name=acceptance-dir::.artifacts/visual-snapshots/acceptance"
+        # Until GH composite actions can use `uses`, we need to setup python here
+        - uses: actions/setup-python@v2
+          with:
+            python-version: 2.7.17
+
+        - name: Setup sentry env
+          uses: ./.github/actions/setup-sentry
+          id: setup
+          with:
+            python: 2
 
         - 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 }}
+            path: ${{ steps.setup.outputs.yarn-cache-dir }}
             key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
             restore-keys: |
               ${{ runner.os }}-yarn-
 
-        - name: Set up Python ${{ steps.config.outputs.python-version }}
-          uses: actions/setup-python@v2
-          with:
-            python-version: ${{ steps.config.outputs.python-version}}
-
-        - name: Install pip
-          run: |
-            pip install --no-cache-dir --upgrade "pip>=20.0.2"
-
-        - 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 }}
+            path: ${{ steps.setup.outputs.pip-cache-dir }}
             key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
             restore-keys: |
               ${{ runner.os }}-pip-
@@ -188,42 +145,20 @@ jobs:
           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
+        - name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
           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
+            mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
+            mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-mobile
+            mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-tooltips
             make run-acceptance
           env:
-            PYTEST_SNAPSHOTS_DIR: ${{ steps.config.outputs.acceptance-dir }}
+            PYTEST_SNAPSHOTS_DIR: ${{ steps.setup.outputs.acceptance-dir }}
             USE_SNUBA: 1
-            TEST_GROUP: ${{ matrix.instance }}
 
         - name: Save snapshots
           if: always()
@@ -240,80 +175,43 @@ jobs:
           instance: [0, 1, 2]
 
       env:
-        SENTRY_PYTHON3: 1
-        PIP_DISABLE_PIP_VERSION_CHECK: on
-        # PIP_QUIET: 1
-
-        SENTRY_LIGHT_BUILD: 1
-        SENTRY_SKIP_BACKEND_VALIDATION: 1
         MIGRATIONS_TEST_MIGRATE: 1
-
-        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
-
         - uses: actions/checkout@v2
 
         - uses: volta-cli/action@v1
 
-        - name: Set up outputs
-          id: config
-          env:
-            MATRIX_INSTANCE: ${{ matrix.instance }}
+        - name: Set python version output
+          id: python-version
           run: |
-            echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
             echo "::set-output name=python-version::$(awk 'FNR == 2' .python-version)"
-            echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
-            echo "::set-output name=acceptance-dir::.artifacts/visual-snapshots/acceptance"
 
-        - uses: actions/cache@v1
+        # 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 sentry python env
+          uses: ./.github/actions/setup-sentry
+          id: setup
+          with:
+            python: 3
+
+        - name: 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 }}
+            path: ${{ steps.setup.outputs.yarn-cache-dir }}
             key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
             restore-keys: |
               ${{ runner.os }}-yarn-
 
-        - name: Set up Python ${{ steps.config.outputs.python-version }}
-          uses: actions/setup-python@v2
-          with:
-            python-version: ${{ steps.config.outputs.python-version}}
-
-        - name: Install pip
-          run: |
-            pip install --no-cache-dir --upgrade "pip>=20.0.2"
-
-        - 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 }}
+            path: ${{ steps.setup.outputs.pip-cache-dir }}
             key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
             restore-keys: |
               ${{ runner.os }}-pip-
@@ -322,42 +220,20 @@ jobs:
           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 }})
+        - name: Run acceptance tests (#${{ steps.setup.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
+            mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
+            mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-mobile
+            mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-tooltips
             make run-acceptance
           env:
-            PYTEST_SNAPSHOTS_DIR: ${{ steps.config.outputs.acceptance-dir }}
+            PYTEST_SNAPSHOTS_DIR: ${{ steps.setup.outputs.acceptance-dir }}
             USE_SNUBA: 1
-            TEST_GROUP: ${{ matrix.instance }}
 
         # TODO(joshuarli): SENTRY_PYTHON3=1, snapshots, visual-diff needs py3-acceptance.
 

+ 32 - 143
.github/workflows/python.yml

@@ -102,198 +102,87 @@ jobs:
   test-py3:
     name: 'python3.6 backend'
     runs-on: ubuntu-16.04
+    timeout-minutes: 30
     strategy:
       matrix:
         instance: [0, 1, 2]
 
     env:
-      SENTRY_PYTHON3: 1
-      PIP_DISABLE_PIP_VERSION_CHECK: on
-
-      SENTRY_LIGHT_BUILD: 1
-      SENTRY_SKIP_BACKEND_VALIDATION: 1
       MIGRATIONS_TEST_MIGRATE: 1
-      PYTEST_SENTRY_DSN: https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
-      PYTEST_ADDOPTS: "--reruns 3"
-      PYTEST_SENTRY_ALWAYS_REPORT: 1
-
-      # services configuration
-      SENTRY_REDIS_HOST: redis
-      DATABASE_URL: postgresql://postgres:postgres@localhost/sentry
-
-      # Number of matrix instances
-      TOTAL_TEST_GROUPS: ${{ strategy.job-total }}
 
     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 }}
+      - 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)"
-          echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
 
-      - name: Set up Python ${{ steps.config.outputs.python-version }}
-        uses: actions/setup-python@v2
-        with:
-          python-version: ${{ steps.config.outputs.python-version}}
 
-      - name: Install pip
-        run: |
-          pip install --no-cache-dir --upgrade "pip>=20.0.2"
+      # 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: Get pip cache dir
-        id: pip-cache
-        run: |
-          echo "::set-output name=dir::$(pip cache dir)"
+      - name: Setup sentry env
+        uses: ./.github/actions/setup-sentry
+        id: setup
+        with:
+          python: 3
 
       - name: pip cache
         uses: actions/cache@v1
         with:
-          path: ${{ steps.pip-cache.outputs.dir }}
+          path: ${{ steps.setup.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]"
-          # XXX: wasn't able to get this working in requirements_base.
-          # It's possible if you're installing via -r but it breaks -e.
-          pip uninstall -y rb
-          pip install -e git+https://github.com/getsentry/rb.git@master#egg=rb
-
-      - name: Start devservices
-        run: |
-          sentry init
-          sentry devservices up postgres redis clickhouse snuba
-
-      - name: Python 3.6 backend (${{ steps.config.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
+      - name: Python 3.6 backend (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
         if: always()
         run: |
           make travis-test-postgres
-        env:
-          TEST_GROUP: ${{ matrix.instance }}
 
   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:
-      SENTRY_PYTHON3: 1
-      PIP_DISABLE_PIP_VERSION_CHECK: on
-
+      # Note: `USE_SNUBA` is only used for the Snuba test suite because we have some failing acceptance tests with Snuba enabled.
       USE_SNUBA: 1
-      SENTRY_LIGHT_BUILD: 1
-      SENTRY_SKIP_BACKEND_VALIDATION: 1
       MIGRATIONS_TEST_MIGRATE: 1
 
-      PYTEST_SENTRY_DSN: https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
-      PYTEST_ADDOPTS: "--reruns 3"
-      PYTEST_SENTRY_ALWAYS_REPORT: yes
-
-      # services configuration
-      SENTRY_REDIS_HOST: redis
-      DATABASE_URL: postgresql://postgres:postgres@localhost/sentry
-      SENTRY_KAFKA_HOSTS: localhost:9092
-      SENTRY_ZOOKEEPER_HOSTS: localhost:2181
-
-      # Number of matrix instances
-      TOTAL_TEST_GROUPS: ${{ strategy.job-total }}
-
     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::$(awk 'FNR == 2' .python-version)"
-          echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
+      - uses: volta-cli/action@v1
 
-      - name: Set up Python ${{ steps.config.outputs.python-version }}
-        uses: actions/setup-python@v2
-        with:
-          python-version: ${{ steps.config.outputs.python-version}}
-
-      - name: Install pip
+      - name: Set python version output
+        id: python-version
         run: |
-          pip install --no-cache-dir --upgrade "pip>=20.0.2"
+          echo "::set-output name=python-version::$(awk 'FNR == 2' .python-version)"
 
-      - name: Get pip cache dir
-        id: pip-cache
-        run: |
-          echo "::set-output name=dir::$(pip cache dir)"
 
-      - name: pip cache
-        uses: actions/cache@v1
+      # Until GH composite actions can use `uses`, we need to setup python here
+      - uses: actions/setup-python@v2
         with:
-          path: ${{ steps.pip-cache.outputs.dir }}
-          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
-          restore-keys: |
-            ${{ runner.os }}-pip-
+          python-version: ${{ steps.python-version.outputs.python-version }}
 
-      - 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]"
-          # XXX: wasn't able to get this working in requirements_base.
-          # It's possible if you're installing via -r but it breaks -e.
-          pip uninstall -y rb
-          pip install -e git+https://github.com/getsentry/rb.git@master#egg=rb
+      - name: Setup sentry env
+        uses: ./.github/actions/setup-sentry
+        id: setup
+        with:
+          python: 3
+          kafka: true
 
-      - name: Start devservices
-        run: |
-          sentry init
-          docker run \
-            --name sentry_zookeeper \
-            -d --network host \
-            -e ZOOKEEPER_CLIENT_PORT=2181 \
-            confluentinc/cp-zookeeper:4.1.0
-
-          docker run \
-            --name sentry_kafka \
-            -d --network host \
-            -e KAFKA_ZOOKEEPER_CONNECT=127.0.0.1:2181 \
-            -e KAFKA_LISTENERS=INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9092 \
-            -e KAFKA_ADVERTISED_LISTENERS=INTERNAL://127.0.0.1:9093,EXTERNAL://127.0.0.1:9092 \
-            -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT \
-            -e KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL \
-            -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
-            confluentinc/cp-kafka:5.1.2
-          sentry devservices up postgres redis clickhouse snuba
-
-      - name: Python 3.6 snuba backend (${{ steps.config.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
+      - name: Python 3.6 snuba backend (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
         if: always()
         run: |
           make travis-test-snuba
-        env:
-          TEST_GROUP: ${{ matrix.instance }}