Skip to content

Lint

Lint #23

Workflow file for this run

name: Lint
on:
push:
branches: [main]
pull_request:
schedule:
# Weekly full link sweep on Sunday 06:00 UTC. Pull-requests still run
# link-check in modified-only mode so they stay fast.
- cron: '0 6 * * 0'
permissions:
contents: read
concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: true
jobs:
shellcheck:
name: shellcheck + bash -n
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: |
sudo apt-get update -qq
sudo apt-get install -y shellcheck
- name: bash -n syntax pre-check on every .sh
run: |
set -e
# Syntax-check every tracked shell script, including extensionless
# helpers in bin/.
# Fails fast so the more expensive shellcheck only runs if
# the scripts parse at all.
while IFS= read -r -d '' f; do
echo "bash -n $f"
bash -n "$f"
done < <(
for f in $(git ls-files); do
[ -f "$f" ] || continue
case "$f" in
*.sh) printf '%s\0' "$f" ;;
*) head -n 1 "$f" | grep -Eq '^#!.*(ba)?sh' && printf '%s\0' "$f" || true ;;
esac
done
)
- name: shellcheck (warning severity)
run: |
# SC1090 (can't follow non-constant source), SC2034 (unused var
# exported for sibling scripts), SC2155 (declare and assign on
# one line) are noisy in this codebase and intentional.
mapfile -d '' shell_files < <(
for f in $(git ls-files); do
[ -f "$f" ] || continue
case "$f" in
*.sh) printf '%s\0' "$f" ;;
*) head -n 1 "$f" | grep -Eq '^#!.*(ba)?sh' && printf '%s\0' "$f" || true ;;
esac
done
)
shellcheck -S warning \
-e SC1090,SC2034,SC2155 \
"${shell_files[@]}"
rust:
name: rust fmt + clippy + unit tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y libwayland-dev libx11-dev libdbus-1-dev pkg-config libcairo2-dev libglib2.0-dev libpango1.0-dev
- name: Cache cargo registry + target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
rs/target
key: ${{ runner.os }}-cargo-${{ hashFiles('rs/Cargo.lock', 'rs/Cargo.toml', 'rs/**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: cargo fmt
run: cargo fmt --manifest-path rs/Cargo.toml --all --check
- name: cargo clippy
run: cargo clippy --release --locked --manifest-path rs/Cargo.toml -- -D warnings
- name: cargo clippy overlay wayland
run: cargo clippy --release --locked --manifest-path rs/Cargo.toml -p flashpaste-overlayd --features wayland -- -D warnings
- name: cargo unit tests
run: cargo test --locked --manifest-path rs/Cargo.toml --workspace --lib --bins
package-smoke:
name: package smoke
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install package build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y dpkg-dev libwayland-dev libx11-dev libdbus-1-dev pkg-config libcairo2-dev libglib2.0-dev libpango1.0-dev
- name: Cache cargo registry + target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
rs/target
key: ${{ runner.os }}-cargo-${{ hashFiles('rs/Cargo.lock', 'rs/Cargo.toml', 'rs/**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build Rust workspace
run: cargo build --release --locked --manifest-path rs/Cargo.toml
- name: Build overlay daemon
run: cargo build --release --locked --manifest-path rs/Cargo.toml -p flashpaste-overlayd --features wayland
- name: Build .deb
run: VERSION=0.0.0 bash packaging/build-deb.sh
- name: Install package in Ubuntu container
run: bash packaging/package-smoke.sh
markdown-lint:
name: markdownlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run markdownlint-cli2
uses: DavidAnson/markdownlint-cli2-action@v18
with:
globs: '**/*.md'
config: '.markdownlint.json'
link-check:
name: markdown link-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check links in markdown
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'no'
config-file: '.github/markdown-link-check-config.json'
# Full sweep on push/schedule, modified-only on pull requests so
# PR feedback stays fast.
check-modified-files-only: ${{ github.event_name == 'pull_request' && 'yes' || 'no' }}
base-branch: 'main'