Browse Source

ref: use actions/setup-python directly (sentry) (#36687)

anthony sottile 2 years ago
parent
commit
4ed843548a

+ 0 - 73
.github/actions/setup-python/action.yml

@@ -1,73 +0,0 @@
-# NOTE: Do not rely on `make` commands here as this action is used across different repos
-# where the Makefile will not be available
-name: 'python setup'
-description: 'Configures python, pip, and configures pip cache dir as output.'
-
-inputs:
-  workdir:
-    description: 'Directory where the sentry source is located'
-    required: false
-    default: '.'
-  cache-files-hash:
-    description: 'A single hash for a set of files. Used for caching.'
-    required: false
-    default: ${{ hashFiles('requirements-*.txt') }}
-  pip-cache-version:
-    description: 'pip cache version in order to bust cache'
-    required: false
-  python-version:
-    description: 'python version to install'
-    required: false
-
-outputs:
-  python-version:
-    description: 'The version of python we are using'
-    value: ${{ steps.python-version.outputs.python-version }}
-  pip-cache-dir:
-    description: 'Path to pip cache'
-    value: ${{ steps.pip-info.outputs.pip-cache-dir }}
-  pip-version:
-    description: 'Pip version'
-    value: ${{ steps.pip-info.outputs.pip-version }}
-
-runs:
-  using: 'composite'
-  steps:
-    - name: Set python version output
-      id: python-version
-      shell: bash
-      run: |
-        if [ "${{ inputs.python-version }}" == "" ]; then
-          echo "::set-output name=python-version::$(cat .python-version)"
-        else
-          echo "::set-output name=python-version::${{ inputs.python-version }}"
-        fi
-
-    - name: Setup default environment variables
-      shell: bash
-      run: |
-        echo "PIP_DISABLE_PIP_VERSION_CHECK=on" >> $GITHUB_ENV
-
-    - uses: actions/setup-python@v2
-      env:
-        PIP_DISABLE_PIP_VERSION_CHECK: on
-      with:
-        python-version: ${{ steps.python-version.outputs.python-version }}
-
-    - name: Get pip cache dir & version
-      id: pip-info
-      shell: bash
-      env:
-        WORKDIR: ${{ inputs.workdir }}
-      # pip versions before 20.1 do not have `pip cache`, `make upgrade-pip` ensures that version as a minimum
-      run: |
-        source "$WORKDIR/scripts/lib.sh" && upgrade-pip
-        echo "::set-output name=pip-cache-dir::$(pip cache dir)"
-        echo "::set-output name=pip-version::$(pip -V | awk -F ' ' '{print $2}')"
-
-    - name: pip cache
-      uses: actions/cache@v3
-      with:
-        path: ${{ steps.pip-info.outputs.pip-cache-dir }}
-        key: |
-          ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip-info.outputs.pip-version }}-${{ inputs.pip-cache-version }}-${{ inputs.cache-files-hash }}

+ 3 - 22
.github/actions/setup-sentry/action.yml

@@ -27,17 +27,9 @@ inputs:
     description: 'Is bigtable required?'
     required: false
     default: 'false'
-  cache-files-hash:
-    description: 'A single hash for a set of files. Used for caching.'
-    required: false
-    default: ${{ hashFiles('requirements-dev-frozen.txt') }}
   python-version:
     description: 'python version to install'
     required: false
-  pip-cache-version:
-    description: 'pip cache version in order to bust cache'
-    required: false
-    default: '1630355466247'
   pg-version:
     description: 'PostgreSQL version to use'
     default: '9.6'
@@ -47,15 +39,6 @@ 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.setup-python.outputs.pip-cache-dir }}
-  pip-version:
-    description: 'pip version'
-    value: ${{ steps.setup-python.outputs.pip-version }}
-  python-version:
-    description: 'python version'
-    value: ${{ steps.setup-python.outputs.python-version }}
   acceptance-dir:
     description: 'Path to acceptance visual snapshot artifacts'
     value: ${{ steps.config.outputs.acceptance-dir }}
@@ -116,13 +99,11 @@ runs:
         [ "$GITHUB_REF" = "refs/heads/master" ] && echo "PYTEST_SENTRY_ALWAYS_REPORT=1" >> $GITHUB_ENV || true
 
     - name: Setup python
-      id: setup-python
-      uses: ./.github/actions/setup-python
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ inputs.python-version }}
-        cache-files-hash: ${{ inputs.cache-files-hash }}
-        pip-cache-version: ${{ inputs.pip-cache-version }}
-        workdir: ${{ inputs.workdir }}
+        cache: pip
+        cache-dependency-path: requirements-dev-frozen.txt
 
     - name: Install system dependencies
       shell: bash

+ 0 - 2
.github/workflows/acceptance.yml

@@ -157,7 +157,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
           pg-version: ${{ matrix.pg-version }}
 
@@ -213,7 +212,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           chartcuterie: true
 
       - name: yarn cache

+ 6 - 13
.github/workflows/backend.yml

@@ -47,7 +47,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
 
       - name: Run API docs tests
@@ -90,7 +89,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
           # Right now, we run so few bigtable related tests that the
           # overhead of running bigtable in all backend tests
@@ -125,7 +123,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           pg-version: ${{ matrix.pg-version }}
 
       - name: Run test
@@ -186,12 +183,11 @@ jobs:
               - added|modified: '**/*.py'
               - added|modified: 'requirements-*.txt'
 
-      - uses: actions/setup-python@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
-          cache: 'pip'
-          cache-dependency-path: |
-            requirements-dev-only-frozen.txt
+          cache: pip
+          cache-dependency-path: requirements-dev-only-frozen.txt
 
       - uses: actions/cache@v3
         with:
@@ -240,7 +236,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           pg-version: ${{ matrix.pg-version }}
 
       - name: Migration & lockfile checks
@@ -267,7 +262,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
 
       - name: Run test
@@ -295,7 +289,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
           kafka: true
 
@@ -344,7 +337,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
           kafka: true
 
@@ -376,7 +368,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           snuba: true
           kafka: true
 
@@ -412,9 +403,11 @@ jobs:
       - uses: actions/checkout@v2
 
       - name: Setup Python ${{ matrix.python-version }}
-        uses: ./.github/actions/setup-python
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
+          cache: pip
+          cache-dependency-path: requirements-dev-frozen.txt
 
       # We don't call setup-sentry, because we don't need devservices.
       - name: Setup backend typing

+ 6 - 6
.github/workflows/development-environment.yml

@@ -7,7 +7,6 @@ on:
       - '.github/workflows/development-environment.yml'
       - 'requirements-*.txt'
       - '.python-version'
-      - '.github/actions/setup-python'
       - '.envrc'
       - 'Brewfile'
       - 'scripts/*'
@@ -53,11 +52,13 @@ jobs:
 
       # This handles Python's cache
       - name: Setup Python & cache
-        uses: ./.github/actions/setup-python
+        uses: actions/setup-python@v4
         # Remove this block when 3.8.13 becomes available in:
         # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
         with:
           python-version: 3.8.12
+          cache: 'pip'
+          cache-dependency-path: requirements-dev-frozen.txt
 
       # This tests starting up the dev services, loading mocks and pre-commit installation
       # This can take over 15 minutes
@@ -101,12 +102,11 @@ jobs:
     timeout-minutes: 5
     steps:
       - uses: actions/checkout@v3
-      - uses: actions/setup-python@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: 3.8.12
-          cache: 'pip'
-          cache-dependency-path: |
-            requirements-dev-only-frozen.txt
+          cache: pip
+          cache-dependency-path: requirements-dev-only-frozen.txt
       - name: install dependencies
         run: pip install -r requirements-dev-only-frozen.txt
       - name: run tests

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

@@ -58,7 +58,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
           pg-version: ${{ matrix.pg-version }}
 
       - name: Apply migrations

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

@@ -31,7 +31,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
 
       - name: Checkout getsentry/sentry-api-schema
         uses: actions/checkout@v2

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

@@ -39,7 +39,6 @@ jobs:
         id: setup
         with:
           python-version: ${{ matrix.python-version }}
-          pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
 
       - name: Checkout getsentry/sentry-api-schema
         if: steps.changes.outputs.api_docs == 'true'