From 67bbe0ac173a3db42e18ca53b2213a786f6a91af Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 13 Aug 2026 13:14:24 -0700 Subject: [PATCH] ci: speed up backend CI with astral-sh/setup-uv and apt package caching (#42498) Co-authored-by: Claude Opus 4.8 --- .github/actions/setup-backend/action.yml | 28 ++++++++++++++------- .github/workflows/bump-python-package.yml | 5 +++- .github/workflows/superset-docs-deploy.yml | 6 ++++- .github/workflows/superset-translations.yml | 5 +++- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/actions/setup-backend/action.yml b/.github/actions/setup-backend/action.yml index c1134f7c74a..c7bff2e3c1f 100644 --- a/.github/actions/setup-backend/action.yml +++ b/.github/actions/setup-backend/action.yml @@ -5,10 +5,6 @@ inputs: description: 'Python version to set up. Accepts a version number, "current", or "next".' required: true default: 'current' - cache: - description: 'Cache dependencies. Options: pip' - required: false - default: 'pip' requirements-type: description: 'Type of requirements to install. Options: base, development, default' required: false @@ -43,17 +39,31 @@ runs: uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ steps.set-python-version.outputs.python-version }} - cache: ${{ inputs.cache }} + - name: Install uv + if: inputs.install-superset == 'true' + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 + with: + python-version: ${{ steps.set-python-version.outputs.python-version }} + enable-cache: true + - name: Update apt package lists + # cache-apt-pkgs-action assumes a fresh `apt-cache` index (true on GitHub-hosted + # runners, not on all self-hosted/custom runner images), so refresh it explicitly + # or package lookups silently resolve to an empty list. + if: inputs.install-superset == 'true' + shell: bash + run: sudo apt-get update + - name: Install apt packages + if: inputs.install-superset == 'true' + uses: awalsh128/cache-apt-pkgs-action@553a35bb8ebd9fcabcb1c9451aa4c98e1b4ca8a9 # v1.6.3 + with: + packages: libldap2-dev libsasl2-dev + version: 1.0 - name: Install dependencies env: INPUT_INSTALL_SUPERSET: ${{ inputs.install-superset }} INPUT_REQUIREMENTS_TYPE: ${{ inputs.requirements-type }} run: | if [ "$INPUT_INSTALL_SUPERSET" = "true" ]; then - sudo apt-get update && sudo apt-get -y install libldap2-dev libsasl2-dev - - pip install --upgrade pip setuptools wheel uv - if [ "$INPUT_REQUIREMENTS_TYPE" = "dev" ]; then uv pip install --system -r requirements/development.txt elif [ "$INPUT_REQUIREMENTS_TYPE" = "base" ]; then diff --git a/.github/workflows/bump-python-package.yml b/.github/workflows/bump-python-package.yml index 70681804dd6..d500461b48b 100644 --- a/.github/workflows/bump-python-package.yml +++ b/.github/workflows/bump-python-package.yml @@ -45,7 +45,10 @@ jobs: python-version: "3.11" - name: Install uv - run: pip install uv + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 + with: + python-version: "3.11" + enable-cache: true - name: supersetbot bump-python -p "${{ github.event.inputs.package }}" env: diff --git a/.github/workflows/superset-docs-deploy.yml b/.github/workflows/superset-docs-deploy.yml index db1fafa5079..b4e2e2bf07c 100644 --- a/.github/workflows/superset-docs-deploy.yml +++ b/.github/workflows/superset-docs-deploy.yml @@ -81,7 +81,11 @@ jobs: distribution: "zulu" java-version: "21" - name: Install Graphviz - run: sudo apt-get install -y graphviz + uses: awalsh128/cache-apt-pkgs-action@553a35bb8ebd9fcabcb1c9451aa4c98e1b4ca8a9 # v1.6.3 + with: + packages: graphviz + version: 1.0 + execute_install_scripts: true - name: Compute Entity Relationship diagram (ERD) env: SUPERSET_SECRET_KEY: not-a-secret diff --git a/.github/workflows/superset-translations.yml b/.github/workflows/superset-translations.yml index f35dd6d2726..886c2f46d2c 100644 --- a/.github/workflows/superset-translations.yml +++ b/.github/workflows/superset-translations.yml @@ -78,7 +78,10 @@ jobs: - name: Install gettext tools if: steps.check.outputs.python == 'true' || steps.check.outputs.frontend == 'true' - run: sudo apt-get update && sudo apt-get install -y gettext + uses: awalsh128/cache-apt-pkgs-action@553a35bb8ebd9fcabcb1c9451aa4c98e1b4ca8a9 # v1.6.3 + with: + packages: gettext + version: 1.0 # Fetch the base ref so we can compare PR-introduced regressions # against a fair baseline (also runs babel_update against the base