From 700ae14504c1b7f425b8dcbaafa098c08b7b2142 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Mon, 6 Jan 2025 10:52:48 +0100 Subject: [PATCH 1/7] CI: Update from Ubuntu 22.04 to 24.04 --- .github/workflows/build_offline_docs.yml | 2 +- .github/workflows/cherrypick.yml | 4 ++-- .github/workflows/ci.yml | 2 +- .github/workflows/sync_class_ref.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_offline_docs.yml b/.github/workflows/build_offline_docs.yml index 73f6308a8ba..4928905ee6a 100644 --- a/.github/workflows/build_offline_docs.yml +++ b/.github/workflows/build_offline_docs.yml @@ -11,7 +11,7 @@ jobs: # Don't run scheduled runs on forks unless the CI_OFFLINE_DOCS_CRON variable is set to 'true'. # Manual runs can still be triggered as normal. if: ${{ github.repository_owner == 'godotengine' || github.event_name != 'schedule' || vars.CI_OFFLINE_DOCS_CRON == 'true' }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: branch: diff --git a/.github/workflows/cherrypick.yml b/.github/workflows/cherrypick.yml index f8777d6785a..c1d18778313 100644 --- a/.github/workflows/cherrypick.yml +++ b/.github/workflows/cherrypick.yml @@ -18,7 +18,7 @@ jobs: Create-cherrypick-PR: # The cherrypick label is hardcoded because `contains()` doesn't seem to be able to use an environment variable as a second argument. if: ${{ github.event.pull_request.merged == true && contains( github.event.pull_request.labels.*.name, 'cherrypick:4.3' ) }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: # "Ternary" hack featured in the official docs. # When using "Squash and merge", the commit hash is the last merge commit of the pull request merge branch. @@ -29,7 +29,7 @@ jobs: PR_NUMBER: ${{ github.event.number }} steps: - + - name: Checkout uses: actions/checkout@v4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff08ec8ccca..90d09e5a7e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ concurrency: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/sync_class_ref.yml b/.github/workflows/sync_class_ref.yml index f4ae830e4b6..7360d18b39b 100644 --- a/.github/workflows/sync_class_ref.yml +++ b/.github/workflows/sync_class_ref.yml @@ -19,7 +19,7 @@ jobs: # Manual runs can still be triggered as normal. if: ${{ github.repository_owner == 'godotengine' || github.event_name != 'schedule' || vars.CI_SYNC_CLASS_REF_CRON == 'true' }} name: Update class reference files based on the engine revision - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: engine_rev: 'master' From 434c5cbb1fe7fca9185e30a3f862708a62b36c0f Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Mon, 6 Jan 2025 10:54:41 +0100 Subject: [PATCH 2/7] CI: Fix permissions --- .github/workflows/build_offline_docs.yml | 2 ++ .github/workflows/cherrypick.yml | 5 ++++- .github/workflows/sync_class_ref.yml | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_offline_docs.yml b/.github/workflows/build_offline_docs.yml index 4928905ee6a..f35bbc078e1 100644 --- a/.github/workflows/build_offline_docs.yml +++ b/.github/workflows/build_offline_docs.yml @@ -18,6 +18,8 @@ jobs: - master - stable - 3.6 + permissions: + contents: write steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/cherrypick.yml b/.github/workflows/cherrypick.yml index c1d18778313..72d0bdbfd7d 100644 --- a/.github/workflows/cherrypick.yml +++ b/.github/workflows/cherrypick.yml @@ -28,8 +28,11 @@ jobs: COMMIT_HASH: ${{ github.event.pull_request.commits > 1 && github.sha || github.event.pull_request.head.sha }} PR_NUMBER: ${{ github.event.number }} - steps: + permissions: + contents: write + pull-requests: write + steps: - name: Checkout uses: actions/checkout@v4 with: diff --git a/.github/workflows/sync_class_ref.yml b/.github/workflows/sync_class_ref.yml index 7360d18b39b..14cb90eacff 100644 --- a/.github/workflows/sync_class_ref.yml +++ b/.github/workflows/sync_class_ref.yml @@ -22,6 +22,9 @@ jobs: runs-on: ubuntu-24.04 env: engine_rev: 'master' + permissions: + contents: write + pull-requests: write steps: - name: Checkout the documentation repository From cd993f0b96fb265ad3aeb85a9426bf19cce5c888 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Mon, 6 Jan 2025 10:55:46 +0100 Subject: [PATCH 3/7] CI: Improve Sphinx performance, use multiple cores According to https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners, these runners are expected to have 4 CPUs available --- .github/workflows/build_offline_docs.yml | 4 ++-- .github/workflows/ci.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_offline_docs.yml b/.github/workflows/build_offline_docs.yml index f35bbc078e1..6a54cadc77f 100644 --- a/.github/workflows/build_offline_docs.yml +++ b/.github/workflows/build_offline_docs.yml @@ -32,7 +32,7 @@ jobs: sudo apt install parallel libwebp7 - name: Sphinx - Build HTML - run: make SPHINXOPTS='--color' html + run: make SPHINXOPTS='--color -j 4' html - uses: actions/upload-artifact@v4 with: @@ -54,7 +54,7 @@ jobs: sed -i 's/"godot_is_latest": True/"godot_is_latest": False/' conf.py sed -i 's/"godot_show_article_status": True/"godot_show_article_status": False/' conf.py - make SPHINXOPTS='--color' epub + make SPHINXOPTS='--color -j 4' epub - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90d09e5a7e4..8b1365ccdd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,4 +23,4 @@ jobs: # Use dummy builder to improve performance as we don't need the generated HTML in this workflow. - name: Sphinx build - run: make SPHINXOPTS='--color -W' dummy + run: make SPHINXOPTS='--color -j 4 -W' dummy From 9680c56b083a01ba0cea58659dc9d9c0e2733a67 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Mon, 6 Jan 2025 11:09:07 +0100 Subject: [PATCH 4/7] CI: Update some comments --- .github/dependabot.yml | 4 +++- .github/workflows/sync_class_ref.yml | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 37a2e10d175..2fadf9a9424 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,5 +9,7 @@ updates: schedule: interval: "daily" ignore: - # ReadTheDocs is staying on v1. + # We need to decide on when we upgrade Sphinx manually, + # as historically, this has been proven to often imply larger changes + # (RTD compat, upgrading extensions, other dependencies, our content, etc.). - dependency-name: "sphinx" diff --git a/.github/workflows/sync_class_ref.yml b/.github/workflows/sync_class_ref.yml index 14cb90eacff..0f868028383 100644 --- a/.github/workflows/sync_class_ref.yml +++ b/.github/workflows/sync_class_ref.yml @@ -3,9 +3,10 @@ name: Sync Class Reference on: workflow_dispatch: # Scheduled updates only run on the default/master branch. + # Other branches need to be run manually (usually after a new release for that branch). schedule: - # Run it at night (European time) every Saturday. - # The offset is there to try and avoid the high load times. + # Run it at (European) night time every Saturday. + # The offset is there to try and avoid high load times. - cron: '15 3 * * 6' # Make sure jobs cannot overlap. From 1b429b4c356ed5d08a30a4c5b2c7322e7c6e98f4 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Mon, 6 Jan 2025 11:09:42 +0100 Subject: [PATCH 5/7] CI: Update github.ref to github.ref_name See https://github.blog/changelog/2023-09-13-github-actions-updates-to-github_ref-and-github-ref --- .github/workflows/ci.yml | 2 +- .github/workflows/sync_class_ref.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b1365ccdd1..4df375e64f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: pull_request: concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/sync_class_ref.yml b/.github/workflows/sync_class_ref.yml index 0f868028383..22db8a1ae65 100644 --- a/.github/workflows/sync_class_ref.yml +++ b/.github/workflows/sync_class_ref.yml @@ -11,7 +11,7 @@ on: # Make sure jobs cannot overlap. concurrency: - group: classref-sync-ci-master + group: classref-sync-ci-${{ github.ref_name }} cancel-in-progress: true jobs: From 982783d9ab9260cd5fdba35fd0a8381f5cf95358 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Mon, 6 Jan 2025 17:28:16 +0100 Subject: [PATCH 6/7] CI: Add virtualenv --- .github/workflows/build_offline_docs.yml | 23 ++++++++++++++++++- .github/workflows/ci.yml | 28 ++++++++++++++++++++++-- conf.py | 2 +- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_offline_docs.yml b/.github/workflows/build_offline_docs.yml index 6a54cadc77f..390df8ecd93 100644 --- a/.github/workflows/build_offline_docs.yml +++ b/.github/workflows/build_offline_docs.yml @@ -25,12 +25,33 @@ jobs: with: ref: ${{ matrix.branch }} + - name: Get Python version + id: pythonv + run: | + echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_OUTPUT + + - name: Restore cached virtualenv + uses: actions/cache/restore@v4 + with: + key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }} + path: .venv + - name: Install dependencies run: | - sudo pip3 install -r requirements.txt + python -m venv .venv + source .venv/bin/activate + python -m pip install -r requirements.txt + echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV sudo apt update sudo apt install parallel libwebp7 + - name: Save virtualenv cache + uses: actions/cache/save@v4 + with: + key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }} + path: .venv + - name: Sphinx - Build HTML run: make SPHINXOPTS='--color -j 4' html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4df375e64f6..abc27413d1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,33 @@ jobs: - name: Style checks via pre-commit uses: pre-commit/action@v3.0.1 + - name: Get Python version + id: pythonv + run: | + echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_OUTPUT + + - name: Restore cached virtualenv + uses: actions/cache/restore@v4 + with: + key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }} + path: .venv + - name: Install dependencies - run: sudo pip3 install -r requirements.txt + run: | + python -m venv .venv + source .venv/bin/activate + python -m pip install -r requirements.txt + echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV + + - name: Save virtualenv cache + uses: actions/cache/save@v4 + with: + key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }} + path: .venv # Use dummy builder to improve performance as we don't need the generated HTML in this workflow. - name: Sphinx build - run: make SPHINXOPTS='--color -j 4 -W' dummy + run: | + source .venv/bin/activate + make SPHINXOPTS='--color -j 4 -W' dummy diff --git a/conf.py b/conf.py index a3102b02132..fcc4b7d65fa 100644 --- a/conf.py +++ b/conf.py @@ -140,7 +140,7 @@ is_i18n = tags.has("i18n") # noqa: F821 print("Build language: {}, i18n tag: {}".format(language, is_i18n)) -exclude_patterns = ["_build"] +exclude_patterns = [".*", "**/.*", "_build", "_tools"] # fmt: off # These imports should *not* be moved to the start of the file, From 2bb21eaf83bc7c391324b548250dbdd8adaedba9 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Mon, 6 Jan 2025 21:15:19 +0100 Subject: [PATCH 7/7] CI: Add timeouts --- .github/workflows/build_offline_docs.yml | 1 + .github/workflows/cherrypick.yml | 1 + .github/workflows/ci.yml | 1 + .github/workflows/sync_class_ref.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/build_offline_docs.yml b/.github/workflows/build_offline_docs.yml index 390df8ecd93..e1d6a289eed 100644 --- a/.github/workflows/build_offline_docs.yml +++ b/.github/workflows/build_offline_docs.yml @@ -12,6 +12,7 @@ jobs: # Manual runs can still be triggered as normal. if: ${{ github.repository_owner == 'godotengine' || github.event_name != 'schedule' || vars.CI_OFFLINE_DOCS_CRON == 'true' }} runs-on: ubuntu-24.04 + timeout-minutes: 180 strategy: matrix: branch: diff --git a/.github/workflows/cherrypick.yml b/.github/workflows/cherrypick.yml index 72d0bdbfd7d..0be1fc39925 100644 --- a/.github/workflows/cherrypick.yml +++ b/.github/workflows/cherrypick.yml @@ -19,6 +19,7 @@ jobs: # The cherrypick label is hardcoded because `contains()` doesn't seem to be able to use an environment variable as a second argument. if: ${{ github.event.pull_request.merged == true && contains( github.event.pull_request.labels.*.name, 'cherrypick:4.3' ) }} runs-on: ubuntu-24.04 + timeout-minutes: 10 env: # "Ternary" hack featured in the official docs. # When using "Squash and merge", the commit hash is the last merge commit of the pull request merge branch. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abc27413d1c..e7413f86dbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ concurrency: jobs: build: runs-on: ubuntu-24.04 + timeout-minutes: 120 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/sync_class_ref.yml b/.github/workflows/sync_class_ref.yml index 22db8a1ae65..a210f6f2bd0 100644 --- a/.github/workflows/sync_class_ref.yml +++ b/.github/workflows/sync_class_ref.yml @@ -21,6 +21,7 @@ jobs: if: ${{ github.repository_owner == 'godotengine' || github.event_name != 'schedule' || vars.CI_SYNC_CLASS_REF_CRON == 'true' }} name: Update class reference files based on the engine revision runs-on: ubuntu-24.04 + timeout-minutes: 10 env: engine_rev: 'master' permissions: