Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
default_stages: [manual]
default_language_version:
python: python311
minimum_pre_commit_version: '3.2.0'
minimum_prek_version: '0.0.26'
repos:
- repo: https://github.com/eclipse-csi/octopin
rev: 21360742e352e87450f99e180fdfc2cf774a72a3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,33 @@
# under the License.
#
---
name: 'Install pre-commit'
description: 'Installs pre-commit and related packages'
name: 'Install prek'
description: 'Installs prek and related packages'
inputs:
python-version:
description: 'Python version to use'
default: "3.10"
uv-version:
description: 'uv version to use'
default: "0.8.9" # Keep this comment to allow automatic replacement of uv version
pre-commit-version:
description: 'pre-commit version to use'
default: "4.3.0" # Keep this comment to allow automatic replacement of pre-commit version
pre-commit-uv-version:
description: 'pre-commit-uv version to use'
default: "4.1.4" # Keep this comment to allow automatic replacement of pre-commit-uv version
skip-pre-commits:
description: "Skip some pre-commits from installation"
default: "0.8.11" # Keep this comment to allow automatic replacement of uv version
prek-version:
description: 'prek version to use'
default: "0.0.26" # Keep this comment to allow automatic replacement of prek version
skip-prek-hooks:
description: "Skip some prek hooks from installation"
default: ""
runs:
using: "composite"
steps:
- name: Install pre-commit, uv, and pre-commit-uv
- name: Install prek and uv
shell: bash
env:
UV_VERSION: ${{inputs.uv-version}}
PRE_COMMIT_VERSION: ${{inputs.pre-commit-version}}
PRE_COMMIT_UV_VERSION: ${{inputs.pre-commit-uv-version}}
SKIP: ${{ inputs.skip-pre-commits }}
PREK_VERSION: ${{inputs.prek-version}}
SKIP: ${{ inputs.skip-prek-hooks }}
run: |
pip install uv==${UV_VERSION} || true
uv tool install pre-commit==${PRE_COMMIT_VERSION} --with uv==${UV_VERSION} \
--with pre-commit-uv==${PRE_COMMIT_UV_VERSION}
uv tool install prek==${PREK_VERSION} --with uv==${UV_VERSION}
working-directory: ${{ github.workspace }}
# We need to use tar file with archive to restore all the permissions and symlinks
- name: "Delete ~.cache"
Expand All @@ -59,36 +54,36 @@ runs:
rm -rf ~/.cache
echo
shell: bash
- name: "Restore pre-commit cache"
- name: "Restore prek cache"
uses: apache/infrastructure-actions/stash/restore@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
with:
key: cache-pre-commit-v4-${{ inputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
key: cache-prek-v5-${{ inputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
path: /tmp/
id: restore-pre-commit-cache
- name: "Check if pre-commit cache tarball exists"
id: restore-prek-cache
- name: "Check if prek cache tarball exists"
shell: bash
run: |
if [ -f /tmp/cache-pre-commit.tar.gz ]; then
echo "✅ Cache tarball found: /tmp/cache-pre-commit.tar.gz"
if [ -f /tmp/cache-prek.tar.gz ]; then
echo "✅ Cache tarball found: /tmp/cache-prek.tar.gz"
else
echo "❌ Cache tarball missing. Expected /tmp/cache-pre-commit.tar.gz"
echo "❌ Cache tarball missing. Expected /tmp/cache-prek.tar.gz"
exit 1
fi
if: steps.restore-pre-commit-cache.outputs.stash-hit == 'true'
if: steps.restore-prek-cache.outputs.stash-hit == 'true'
- name: "Restore .cache from the tar file"
run: tar -C ~ -xzf /tmp/cache-pre-commit.tar.gz
run: tar -C ~ -xzf /tmp/cache-prek.tar.gz
shell: bash
if: steps.restore-pre-commit-cache.outputs.stash-hit == 'true'
if: steps.restore-prek-cache.outputs.stash-hit == 'true'
- name: "Show restored files"
run: |
echo "Restored files"
du ~/ --max-depth=2
echo
shell: bash
if: steps.restore-pre-commit-cache.outputs.stash-hit == 'true'
- name: Install pre-commit hooks
if: steps.restore-prek-cache.outputs.stash-hit == 'true'
- name: Install prek hooks
shell: bash
run: pre-commit install-hooks || (cat ~/.cache/pre-commit/pre-commit.log && exit 1)
run: prek install-hooks || (cat ~/.cache/prek/prek.log && exit 1)
working-directory: ${{ github.workspace }}
env:
SKIP: ${{ inputs.skip-pre-commits }}
SKIP: ${{ inputs.skip-prek-hooks }}
4 changes: 2 additions & 2 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@ firstPRWelcomeComment: >

Here are some useful points:

- Pay attention to the quality of your code (ruff, mypy and type annotations). Our [pre-commits](
https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-pre-commit-hooks)
- Pay attention to the quality of your code (ruff, mypy and type annotations). Our [prek-hooks](
https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks)
will help you with that.

- In case of a new feature add useful documentation (in docstrings or in `docs/` directory).
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/additional-ci-image-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ on: # yamllint disable-line rule:truthy
description: "Whether to upgrade to newer dependencies (true/false)"
required: true
type: string
skip-pre-commits:
description: "Whether to skip pre-commits (true/false)"
skip-prek-hooks:
description: "Whether to skip prek hooks (true/false)"
required: true
type: string
docker-cache:
Expand Down
74 changes: 37 additions & 37 deletions .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ on: # yamllint disable-line rule:truthy
description: "Whether to run only basic checks (true/false)"
required: true
type: string
skip-pre-commits:
description: "Whether to skip pre-commits (true/false)"
skip-prek-hooks:
description: "Whether to skip prek hooks (true/false)"
required: true
type: string
default-python-version:
Expand Down Expand Up @@ -150,13 +150,13 @@ jobs:
retention-days: '2'
if: steps.restore-eslint-cache-simple-am-ui.outputs.stash-hit != 'true'

install-pre-commit:
install-prek:
timeout-minutes: 5
name: "Install pre-commit for cache"
name: "Install prek for cache"
runs-on: ${{ fromJSON(inputs.runners) }}
env:
PYTHON_MAJOR_MINOR_VERSION: "${{ inputs.default-python-version }}"
SKIP: ${{ inputs.skip-pre-commits }}
SKIP: ${{ inputs.skip-prek-hooks }}
steps:
- name: "Cleanup repo"
shell: bash
Expand All @@ -168,21 +168,21 @@ jobs:
- name: "Install Breeze"
uses: ./.github/actions/breeze
id: breeze
- name: "Install pre-commit"
uses: ./.github/actions/install-pre-commit
id: pre-commit
- name: "Install prek"
uses: ./.github/actions/install-prek
id: prek
with:
python-version: ${{steps.breeze.outputs.host-python-version}}
skip-pre-commits: ${{ inputs.skip-pre-commits }}
skip-prek-hooks: ${{ inputs.skip-prek-hooks }}

# Those checks are run if no image needs to be built for checks. This is for simple changes that
# Do not touch any of the python code or any of the important files that might require building
# The CI Docker image and they can be run entirely using the pre-commit virtual environments on host
# The CI Docker image and they can be run entirely using the prek virtual environments on host
static-checks-basic-checks-only:
timeout-minutes: 30
name: "Static checks: basic checks only"
runs-on: ${{ fromJSON(inputs.runners) }}
needs: install-pre-commit
needs: install-prek
if: inputs.basic-checks-only == 'true'
steps:
- name: "Cleanup repo"
Expand All @@ -197,12 +197,12 @@ jobs:
- name: "Install Breeze"
uses: ./.github/actions/breeze
id: breeze
- name: "Install pre-commit"
uses: ./.github/actions/install-pre-commit
id: pre-commit
- name: "Install prek"
uses: ./.github/actions/install-prek
id: prek
with:
python-version: ${{ steps.breeze.outputs.host-python-version }}
skip-pre-commits: ${{ inputs.skip-pre-commits }}
skip-prek-hooks: ${{ inputs.skip-prek-hooks }}
- name: Fetch incoming commit ${{ github.sha }} with its parent
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand All @@ -211,12 +211,12 @@ jobs:
persist-credentials: false
- name: "Static checks: basic checks only"
run: >
breeze static-checks --show-diff-on-failure --color always --initialize-environment
--skip-image-upgrade-check --commit-ref "${{ github.sha }}"
prek --show-diff-on-failure --color always
--from-ref "${{ github.sha }}" --to-ref "${{ github.sha }}"
env:
VERBOSE: "false"
SKIP_BREEZE_PRE_COMMITS: "true"
SKIP: ${{ inputs.skip-pre-commits }}
SKIP_BREEZE_PREK_HOOKS: "true"
SKIP: ${{ inputs.skip-prek-hooks }}
COLUMNS: "202"

test-git-clone-on-windows:
Expand All @@ -234,7 +234,7 @@ jobs:
timeout-minutes: 45
name: "Upgrade checks"
runs-on: ${{ fromJSON(inputs.runners) }}
needs: install-pre-commit
needs: install-prek
env:
PYTHON_MAJOR_MINOR_VERSION: "${{ inputs.default-python-version }}"
if: inputs.canary-run == 'true'
Expand All @@ -251,28 +251,28 @@ jobs:
- name: "Install Breeze"
uses: ./.github/actions/breeze
id: breeze
- name: "Install pre-commit"
uses: ./.github/actions/install-pre-commit
id: pre-commit
- name: "Install prek"
uses: ./.github/actions/install-prek
id: prek
with:
python-version: ${{steps.breeze.outputs.host-python-version}}
skip-pre-commits: ${{ inputs.skip-pre-commits }}
- name: "Autoupdate all pre-commits"
run: pre-commit autoupdate --freeze
- name: "Autoupdate Lucas-C/pre-commit-hooks to bleeding edge"
run: pre-commit autoupdate --bleeding-edge --freeze --repo https://github.com/Lucas-C/pre-commit-hooks
skip-prek-hooks: ${{ inputs.skip-prek-hooks }}
- name: "Autoupdate all prek hooks"
run: prek autoupdate --freeze
- name: "Autoupdate Lucas-C hooks to bleeding edge"
run: prek autoupdate --bleeding-edge --freeze --repo https://github.com/Lucas-C/pre-commit-hooks
- name: "Check if there are any changes in pre-commit hooks"
run: git diff --exit-code
- name: "Run automated upgrade for black"
run: >
pre-commit run
prek
--all-files --show-diff-on-failure --color always --verbose
--hook-stage manual
update-black-version
if: always()
- name: "Run automated upgrade for chart dependencies"
run: >
pre-commit run
prek
--all-files --show-diff-on-failure --color always --verbose
--hook-stage manual
update-chart-dependencies
Expand All @@ -282,30 +282,30 @@ jobs:
# get notified about it - until it stabilizes in 1.* version
- name: "Run automated upgrade for uv (not failing - just informational)"
run: >
pre-commit run
prek
--all-files --show-diff-on-failure --color always --verbose
--hook-stage manual update-installers-and-pre-commit || true
--hook-stage manual upgrade-important-versions || true
if: always()
env:
UPGRADE_UV: "true"
UPGRADE_PYTHON: "false"
UPGRADE_GOLANG: "true"
UPGRADE_PIP: "false"
UPGRADE_PRE_COMMIT: "false"
UPGRADE_PREK: "false"
UPGRADE_NODE_LTS: "false"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Run automated upgrade for pip, pre-commit and node (failing if needed)"
- name: "Run automated upgrade for important versions minus uv(failing if needed)"
run: >
pre-commit run
prek
--all-files --show-diff-on-failure --color always --verbose
--hook-stage manual update-installers-and-pre-commit
--hook-stage manual upgrade-important-versions
if: always()
env:
UPGRADE_UV: "false"
UPGRADE_PYTHON: "true"
UPGRADE_GOLANG: "false"
UPGRADE_PIP: "true"
UPGRADE_PRE_COMMIT: "true"
UPGRADE_PREK: "true"
UPGRADE_NODE_LTS: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
28 changes: 13 additions & 15 deletions .github/workflows/ci-amd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
arm-runners: ${{ steps.selective-checks.outputs.arm-runners }}
selected-providers-list-as-string: >-
${{ steps.selective-checks.outputs.selected-providers-list-as-string }}
skip-pre-commits: ${{ steps.selective-checks.outputs.skip-pre-commits }}
skip-prek-hooks: ${{ steps.selective-checks.outputs.skip-prek-hooks }}
skip-providers-tests: ${{ steps.selective-checks.outputs.skip-providers-tests }}
source-head-repo: ${{ steps.source-run-info.outputs.head-repo }}
source-head-ref: ${{ steps.source-run-info.outputs.head-ref }}
Expand Down Expand Up @@ -168,33 +168,31 @@ jobs:
PR_LABELS: ${{ steps.source-run-info.outputs.pr-labels }}
GITHUB_CONTEXT: ${{ toJson(github) }}

run-pin-versions-pre-commit:
name: "Run pin-versions pre-commit"
run-pin-versions-prek:
name: "Run pin-versions prek"
needs: [build-info]
runs-on: ${{ fromJSON(needs.build-info.outputs.amd-runners) }}
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: "Install Python 3.11 as 3.11+ is needed by pin-versions pre-commit"
- name: "Install Python 3.11 as 3.11+ is needed by pin-versions"
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: 3.11
cache: "pip"
- name: Install pre-commit, uv, and pre-commit-uv
- name: Install prek, uv
shell: bash
env:
UV_VERSION: "0.8.9" # Keep this comment to allow automatic replacement of uv version
PRE_COMMIT_VERSION: "4.3.0" # Keep this comment to allow automatic replacement of pre-commit version
PRE_COMMIT_UV_VERSION: "4.1.4" # Keep this comment to allow automatic replacement of pre-commit-uv version
UV_VERSION: "0.8.11" # Keep this comment to allow automatic replacement of uv version
PREK_VERSION: "0.0.26" # Keep this comment to allow automatic replacement of prek version
run: |
pip install uv==${UV_VERSION} || true
uv tool install pre-commit==${PRE_COMMIT_VERSION} --with uv==${UV_VERSION} \
--with pre-commit-uv==${PRE_COMMIT_UV_VERSION}
- name: "Run pin-versions pre-commit"
uv tool install prek==${PREK_VERSION} --with uv==${UV_VERSION}
- name: "Run pin-versions"
run: >
pre-commit run -c .github/.pre-commit-config.yaml --all-files --verbose --hook-stage manual
prek -c .github/.pre-commit-config.yaml --all-files --verbose --hook-stage manual
pin-versions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -210,7 +208,7 @@ jobs:
needs-api-codegen: ${{needs.build-info.outputs.needs-api-codegen}}
default-python-version: "${{ needs.build-info.outputs.default-python-version }}"
basic-checks-only: ${{needs.build-info.outputs.basic-checks-only}}
skip-pre-commits: ${{needs.build-info.outputs.skip-pre-commits}}
skip-prek-hooks: ${{needs.build-info.outputs.skip-prek-hooks}}
canary-run: ${{needs.build-info.outputs.canary-run}}
latest-versions-only: ${{needs.build-info.outputs.latest-versions-only}}
use-uv: ${{needs.build-info.outputs.use-uv}}
Expand Down Expand Up @@ -255,7 +253,7 @@ jobs:
constraints-branch: ${{ needs.build-info.outputs.default-constraints-branch }}
default-python-version: "${{ needs.build-info.outputs.default-python-version }}"
upgrade-to-newer-dependencies: ${{ needs.build-info.outputs.upgrade-to-newer-dependencies }}
skip-pre-commits: ${{ needs.build-info.outputs.skip-pre-commits }}
skip-prek-hooks: ${{ needs.build-info.outputs.skip-prek-hooks }}
docker-cache: ${{ needs.build-info.outputs.docker-cache }}
disable-airflow-repo-cache: ${{ needs.build-info.outputs.disable-airflow-repo-cache }}
canary-run: ${{ needs.build-info.outputs.canary-run }}
Expand Down Expand Up @@ -301,7 +299,7 @@ jobs:
latest-versions-only: ${{ needs.build-info.outputs.latest-versions-only }}
basic-checks-only: ${{ needs.build-info.outputs.basic-checks-only }}
upgrade-to-newer-dependencies: ${{ needs.build-info.outputs.upgrade-to-newer-dependencies }}
skip-pre-commits: ${{ needs.build-info.outputs.skip-pre-commits }}
skip-prek-hooks: ${{ needs.build-info.outputs.skip-prek-hooks }}
ci-image-build: ${{ needs.build-info.outputs.ci-image-build }}
include-success-outputs: ${{ needs.build-info.outputs.include-success-outputs }}
debug-resources: ${{ needs.build-info.outputs.debug-resources }}
Expand Down
Loading
Loading