This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 79971ffd80 Modernize GH action environment setup (#1195)
79971ffd80 is described below

commit 79971ffd80984a6887e34463e455da95f5b14349
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun May 11 16:10:00 2025 +0200

    Modernize GH action environment setup (#1195)
---
 ...{print_df.sh => dump-docs-packages-metadata.py} | 28 +++++++++---------
 .github/scripts/refresh_pmc_committer_images.py    |  8 +++++
 .github/workflows/build.yml                        | 34 ++++------------------
 .gitignore                                         |  1 +
 .pre-commit-config.yaml                            | 20 +++++++------
 dump-docs-packages-metadata.py                     | 10 -------
 requirements.txt                                   |  4 ---
 site.sh                                            |  4 +--
 sphinx_airflow_theme/demo/docs.sh                  |  2 +-
 9 files changed, 44 insertions(+), 67 deletions(-)

diff --git a/.github/scripts/print_df.sh 
b/.github/scripts/dump-docs-packages-metadata.py
similarity index 61%
rename from .github/scripts/print_df.sh
rename to .github/scripts/dump-docs-packages-metadata.py
index 4b13f1fe1f..13f4b71db6 100755
--- a/.github/scripts/print_df.sh
+++ b/.github/scripts/dump-docs-packages-metadata.py
@@ -1,5 +1,4 @@
-#!/usr/bin/env bash
-
+#!/usr/bin/env python
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,17 +15,20 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+# PEP 723 compliant inline script metadata
+# /// script
+# requires-python = ">=3.9"
+# dependencies = [
+#   "requests>=2.32.2",
+# ]
+# ///
+
+import sys
 
+import requests
 
-# Create an expandable group in the logs for the disk free (df -h) bash 
command output using the syntax defined for
-# GiHub Action runners:
-# 
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines.
-# With such expandable logs groupings we can avoid noisy outputs and at the 
same time have pointers for
-# debugging/analysis.
-function group_df_logs {
-    echo "::group::df -h"
-    df -h
-    echo "::endgroup::"
-}
+resp = 
requests.get("https://live-docs-airflow-apache-org.s3.us-east-2.amazonaws.com/manifest/packages-metadata.json";)
+if resp.status_code != 200:
+    raise RuntimeError(f"Failed to fetch metadata: {resp.status_code} - 
{resp.text}")
 
-group_df_logs
+sys.stdout.write(resp.text)
diff --git a/.github/scripts/refresh_pmc_committer_images.py 
b/.github/scripts/refresh_pmc_committer_images.py
index d53b965067..a4df19f5b0 100644
--- a/.github/scripts/refresh_pmc_committer_images.py
+++ b/.github/scripts/refresh_pmc_committer_images.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -14,6 +15,13 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+# PEP 723 compliant inline script metadata
+# /// script
+# requires-python = ">=3.9"
+# dependencies = [
+#   "requests>=2.32.2",
+# ]
+# ///
 
 import os
 import requests
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4b63f1c91d..4309ff61a1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -59,10 +59,6 @@ jobs:
       - name: Set working directory to /mnt/airflow-site
         working-directory: /mnt/airflow-site
         run: echo "Working directory set to /mnt/airflow-site"
-
-      - name: Display disk free
-        run: /mnt/airflow-site/.github/scripts/print_df.sh
-        working-directory: /mnt/airflow-site
       - name: 🐍 Setup Python
         uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0  # 
v4.6.1
         with:
@@ -79,20 +75,17 @@ jobs:
       - name: 🟒 Install node dependencies
         run: |
           /mnt/airflow-site/site.sh install-node-deps
-          /mnt/airflow-site/.github/scripts/print_df.sh
-      - name: 🐍 Install Python dependencies
+      - name: 🐍 Install uv
         run: |
-          pip install -r requirements.txt
-          /mnt/airflow-site/.github/scripts/print_df.sh
+          curl -LsSf https://astral.sh/uv/install.sh | sh
       - name: Ensure cache directory exists and adjust permissions
         run: |
           mkdir -p /mnt/airflow-site/.cache/pre-commit
           sudo chmod -R 777 /mnt/airflow-site/.cache/pre-commit
       - name: πŸ”Ž Lint
         run: |
-          pip install pre-commit
-          pip install pre-commit-uv
-          pre-commit run --all-files
+          uv tool install pre-commit --with pre-commit-uv
+          pre-commit run --all-files --color always
       - name: πŸ—‚ Checkout publish branch with minimum depth
         uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9  # 
3.5.3
         if: github.event_name == 'push' || github.event_name == 
'workflow_dispatch'
@@ -103,8 +96,6 @@ jobs:
       - name: πŸ”§ Build site
         run: |
           /mnt/airflow-site/site.sh build-site
-          /mnt/airflow-site/.github/scripts/print_df.sh
-
       - name: Install AWS CLI v2
         if: github.event_name == 'push' || github.event_name == 
'workflow_dispatch'
         run: |
@@ -113,7 +104,6 @@ jobs:
           rm /tmp/awscliv2.zip
           sudo /tmp/aws/install --update
           rm -rf /tmp/aws/
-
       - name: Configure AWS credentials
         if: github.event_name == 'push' || github.event_name == 
'workflow_dispatch'
         uses: 
aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a  
# v4.0.1
@@ -135,7 +125,6 @@ jobs:
           echo "These files have been deleted to optimize the size of the 
artifacts." > ./dist/docs/index.html
           echo "Here was the contents of the ./docs-archive directory" >> 
./dist/docs/index.html
           find ./dist/
-          /mnt/airflow-site/.github/scripts/print_df.sh
       - uses: actions/upload-artifact@v4
         name: πŸš€ Upload website as artifact
         if: ${{ github.event_name == 'pull_request' }}
@@ -150,33 +139,27 @@ jobs:
           # The asf.yaml file must be in the branch from which the files are 
published.
           # Otherwise, ASF publising tools cannot detect it.
           cp .asf.yaml ./dist/
-          /mnt/airflow-site/.github/scripts/print_df.sh
       - name: πŸͺ“ Remove node and node modules
         run: |
           rm -rf node_modules
           sudo rm -rf "$AGENT_TOOLSDIRECTORY/node"
-          /mnt/airflow-site/.github/scripts/print_df.sh
       - name: πŸ”„Refresh PMC/COMMITTERS profiles
         env:
           PMC_COMMITTERS_FILES: 
landing-pages/site/data/committers.json,landing-pages/site/data/pmc.json
         run: |
-          python3 ./.github/scripts/refresh_pmc_committer_images.py
+          uv run ./.github/scripts/refresh_pmc_committer_images.py
       - name: πŸš€ Add commit to publish branch and deploy it
         if: github.event_name == 'push' || github.event_name == 
'workflow_dispatch'
         working-directory: dist
         run: |
-          ../.github/scripts/print_df.sh
           echo "Running git config"
           git config user.name "GitHub Actions"
           git config user.email "acti...@users.noreply.github.com"
           echo "Running git add"
           git add .
-          ../.github/scripts/print_df.sh
           echo "Running git commit"
           git commit --no-edit -m "Docs updated via ${{ github.ref }}:${{ 
github.sha }}" > ../git_commit.log
-          ../.github/scripts/print_df.sh
           git push origin publish
-          ../.github/scripts/print_df.sh
       - name: πŸš€ Upload git commit log as artifacts
         uses: actions/upload-artifact@v4
         with:
@@ -186,13 +169,10 @@ jobs:
       - name: πŸ”§ Copy files from site to theme
         run: |
           ./site.sh prepare-theme
-          ./.github/scripts/print_df.sh
       - name: πŸ”§ Prepare sphinx_airflow_theme package ️
         working-directory: sphinx_airflow_theme
         run: |
-          python3 -m pip install --user --upgrade setuptools wheel
-          python3 setup.py sdist bdist_wheel
-          ../.github/scripts/print_df.sh
+          uv build
       - name: πŸš€ Upload sphinx_airflow_theme package as artifact
         uses: actions/upload-artifact@v4
         with:
@@ -206,7 +186,6 @@ jobs:
           pip install ./dist/sphinx_airflow_theme-*.whl
           cd demo
           ./docs.sh build
-          ../../.github/scripts/print_df.sh
       - name: πŸš€ Upload sphinx_airflow_theme demo as artifact
         uses: actions/upload-artifact@v4
         with:
@@ -236,4 +215,3 @@ jobs:
             --title "${TITLE}" \
             --notes "${NOTES}" \
             ./dist/*
-          ../.github/scripts/print_df.sh
diff --git a/.gitignore b/.gitignore
index 0844d03de9..c3e1f96032 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,4 +25,5 @@ sphinx_airflow_theme/sphinx_airflow_theme/static/_gen/
 sphinx_airflow_theme/demo/_doctrees/
 docs-archive/**/output-*.log
 *.log
+*.iml
 .venv/
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9e6b8e56de..04f2b8c5b6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,10 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 ---
-default_stages: [commit, push]
+default_stages: [pre-commit, pre-push]
 default_language_version:
   # force all unspecified python hooks to run python3
   python: python3
+  node: "16.20.2"
 exclude: 
^(docs-archive|landing-pages/site/static/external|landing-pages/site/layouts/partials/scripts.html|landing-pages/site/assets/scss/_variables.scss)
 
 repos:
@@ -123,23 +124,25 @@ repos:
         types: [shell]
         files: ^breeze$|^breeze-complete$|\.sh$|^hooks/build$|^hooks/push$
       - id: lint-dockerfile
-        name: Lint dockerfile
-        language: docker_image
-        types:
-          - dockerfile
-        entry: --entrypoint /bin/hadolint hadolint/hadolint:latest -
+        name: Lint Dockerfile
+        language: system
+        entry: bash -c "docker run --rm hadolint/hadolint:latest <Dockerfile"
       - id: lint-css
         name: Lint CSS files
         entry: ./site.sh lint-css
-        language: system
+        language: node
         files: \.scss$
         exclude: _roadmap.scss$|_rst-content.scss$
+        additional_dependencies:
+          - yarn
       - id: lint-js
         name: Lint JS files
         entry: ./site.sh lint-js
-        language: system
+        language: node
         files: \.js$
         exclude: ^sphinx_airflow_theme/
+        additional_dependencies:
+          - yarn
   - repo: https://github.com/pre-commit/pre-commit-hooks
     rev: v4.4.0
     hooks:
@@ -156,6 +159,5 @@ repos:
           - --autofix
           - 
--top-keys=name,version,description,repository,main,author,license,scripts
       - id: mixed-line-ending
-      - id: requirements-txt-fixer
       - id: trailing-whitespace
         args: [--markdown-linebreak-ext=md]
diff --git a/dump-docs-packages-metadata.py b/dump-docs-packages-metadata.py
deleted file mode 100755
index 43587745be..0000000000
--- a/dump-docs-packages-metadata.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-import sys
-
-import requests
-
-resp = 
requests.get("https://live-docs-airflow-apache-org.s3.us-east-2.amazonaws.com/manifest/packages-metadata.json";)
-if resp.status_code != 200:
-    raise RuntimeError(f"Failed to fetch metadata: {resp.status_code} - 
{resp.text}")
-
-sys.stdout.write(resp.text)
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 91055c6f00..0000000000
--- a/requirements.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-pre-commit==2.20.0
-PyYAML==6.0
-requests==2.32.2
-semver==2.13.0
diff --git a/site.sh b/site.sh
index 7ea1d7d718..2bc27c6e43 100755
--- a/site.sh
+++ b/site.sh
@@ -127,7 +127,7 @@ function run_lint {
 
 function prepare_packages_metadata {
     log "Preparing packages-metadata.json"
-    "${MY_DIR}"/dump-docs-packages-metadata.py > 
"${MY_DIR}/landing-pages/site/static/_gen/packages-metadata.json"
+    uv run "${MY_DIR}"/.github/scripts/dump-docs-packages-metadata.py > 
"${MY_DIR}/landing-pages/site/static/_gen/packages-metadata.json"
 }
 
 function build_landing_pages {
@@ -171,7 +171,7 @@ function build_site {
     # This file may already have been created during building landing pages,
     # but when building a full site, it's worth regenerate
     log "Preparing packages-metadata.json"
-    "${MY_DIR}"/dump-docs-packages-metadata.py > 
"${MY_DIR}/dist/_gen/packages-metadata.json"
+    uv run "${MY_DIR}"/.github/scripts/dump-docs-packages-metadata.py > 
"${MY_DIR}/dist/_gen/packages-metadata.json"
 
     # Sanity checks
     assert_file_exists "${MY_DIR}"/dist/docs/index.html
diff --git a/sphinx_airflow_theme/demo/docs.sh 
b/sphinx_airflow_theme/demo/docs.sh
index c1024f39af..37d5cc533a 100755
--- a/sphinx_airflow_theme/demo/docs.sh
+++ b/sphinx_airflow_theme/demo/docs.sh
@@ -80,7 +80,7 @@ if [[ "${CMD}" == "build" ]] ; then
     rm -rf _build
     build_sphinx_demo
     mkdir -p _build/_gen/
-    (cd ../../; python dump-docs-packages-metadata.py > 
"${BUILD_DIR}/_gen/packages-metadata.json")
+    (cd ../../; uv run .github/scripts/dump-docs-packages-metadata.py > 
"${BUILD_DIR}/_gen/packages-metadata.json")
     exit 0
 elif [[ "${CMD}" == "preview" ]] ; then
     start_preview

Reply via email to