mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-11 23:13:02 +02:00
ci: modernise CI pipeline with improved tooling and workflow structure
Pipeline Modernisation: - Updated to prek (prefligit renamed to avoid typosquatting) - Adopted uvx for tool invocation (prek, rustup) without install scripts - Consolidated workflow steps to run in parallel where possible - Removed redundant custom actions in favour of direct uvx commands - Made sccache optional (based on secrets availability) for fork compatibility Workflow Restructuring: - Renamed workflows for clarity and consistency: * rust-checks.yml → ci-checks.yml (now includes prek linting) * clients-element.yml → deploy-element.yml * documentation.yml → deploy-docs.yml * release-image.yml → release-builds.yml (builds images AND binaries) * mirror-images.yml → docker-mirror.yml - Simplified job and step naming throughout for better readability Performance Improvements: - Parallel execution of independent steps (formatting and prek checks) - Optimised caching strategy for uv and Rust dependencies - Reduced CI execution time through better parallelisation Dependency Management: - Added Renovate configuration for automated dependency updates - Configured to monitor both .forgejo/ and .github/ workflows - Set up automatic PR creation for non-major GitHub Actions updates
This commit is contained in:
parent
583cb924f1
commit
a71e584a25
10 changed files with 297 additions and 208 deletions
175
.forgejo/workflows/ci-checks.yml
Normal file
175
.forgejo/workflows/ci-checks.yml
Normal file
|
@ -0,0 +1,175 @@
|
|||
name: CI Checks
|
||||
|
||||
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:
|
||||
fast-checks:
|
||||
name: Prek & Format
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install uv
|
||||
uses: https://github.com/astral-sh/setup-uv@v6
|
||||
with:
|
||||
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: |
|
||||
cargo +nightly fmt --all -- --check
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- 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
|
||||
|
||||
# cache-apt-pkgs-action requires apt lists to be initialised first
|
||||
- name: Update APT package lists
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Cache system packages
|
||||
uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: clang liburing-dev
|
||||
version: 1.0
|
||||
|
||||
- name: Cache Rust registry
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/git
|
||||
!~/.cargo/git/checkouts
|
||||
~/.cargo/registry
|
||||
!~/.cargo/registry/src
|
||||
key: rust-registry-${{hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Run Clippy lints
|
||||
run: |
|
||||
cargo clippy \
|
||||
--workspace \
|
||||
--features full \
|
||||
--locked \
|
||||
--no-deps \
|
||||
--profile test \
|
||||
-- \
|
||||
-D warnings
|
||||
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SCCACHE_ENABLED: ${{ vars.GH_APP_ID != '' && secrets.GH_APP_PRIVATE_KEY != '' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- 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
|
||||
|
||||
# cache-apt-pkgs-action requires apt lists to be initialised first
|
||||
- name: Update APT package lists
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Cache system packages
|
||||
uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: clang liburing-dev
|
||||
version: 1.0
|
||||
|
||||
- name: Cache Rust registry
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/git
|
||||
!~/.cargo/git/checkouts
|
||||
~/.cargo/registry
|
||||
!~/.cargo/registry/src
|
||||
key: rust-registry-${{hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Create GitHub App token for sccache
|
||||
if: env.SCCACHE_ENABLED == 'true'
|
||||
uses: https://github.com/actions/create-github-app-token@v1
|
||||
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: Run Cargo tests
|
||||
run: |
|
||||
cargo test \
|
||||
--workspace \
|
||||
--features full \
|
||||
--locked \
|
||||
--profile test \
|
||||
--all-targets \
|
||||
--no-fail-fast
|
||||
|
||||
- name: Display sccache statistics
|
||||
if: always() && env.SCCACHE_ENABLED == 'true'
|
||||
run: sccache --show-stats
|
Loading…
Add table
Add a link
Reference in a new issue