Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/branding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Brand asset consistency

on:
push:
branches: [master]
paths:
- assets/branding/**
- tools/branding/**
Expand All @@ -17,6 +18,10 @@ on:
permissions:
contents: read

concurrency:
group: branding-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
exports:
runs-on: ubuntu-latest
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/ci-scope.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI scope

on:
workflow_call:
outputs:
native:
value: ${{ jobs.scope.outputs.native }}
packages:
value: ${{ jobs.scope.outputs.packages }}

permissions:
contents: read

jobs:
scope:
runs-on: ubuntu-latest
outputs:
native: ${{ steps.scope.outputs.native }}
packages: ${{ steps.scope.outputs.packages }}
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
fetch-depth: 2
- name: Choose checks for this change
id: scope
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
if [[ "$EVENT_NAME" == pull_request ]]; then
git diff --name-only -z "$BASE_SHA" HEAD | python3 scripts/ci-scope.py >> "$GITHUB_OUTPUT"
else
printf 'native=true\npackages=true\n' >> "$GITHUB_OUTPUT"
fi
60 changes: 44 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ name: CI
on:
workflow_call:
push:
branches: [master]
pull_request:

permissions:
contents: read

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
scope:
uses: ./.github/workflows/ci-scope.yml

omarchy-plugin:
needs: scope
if: needs.scope.outputs.native != 'false'
name: Omarchy plugin export
runs-on: ubuntu-latest
timeout-minutes: 5
Expand All @@ -30,6 +40,8 @@ jobs:
if-no-files-found: error

macos-installation:
needs: scope
if: needs.scope.outputs.native != 'false'
name: macOS lifecycle (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
Expand Down Expand Up @@ -71,6 +83,8 @@ jobs:
fi

powershell:
needs: scope
if: needs.scope.outputs.native != 'false'
name: PowerShell syntax
runs-on: windows-latest
steps:
Expand All @@ -87,39 +101,55 @@ jobs:
}

check:
needs: scope
if: ${{ !cancelled() }}
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
# Keep required names without queueing a macOS VM for prose/website edits.
runs-on: ${{ needs.scope.outputs.native == 'false' && 'ubuntu-latest' || matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- name: Require successful scope detection
env:
SCOPE_RESULT: ${{ needs.scope.result }}
run: test "$SCOPE_RESULT" = success
- uses: actions/checkout@v5
if: matrix.os == 'ubuntu-latest' || needs.scope.outputs.native == 'true'
- name: Install shell linter
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y shellcheck
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev shellcheck
if: matrix.os == 'ubuntu-latest' && needs.scope.outputs.native == 'true'
run: sudo apt-get install -y libasound2-dev
- name: Install Rust components
if: matrix.os == 'ubuntu-latest' || needs.scope.outputs.native == 'true'
run: rustup component add clippy rustfmt
- name: Check formatting
if: matrix.os == 'ubuntu-latest'
run: cargo fmt --check
- name: Check documentation
run: python3 scripts/check-docs.py
if: matrix.os == 'ubuntu-latest'
run: |
python3 scripts/check-docs.py
python3 -B -m unittest scripts/test_check_docs.py scripts/test_ci_scope.py
- name: Check Linux installer lifecycle
if: runner.os == 'Linux'
if: matrix.os == 'ubuntu-latest'
run: python3 -B -m unittest scripts/test_install_lifecycle.py
- name: Check shell scripts
if: runner.os == 'Linux'
if: matrix.os == 'ubuntu-latest'
run: |
for script in scripts/*.sh packaging/omarchy-bar/*.sh; do bash -n "$script"; done
shellcheck scripts/*.sh packaging/omarchy-bar/*.sh
- name: Check macOS menu bar helper
if: runner.os == 'macOS'
if: matrix.os == 'macos-latest' && needs.scope.outputs.native == 'true'
run: |
swiftc packaging/macos/KlickyMenu.swift -o /tmp/klicky-menu-check
python3 -B scripts/test-macos-menu.py
- name: Check GitHub Actions workflows
if: runner.os == 'Linux'
if: matrix.os == 'ubuntu-latest'
run: |
curl -fsSLo /tmp/actionlint.tar.gz \
https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz
Expand All @@ -128,16 +158,14 @@ jobs:
'/tmp/actionlint.tar.gz' | sha256sum --check
tar -xzf /tmp/actionlint.tar.gz -C /tmp actionlint
/tmp/actionlint -ignore 'SC2016:'
- name: Check
run: cargo check --all-targets
- name: Test
run: cargo test
if: needs.scope.outputs.native == 'true'
run: cargo test --locked
- name: Lint
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build release
run: cargo build --release
if: needs.scope.outputs.native == 'true'
run: cargo clippy --locked --all-targets --all-features -- -D warnings
- name: Check systemd unit
if: runner.os == 'Linux'
if: matrix.os == 'ubuntu-latest' && needs.scope.outputs.native == 'true'
run: |
install -Dm755 target/release/klicky "$HOME/.local/bin/klicky"
install -Dm755 target/debug/klicky "$HOME/.local/bin/klicky"
systemd-analyze --user verify packaging/systemd/klicky.service
4 changes: 3 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ name: CodeQL advanced

on:
pull_request:
paths-ignore: ['**.md']
push:
branches: [master]
paths-ignore: ['**.md']
schedule:
- cron: '17 3 * * 2'
workflow_dispatch:
Expand Down Expand Up @@ -60,7 +62,7 @@ jobs:
with:
category: /language:${{ matrix.language }}
output: ${{ runner.temp }}/codeql-results
# Default setup stays active until the reviewed migration is ready.
# Disable uploads before restoring default setup during a rollback.
upload: ${{ vars.CODEQL_ADVANCED_ENABLED == 'true' && 'always' || 'never' }}
upload-database: false
- name: Verify the Swift helper was extracted
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,29 @@ name: Packages
on:
workflow_call:
push:
branches: [master]
pull_request:

permissions:
contents: read

concurrency:
group: packages-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
scope:
uses: ./.github/workflows/ci-scope.yml

debian-package:
needs: scope
if: ${{ !cancelled() && needs.scope.outputs.packages != 'false' }}
runs-on: ubuntu-latest
steps:
- name: Require successful scope detection
env:
SCOPE_RESULT: ${{ needs.scope.result }}
run: test "$SCOPE_RESULT" = success
- uses: actions/checkout@v5
- name: Install dependencies
run: |
Expand Down Expand Up @@ -44,9 +58,14 @@ jobs:
retention-days: 14

apt-repository:
needs: debian-package
needs: [scope, debian-package]
if: ${{ !cancelled() && needs.scope.outputs.packages != 'false' }}
runs-on: ubuntu-latest
steps:
- name: Require successful package build
env:
PACKAGE_RESULT: ${{ needs.debian-package.result }}
run: test "$PACKAGE_RESULT" = success
- uses: actions/checkout@v5
- uses: actions/download-artifact@v5
with:
Expand All @@ -65,11 +84,17 @@ jobs:
--exercise-history-retention "$package"

arch-package:
needs: scope
if: ${{ !cancelled() && needs.scope.outputs.packages != 'false' }}
runs-on: ubuntu-latest
container: archlinux:latest
env:
SOURCE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: Require successful scope detection
env:
SCOPE_RESULT: ${{ needs.scope.result }}
run: test "$SCOPE_RESULT" = success
- name: Install dependencies
run: pacman -Syu --noconfirm base-devel git rust alsa-lib systemd namcap python
- uses: actions/checkout@v5
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/windows-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Windows portable core
on:
workflow_call:
push:
branches: [master]
paths:
- src/**
- tests/**
Expand All @@ -24,21 +25,19 @@ on:
permissions:
contents: read

concurrency:
group: windows-core-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
check:
name: windows-core
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- name: Install declared minimum Rust
run: rustup toolchain install 1.87.0 --profile minimal --component rustfmt --component clippy
- name: Check formatting
run: cargo +1.87.0 fmt --check
- name: Check compilation
run: cargo +1.87.0 check --locked --all-targets
run: rustup toolchain install 1.87.0 --profile minimal --component clippy
- name: Test portable code
run: cargo +1.87.0 test --locked
- name: Lint
run: cargo +1.87.0 clippy --locked --all-targets --all-features -- -D warnings
- name: Build development targets
run: cargo +1.87.0 build --locked --release
5 changes: 5 additions & 0 deletions .github/workflows/windows-portable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Windows packages
on:
workflow_call:
push:
branches: [master]
paths:
- src/**
- sounds/**
Expand Down Expand Up @@ -44,6 +45,10 @@ on:
permissions:
contents: read

concurrency:
group: windows-portable-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
bundle:
runs-on: windows-latest
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/windows-qualification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Windows qualification tooling

on:
push:
branches: [master]
paths:
- tools/windows-qualification/**
- src/player.rs
Expand All @@ -19,6 +20,10 @@ on:
permissions:
contents: read

concurrency:
group: windows-qualification-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
check:
strategy:
Expand All @@ -39,8 +44,6 @@ jobs:
run: rustup toolchain install 1.87.0 --profile minimal --component rustfmt --component clippy
- name: Check formatting
run: cargo +1.87.0 fmt --manifest-path tools/windows-qualification/Cargo.toml --check
- name: Check compilation
run: cargo +1.87.0 check --locked --all-targets --manifest-path tools/windows-qualification/Cargo.toml
- name: Lint
run: cargo +1.87.0 clippy --locked --all-targets --manifest-path tools/windows-qualification/Cargo.toml -- -D warnings
- name: Build qualification executable
Expand Down
21 changes: 16 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,28 @@ Write tests for behavior that can regress:

Do not add tests for trivial delegation or compiler-enforced properties. Hardware behavior needs a real device test and a written environment description.

Run before every pull request:
For Rust changes, run:

```bash
cargo fmt --check
cargo check --all-targets
cargo test
cargo clippy --all-targets --all-features -- -D warnings
cargo test --locked
cargo clippy --locked --all-targets --all-features -- -D warnings
PYTHONUTF8=1 python3 -B scripts/check-docs.py
cargo build --release
```

Clippy includes compilation checks. Run `cargo build --release` when changing
build behavior or preparing a package; package CI also builds release binaries.
For prose-only edits, the documentation check is sufficient locally.

PR validation runs once per commit, with superseded runs cancelled. Markdown-only
PRs keep the fast documentation, formatting and script checks, without rebuilding
native apps and packages. Website changes retain package/APT validation. Unknown
files and workflow changes use full checks; `master` and release candidates always
run the full native and package suite. Required check names remain available even
when their expensive work is unnecessary; the macOS check reports from a small
Linux job for prose/website edits. A failed scope check fails the required
checks rather than silently accepting the change.

For APT changes, run `python3 -B -m unittest scripts/test_apt_repository.py` and, on Linux with GnuPG and reprepro, `python3 -B scripts/test_apt_repository_integration.py PACKAGE.deb`. See [APT validation coverage](docs/MAINTAINING_APT.md#validation-coverage) for what these checks establish. For website changes, follow the [website checks](docs/WEBSITE.md#preview-and-validate). In PowerShell, set `$env:PYTHONUTF8 = '1'` before running Python.

## macOS menu checks
Expand Down
Loading
Loading