✅ CI cleanup and optimization (#28605)

This commit is contained in:
Keith Bennett 2026-09-26 21:59:01 -07:00 • committed by GitHub
parent 654a655fb3
commit 2795f23d28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 196 additions and 133 deletions

18
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,18 @@
#
# dependabot.yml
# Keep GitHub Actions versions current
#
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
labels:
- "PR: Improvement"
groups:
actions:
patterns:
- "*"

View file

@ -1,41 +0,0 @@
#
# auto-label.yml
# - Find all open issues without a label and a title containing "[BUG]".
# - Apply the label "Bug: Potential ?" to these issues.
#
name: Label Old Bugs
on:
schedule:
- cron: "30 8 * * *"
jobs:
autolabel:
name: Auto Label
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
steps:
- name: Auto Label for [BUG]
uses: actions/github-script@v7
with:
script: |
// Get all open issues in this repository
const issueList = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
// Filter issues without labels that have a title containing '[BUG]'.
const matchingIssues = issueList.data.filter(
issue => issue.title.includes('[BUG]') && issue.labels.length === 0
);
// Process the first 50
for (const issue of matchingIssues.slice(0, 50)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['Bug: Potential ?']
});
}

View file

@ -6,20 +6,25 @@
name: Bump Distribution Date
on:
workflow_dispatch:
schedule:
- cron: '0 */6 * * *'
permissions:
contents: write
jobs:
bump_date:
name: Bump Distribution Date
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Check out bugfix-2.0.x
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: bugfix-2.0.x
@ -39,7 +44,7 @@ jobs:
exit 0
- name: Check out bugfix-2.1.x
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: bugfix-2.1.x

View file

@ -13,15 +13,19 @@ on:
- 1.1.x
- 2.0.x
permissions:
pull-requests: write
jobs:
bad_target:
name: PR Bad Target
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: superbrothers/close-pull-request@v3
- uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 # v3
with:
comment: >
Thanks for your contribution! Unfortunately we can't accept PRs directed at release branches. We make patches to the bugfix branches and only later do we push them out as releases.

View file

@ -35,12 +35,16 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
test_builds:
name: Build Test
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 60
env:
CONFIG_BRANCH: ${{ github.base_ref || github.ref_name }}
@ -173,29 +177,18 @@ jobs:
steps:
- name: Check out the PR
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Cache pip
uses: actions/cache@v6
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-build-v1
restore-keys: |
${{ runner.os }}-pip-build-
- name: Cache PlatformIO
uses: actions/cache@v6
with:
path: |
~/.platformio
.pio/build
.pio/libdeps
key: ${{ runner.os }}-pio-build-v1
restore-keys: |
${{ runner.os }}-pio-build-
- name: Select Python 3.9
uses: actions/setup-python@v7
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: '3.9'
architecture: 'x64'
@ -203,17 +196,63 @@ jobs:
- name: Install PlatformIO
run: |
pip install -U platformio
pio upgrade --dev
- name: Resolve cache group
id: cache-group
env:
TEST_PLATFORM: ${{ matrix.test-platform }}
run: |
# Targets with the same platform and packages share a toolchain, so they share a cache
pio project config --json-output | python3 -c '
import hashlib, json, os, sys
config = dict(json.load(sys.stdin))
env = dict(config.get("env:" + os.environ["TEST_PLATFORM"], []))
toolchain = json.dumps([env.get("platform"), env.get("platform_packages")])
print("name=" + hashlib.sha1(toolchain.encode()).hexdigest()[:12])
' >>"$GITHUB_OUTPUT"
- name: Restore PlatformIO cache
id: pio-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ~/.platformio
key: ${{ runner.os }}-pio-v2-${{ steps.cache-group.outputs.name }}
# Libraries are installed per env, so each target keeps its own cache
- name: Restore library cache
id: lib-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .pio/libdeps
key: ${{ runner.os }}-libdeps-v1-${{ matrix.test-platform }}-${{ hashFiles('ini/*.ini', 'platformio.ini') }}
restore-keys: |
${{ runner.os }}-libdeps-v1-${{ matrix.test-platform }}-
- name: Update PlatformIO packages
run: |
pio pkg update --global
- name: Install Simulator dependencies
if: matrix.test-platform == 'simulator_linux_release'
run: |
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-net-dev
sudo apt-get install libglm-dev
sudo apt-get install -y build-essential libsdl2-dev libsdl2-net-dev libglm-dev
- name: Run ${{ matrix.test-platform }} Tests
run: |
make tests-single-ci TEST_TARGET=${{ matrix.test-platform }}
# Only push builds refresh the caches, so PR runs can't fill the repo cache quota
- name: Save PlatformIO cache
if: github.event_name == 'push' && steps.pio-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ~/.platformio
key: ${{ steps.pio-cache.outputs.cache-primary-key }}
- name: Save library cache
if: github.event_name == 'push' && steps.lib-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .pio/libdeps
key: ${{ steps.lib-cache.outputs.cache-primary-key }}

View file

@ -32,6 +32,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
# This runs all unit tests as a single job. While it should be possible to break this up into
# multiple jobs, they currently run quickly and finish long before the compilation tests.
@ -42,32 +45,33 @@ jobs:
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Check out the PR
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Cache pip
uses: actions/cache@v6
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-unit-v1
restore-keys: |
${{ runner.os }}-pip-unit-
- name: Cache PlatformIO
uses: actions/cache@v6
- name: Restore PlatformIO cache
id: pio-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
~/.platformio
.pio/build
.pio/libdeps
key: ${{ runner.os }}-pio-tests-v1
key: ${{ runner.os }}-pio-unit-v1-${{ hashFiles('ini/*.ini', 'platformio.ini') }}
restore-keys: |
${{ runner.os }}-pio-tests-
${{ runner.os }}-pio-unit-v1-
- name: Select Python 3.9
uses: actions/setup-python@v7
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: '3.9'
architecture: 'x64'
@ -75,9 +79,18 @@ jobs:
- name: Install PlatformIO
run: |
pip install -U platformio
pio upgrade --dev
pio pkg update --global
- name: Run All Unit Tests
run: |
make unit-test-all-local
# Only push builds refresh the cache, so PR runs can't fill the repo cache quota
- name: Save PlatformIO cache
if: github.event_name == 'push' && steps.pio-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
~/.platformio
.pio/libdeps
key: ${{ steps.pio-cache.outputs.cache-primary-key }}

View file

@ -23,27 +23,23 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
validate_pins_files:
name: Validate boards.h
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Check out the PR
uses: actions/checkout@v7
- name: Cache pip
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-validation-v1
restore-keys: |
${{ runner.os }}-pip-validation-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Select Python 3.9
uses: actions/setup-python@v7
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.9"
architecture: "x64"

View file

@ -20,26 +20,21 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
validate_source_files:
name: Validate Source Files
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Check out the PR
uses: actions/checkout@v7
- name: Cache node_modules
uses: actions/cache@v6
with:
path: node_modules
key: ${{ runner.os }}-npm-lines-v1
restore-keys: |
${{ runner.os }}-npm-lines-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Validate text file formatting
run: |
npm install --save-dev prettier
make validate-lines -j

View file

@ -26,27 +26,23 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
validate_pins_files:
name: Validate Pins Files
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Check out the PR
uses: actions/checkout@v7
- name: Cache pip
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-validation-v1
restore-keys: |
${{ runner.os }}-pip-validation-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Select Python 3.9
uses: actions/setup-python@v7
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.9"
architecture: "x64"

View file

@ -6,35 +6,54 @@
name: Clean Closed
on:
pull_request:
pull_request_target:
types: [closed]
issues:
types: [closed]
permissions:
issues: write
pull-requests: write
jobs:
remove_label:
runs-on: ubuntu-22.04
name: Clean Closed
if: github.repository == 'MarlinFirmware/Marlin'
strategy:
matrix:
label:
- "S: Don't Merge"
- "S: Hold for 2.1"
- "S: Please Merge"
- "S: Please Test"
- "help wanted"
- "Bug: Potential ?"
- "Needs: Discussion"
- "Needs: Documentation"
- "Needs: More Data"
- "Needs: Patch"
- "Needs: Testing"
- "Needs: Work"
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Remove Labels
uses: actions-ecosystem/action-remove-labels@v1
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
github_token: ${{ github.token }}
labels: ${{ matrix.label }}
script: |
const obsolete = [
"S: Don't Merge",
"S: Hold for 2.1",
"S: Please Merge",
"S: Please Test",
"help wanted",
"Bug: Potential ?",
"Needs: Discussion",
"Needs: Documentation",
"Needs: More Data",
"Needs: Patch",
"Needs: Testing",
"Needs: Work"
];
const issue_number = context.issue.number;
const { data: issue } = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number
});
const stale = issue.labels.map(l => l.name).filter(l => obsolete.includes(l));
for (const name of stale) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
name
});
}

View file

@ -6,18 +6,25 @@
name: Close Stale Issues
on:
workflow_dispatch:
schedule:
- cron: "22 1 * * *"
permissions:
actions: write
issues: write
pull-requests: write
jobs:
stale:
name: Close Stale Issues
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/stale@v9
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: |

View file

@ -6,18 +6,23 @@
name: Lock Closed Issues
on:
workflow_dispatch:
schedule:
- cron: '0 1/13 * * *'
permissions:
issues: write
jobs:
lock:
name: Lock Closed Issues
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: dessant/lock-threads@v5
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5
with:
github-token: ${{ github.token }}
process-only: 'issues'

View file

@ -9,14 +9,25 @@ on:
issues:
types: [reopened]
permissions:
issues: write
jobs:
unlock:
name: Unlock Reopened
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: OSDKDev/unlock-issues@v1.1
- name: Unlock Reopened Issue
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
if (!context.payload.issue.locked) return;
await github.rest.issues.unlock({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});

View file

@ -232,7 +232,6 @@ GitHub Actions workflows run on every pull request and push:
| `ci-validate-boards.yml` | Validates board pin configurations |
| `ci-validate-pins.yml` | Checks for missing/invalid pin definitions |
| `ci-validate-lines.yml` | Validates line count limits for 8-bit boards |
| `auto-label.yml` | Auto-labels PRs by changed paths |
| `check-pr.yml` | PR quality checks |
### 6.4 Docker Build Environment
@ -242,7 +241,6 @@ A Dockerfile (`docker/Dockerfile`) provides a reproducible build environment:
```dockerfile
FROM python:3.11-bookworm
RUN pip install -U platformio PyYaml
RUN pio upgrade --dev
WORKDIR /code
```

View file

@ -4,6 +4,7 @@ CONTAINER_RT_BIN := docker
CONTAINER_RT_OPTS := --rm -v $(PWD):/code -v platformio-cache:/root/.platformio
CONTAINER_IMAGE := marlin-dev
UNIT_TEST_CONFIG ?= default
PRETTIER_VERSION ?= 3.9.6
# Find a Python 3 interpreter
ifeq ($(OS),Windows_NT)
@ -170,7 +171,7 @@ format-lines:
validate-lines:
@echo "Validating text formatting"
@npx prettier --check . --editorconfig --object-wrap preserve --prose-wrap never
@npx --yes prettier@$(PRETTIER_VERSION) --check . --editorconfig --object-wrap preserve --prose-wrap never
validate-urls:
@echo "Checking URLs in source files"

View file

@ -28,9 +28,6 @@ RUN pip install --upgrade pip
# Install platformio toolchain / framework and pyyaml
RUN pip install -U platformio PyYaml
# Upgrade platformio using development version / branch
RUN pio upgrade --dev
# Set working directory
WORKDIR /code