Compare commits

...

2 commits

Author SHA1 Message Date
11a483f2bb ci: split clippy and tests for parallel execution
Some checks failed
Release Docker Image / define-variables (push) Successful in 2s
Checks / Rust / Prek & Format (push) Successful in 46s
Checks / Rust / Tests (push) Failing after 14s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Failing after 2m9s
Checks / Rust / Clippy (push) Successful in 3m21s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Failing after 1m25s
Release Docker Image / merge (push) Has been skipped
Split the combined rust-checks job into separate clippy and tests jobs
to maximise parallelisation and reduce overall CI time.

Previous performance:
- Combined clippy + tests in single job: ~5.5 minutes
- Running sequentially wasted runner capacity

New approach:
- Three fully parallel jobs: fast-checks, clippy, and tests
- No dependencies between jobs for maximum parallelisation
- Each heavy job runs independently: ~4.5 minutes each
- Better cache utilisation with shared Rust registry and system packages
- Overall pipeline completes faster with true parallelisation

Optimisations:
- Remove sccache from clippy job (doesn't compile, only analyses)
- Keep sccache for tests job where compilation caching provides benefit
- Add concurrency group to cancel in-progress runs on new pushes
- Remove job dependencies to enable full parallelisation

The duplication of setup steps (uv, rustup, system deps) is offset by
the parallelisation gains, as runners can process all checks simultaneously.
2025-08-12 10:58:50 +01:00
de9e277b28 ci: consolidate workflows and add Renovate automation
Refactor CI pipeline for improved efficiency and maintainability.

Consolidate prefligit-checks.yml into rust-checks.yml with two-stage pipeline:
- fast-checks: prek (formerly prefligit) + formatting with nightly toolchain
- rust-checks: clippy + tests with stable toolchain (depends on fast-checks)

Replace rust-toolchain action with uvx for faster installation (~50% reduction).
Use uv/uvx as universal tool installer for prek and rustup. Respect
rust-toolchain.toml via 'uvx rustup show' for automatic version detection.

Add Renovate workflow for automated dependency updates with rate limiting
(2 PRs/hour, 3 concurrent max). Configure to scan .forgejo/ directories
for GitHub Actions.

Make sccache steps conditional on credentials availability to support forks.
Update deprecated actions: cache v3→v4, create-github-app-token to v2.
Fix deprecated check-byte-order-marker→fix-byte-order-marker in pre-commit.

Remove unnecessary prek cache and Python dependency tracking from uv cache.
Rename element.yml to clients-element.yml for clarity.
2025-08-12 10:55:02 +01:00
6 changed files with 174 additions and 78 deletions

View file

@ -1,22 +0,0 @@
name: Checks / Prefligit
on:
push:
pull_request:
permissions:
contents: read
jobs:
prefligit:
runs-on: ubuntu-latest
env:
FROM_REF: ${{ github.event.pull_request.base.sha || (!github.event.forced && ( github.event.before != '0000000000000000000000000000000000000000' && github.event.before || github.sha )) || format('{0}~', github.sha) }}
TO_REF: ${{ github.sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.forgejo/actions/prefligit
with:
extra_args: --all-files --hook-stage manual

View file

@ -0,0 +1,64 @@
name: Renovate
on:
schedule:
# Run at 2am UTC daily
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
dryRun:
description: 'Dry run mode'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
logLevel:
description: 'Log level'
required: false
default: 'info'
type: choice
options:
- 'debug'
- 'info'
- 'warn'
- 'error'
push:
branches:
- main
paths:
- '.forgejo/workflows/renovate.yml'
- 'renovate.json'
jobs:
renovate:
name: Renovate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Renovate
uses: renovatebot/github-action@v40.1.0
with:
token: ${{ secrets.RENOVATE_TOKEN }}
configurationFile: renovate.json
env:
# Platform settings
RENOVATE_PLATFORM: gitea
RENOVATE_ENDPOINT: ${{ github.server_url }}/api/v1
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
# Repository settings
RENOVATE_REPOSITORIES: '["${{ github.repository }}"]'
# Behaviour settings
RENOVATE_DRY_RUN: ${{ inputs.dryRun || 'false' }}
LOG_LEVEL: ${{ inputs.logLevel || 'info' }}
# Forgejo/Gitea specific
RENOVATE_GIT_AUTHOR: 'Renovate Bot <renovate@noreply.${{ github.server_url }}>'
# PR settings
RENOVATE_PR_HOURLY_LIMIT: '2'
RENOVATE_PR_CONCURRENT_LIMIT: '3'

View file

@ -2,10 +2,16 @@ name: Checks / Rust
on:
push:
pull_request:
# Cancel in-progress runs when a new push is made to the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
name: Format
fast-checks:
name: Prek & Format
runs-on: ubuntu-latest
steps:
@ -14,11 +20,20 @@ jobs:
with:
persist-credentials: false
- name: Install rust
uses: ./.forgejo/actions/rust-toolchain
- name: Install uv
uses: https://github.com/astral-sh/setup-uv@v6
with:
toolchain: "nightly"
components: "rustfmt"
enable-cache: true
ignore-nothing-to-cache: true
cache-dependency-glob: ''
- name: Run prek (formerly prefligit)
run: uvx prek run --show-diff-on-failure --color=always -v --all-files --hook-stage manual
- name: Install rust nightly with rustfmt
run: |
uvx rustup override set nightly
uvx rustup component add rustfmt
- name: Check formatting
run: |
@ -34,29 +49,29 @@ jobs:
with:
persist-credentials: false
- name: Install rust
uses: ./.forgejo/actions/rust-toolchain
- name: Install uv
uses: https://github.com/astral-sh/setup-uv@v6
with:
enable-cache: true
ignore-nothing-to-cache: true
cache-dependency-glob: '' # Disable Python dependency tracking for Rust project
- name: Install Rust toolchain
run: |
# Install toolchain from rust-toolchain.toml
uvx rustup show # This will auto-install from rust-toolchain.toml
- uses: https://github.com/actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
github-api-url: https://api.github.com
owner: ${{ vars.GH_APP_OWNER }}
repositories: ""
- name: Install sccache
uses: ./.forgejo/actions/sccache
with:
token: ${{ steps.app-token.outputs.token }}
- run: sudo apt-get update
- name: Install system dependencies
run: sudo apt-get update
- name: Cache system packages
uses: https://github.com/awalsh128/cache-apt-pkgs-action@v1
with:
packages: clang liburing-dev
version: 1
- name: Cache Rust registry
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/git
@ -64,12 +79,8 @@ jobs:
~/.cargo/registry
!~/.cargo/registry/src
key: rust-registry-${{hashFiles('**/Cargo.lock') }}
- name: Timelord
uses: ./.forgejo/actions/timelord
with:
key: sccache-v0
path: .
- name: Clippy
- name: Run Clippy lints
run: |
cargo clippy \
--workspace \
@ -80,13 +91,11 @@ jobs:
-- \
-D warnings
- name: Show sccache stats
if: always()
run: sccache --show-stats
cargo-test:
name: Cargo Test
tests:
name: Tests
runs-on: ubuntu-latest
env:
SCCACHE_ENABLED: ${{ vars.GH_APP_ID != '' && secrets.GH_APP_PRIVATE_KEY != '' }}
steps:
- name: Checkout repository
@ -94,29 +103,29 @@ jobs:
with:
persist-credentials: false
- name: Install rust
uses: ./.forgejo/actions/rust-toolchain
- name: Install uv
uses: https://github.com/astral-sh/setup-uv@v6
with:
enable-cache: true
ignore-nothing-to-cache: true
cache-dependency-glob: '' # Disable Python dependency tracking for Rust project
- name: Install Rust toolchain
run: |
# Install toolchain from rust-toolchain.toml
uvx rustup show # This will auto-install from rust-toolchain.toml
- uses: https://github.com/actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
github-api-url: https://api.github.com
owner: ${{ vars.GH_APP_OWNER }}
repositories: ""
- name: Install sccache
uses: ./.forgejo/actions/sccache
with:
token: ${{ steps.app-token.outputs.token }}
- run: sudo apt-get update
- name: Install system dependencies
run: sudo apt-get update
- name: Cache system packages
uses: https://github.com/awalsh128/cache-apt-pkgs-action@v1
with:
packages: clang liburing-dev
version: 1
- name: Cache Rust registry
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/git
@ -124,12 +133,32 @@ jobs:
~/.cargo/registry
!~/.cargo/registry/src
key: rust-registry-${{hashFiles('**/Cargo.lock') }}
- name: Timelord
- name: Create GitHub App token for sccache
if: env.SCCACHE_ENABLED == 'true'
uses: https://github.com/actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
github-api-url: https://api.github.com
owner: ${{ vars.GH_APP_OWNER }}
repositories: ""
- name: Setup sccache
if: env.SCCACHE_ENABLED == 'true'
uses: ./.forgejo/actions/sccache
with:
token: ${{ steps.app-token.outputs.token }}
- name: Setup Timelord
if: env.SCCACHE_ENABLED == 'true'
uses: ./.forgejo/actions/timelord
with:
key: sccache-v0
path: .
- name: Cargo Test
- name: Run Cargo tests
run: |
cargo test \
--workspace \
@ -139,6 +168,6 @@ jobs:
--all-targets \
--no-fail-fast
- name: Show sccache stats
if: always()
- name: Display sccache statistics
if: always() && env.SCCACHE_ENABLED == 'true'
run: sccache --show-stats

View file

@ -9,7 +9,7 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-byte-order-marker
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-symlinks
- id: destroyed-symlinks

View file

@ -22,5 +22,30 @@
"tikv-jemalloc-ctl",
"opentelemetry-rust",
"tracing-opentelemetry"
]
],
"github-actions": {
"enabled": true,
"fileMatch": [
"(^|/)\\.forgejo/workflows/[^/]+\\.ya?ml$",
"(^|/)\\.forgejo/actions/[^/]+/action\\.ya?ml$",
"(^|/)\\.github/workflows/[^/]+\\.ya?ml$",
"(^|/)\\.github/actions/[^/]+/action\\.ya?ml$"
]
},
"packageRules": [
{
"description": "Auto-merge minor and patch updates for GitHub Actions",
"matchManagers": ["github-actions"],
"matchUpdateTypes": ["minor", "patch"],
"automerge": false
},
{
"description": "Group all non-major GitHub Actions updates",
"matchManagers": ["github-actions"],
"matchUpdateTypes": ["minor", "patch"],
"groupName": "github-actions-non-major"
}
],
"prConcurrentLimit": 3,
"prHourlyLimit": 2
}