Browse Source

test(gha): Various Improvements™ (#21098)

josh 4 years ago
parent
commit
dd6ca467d4

+ 7 - 41
.github/workflows/acceptance.yml

@@ -55,10 +55,8 @@ jobs:
       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
@@ -66,7 +64,6 @@ jobs:
           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:
@@ -103,6 +100,7 @@ jobs:
             snapshot-path: .artifacts/visual-snapshots
 
     acceptance:
+      # TODO(joshuarli): Convert to py3 with snapshots. See other TODO as well.
       runs-on: ubuntu-16.04
       strategy:
         matrix:
@@ -116,7 +114,6 @@ jobs:
         SENTRY_SKIP_BACKEND_VALIDATION: 1
         MIGRATIONS_TEST_MIGRATE: 0
 
-        # Node configuration
         NODE_OPTIONS: --max-old-space-size=4096
         NODE_ENV: development
 
@@ -143,32 +140,20 @@ jobs:
               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=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"
 
-        # yarn cache
         - uses: actions/cache@v1
           id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
           with:
@@ -177,18 +162,15 @@ jobs:
             restore-keys: |
               ${{ runner.os }}-yarn-
 
-        # setup python
         - name: Set up Python ${{ steps.config.outputs.python-version }}
-          uses: actions/setup-python@v1
+          uses: actions/setup-python@v2
           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: |
@@ -266,7 +248,6 @@ jobs:
         SENTRY_SKIP_BACKEND_VALIDATION: 1
         MIGRATIONS_TEST_MIGRATE: 1
 
-        # Node configuration
         NODE_OPTIONS: --max-old-space-size=4096
         NODE_ENV: development
 
@@ -293,32 +274,20 @@ jobs:
               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::3.6.12"
+            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"
 
-        # yarn cache
         - uses: actions/cache@v1
           id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
           with:
@@ -327,18 +296,15 @@ jobs:
             restore-keys: |
               ${{ runner.os }}-yarn-
 
-        # setup python
         - name: Set up Python ${{ steps.config.outputs.python-version }}
-          uses: actions/setup-python@v1
+          uses: actions/setup-python@v2
           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: |
@@ -363,8 +329,6 @@ jobs:
             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]"
-            pip uninstall -y rb
-            pip install -e git+https://github.com/getsentry/rb.git@master#egg=rb
 
         - name: Start devservices
           run: |
@@ -395,6 +359,8 @@ jobs:
             USE_SNUBA: 1
             TEST_GROUP: ${{ matrix.instance }}
 
+        # TODO(joshuarli): SENTRY_PYTHON3=1, snapshots, visual-diff needs py3-acceptance.
+
     visual-diff:
       if: ${{ github.ref != 'refs/heads/master' }}
       needs: [acceptance, jest]

+ 0 - 6
.github/workflows/javascript.yml

@@ -43,10 +43,8 @@ jobs:
       if: ${{ github.ref != 'refs/heads/master' }}
       runs-on: ubuntu-16.04
       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
@@ -54,7 +52,6 @@ jobs:
           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:
@@ -83,10 +80,8 @@ jobs:
     webpack:
       runs-on: ubuntu-16.04
       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
@@ -94,7 +89,6 @@ jobs:
           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:

+ 2 - 14
.github/workflows/migrations.yml

@@ -42,7 +42,6 @@ jobs:
               libxmlsec1-dev \
               libmaxminddb-dev
 
-        # Checkout codebase
         - uses: actions/checkout@v1
 
         - name: Get changed migration files
@@ -51,33 +50,22 @@ jobs:
             echo $(git diff --diff-filter=AM --name-only origin/master HEAD)
             echo "::set-output name=modified::$(git diff --diff-filter=AM --name-only origin/master HEAD | grep 'src/sentry/migrations/')"
 
-
-        # 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=python-version::2.7"
+            echo "::set-output name=python-version::2.7.17"
 
-        # setup python
         - name: Set up Python ${{ steps.config.outputs.python-version }}
-          uses: actions/setup-python@v1
+          uses: actions/setup-python@v2
           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: |

+ 0 - 1
.github/workflows/openapi.yml

@@ -29,7 +29,6 @@ jobs:
         path: sentry-api-schema
         token: ${{ steps.getsentry.outputs.token }}
 
-    # Install/setup node
     - uses: volta-cli/action@v1
 
     - name: Build OpenAPI Derefed JSON

+ 11 - 26
.github/workflows/python.yml

@@ -50,35 +50,24 @@ jobs:
             libxmlsec1-dev \
             libmaxminddb-dev
 
-      # Checkout codebase
       - uses: actions/checkout@v2
 
-      # 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=python-version::2.7"
+          echo "::set-output name=python-version::2.7.17"
 
-      # setup python
       - name: Set up Python ${{ steps.config.outputs.python-version }}
-        uses: actions/setup-python@v1
+        uses: actions/setup-python@v2
         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: |
@@ -115,7 +104,7 @@ jobs:
     runs-on: ubuntu-16.04
     strategy:
       matrix:
-        instance: [0, 1, 2, 3]
+        instance: [0, 1, 2]
 
     env:
       SENTRY_PYTHON3: 1
@@ -125,9 +114,8 @@ jobs:
       SENTRY_SKIP_BACKEND_VALIDATION: 1
       MIGRATIONS_TEST_MIGRATE: 1
       PYTEST_SENTRY_DSN: https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
-      # XXX(py3): Reruns are disabled for until all tests are passing.
-      PYTEST_ADDOPTS: ""
-      PYTEST_SENTRY_ALWAYS_REPORT: no
+      PYTEST_ADDOPTS: "--reruns 3"
+      PYTEST_SENTRY_ALWAYS_REPORT: 1
 
       # services configuration
       SENTRY_REDIS_HOST: redis
@@ -151,12 +139,11 @@ jobs:
         env:
           MATRIX_INSTANCE: ${{ matrix.instance }}
         run: |
-          # XXX(py3): Minors that aren't latest seem to not be available.
-          echo "::set-output name=python-version::3.6.12"
+          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@v1
+        uses: actions/setup-python@v2
         with:
           python-version: ${{ steps.config.outputs.python-version}}
 
@@ -219,9 +206,8 @@ jobs:
       MIGRATIONS_TEST_MIGRATE: 1
 
       PYTEST_SENTRY_DSN: https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
-      # XXX(py3): Reruns are disabled for until all tests are passing.
-      PYTEST_ADDOPTS: ""
-      PYTEST_SENTRY_ALWAYS_REPORT: no
+      PYTEST_ADDOPTS: "--reruns 3"
+      PYTEST_SENTRY_ALWAYS_REPORT: yes
 
       # services configuration
       SENTRY_REDIS_HOST: redis
@@ -247,12 +233,11 @@ jobs:
         env:
           MATRIX_INSTANCE: ${{ matrix.instance }}
         run: |
-          # XXX(py3): Minors that aren't latest seem to not be available.
-          echo "::set-output name=python-version::3.6.12"
+          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@v1
+        uses: actions/setup-python@v2
         with:
           python-version: ${{ steps.config.outputs.python-version}}