krz/orgo

Lightning fast org-mode static site generator.

clone: git clone https://gitbay.org/krz/orgo.git

v0.20.1: .github/workflows/ci.yml · raw

  1name: CI
  2
  3# Build, test and lint on both platforms orgo is used from, plus a compiler-floor job.
  4#
  5# WHAT THIS CATCHES THAT LOCAL WORK DOES NOT:
  6#
  7#   1. Linux. Development happens on macOS, and the two differ where this project is most
  8#      likely to break: filesystem event paths (the watcher had a real `/var` vs
  9#      `/private/var` bug on macOS), case-insensitive filenames, and path separators.
 10#   2. A clean checkout. The oracle tests skip when Emacs is absent and the cache is
 11#      gitignored, so a machine that has been building all afternoon is not a fair test of
 12#      what a fresh clone does.
 13#   3. The MSRV. A stabilised API used without noticing is invisible on a current
 14#      toolchain and is a build failure for anyone on a distribution compiler.
 15#
 16# NOT GATED ON `cargo fmt`. The source is formatted by hand — comment tables, aligned
 17# match arms, and prose wrapped to fit the argument being made — and rustfmt disagrees
 18# with most of it. Clippy is the lint that catches defects; fmt would only catch taste.
 19
 20on:
 21  push:
 22    branches: [main]
 23  pull_request:
 24  workflow_dispatch:
 25
 26env:
 27  CARGO_TERM_COLOR: always
 28  # A failing build should print the error, not a backtrace-shaped wall.
 29  RUST_BACKTRACE: 1
 30
 31jobs:
 32  test:
 33    name: test (${{ matrix.os }})
 34    runs-on: ${{ matrix.os }}
 35    strategy:
 36      # Both platforms report, so a macOS-only failure is distinguishable from a real one.
 37      fail-fast: false
 38      matrix:
 39        os: [ubuntu-latest, macos-latest]
 40    steps:
 41      - name: Checkout
 42        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
 43
 44      - name: Install Rust
 45        uses: dtolnay/rust-toolchain@1ff72ee08e3cb84d84adba594e0a297990fc1ed3 # stable
 46        with:
 47          toolchain: stable
 48          components: clippy
 49
 50      - name: Cache cargo
 51        uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
 52
 53      # Emacs makes the oracle suite run for real instead of skipping. It is the only
 54      # reason to trust that output still matches org's own exporter, so it is worth the
 55      # install minute.
 56      - name: Install Emacs (Linux)
 57        if: runner.os == 'Linux'
 58        run: sudo apt-get update && sudo apt-get install -y --no-install-recommends emacs-nox
 59
 60      - name: Install Emacs (macOS)
 61        if: runner.os == 'macOS'
 62        run: brew install emacs
 63
 64      - name: Build
 65        run: cargo build --all-targets --locked
 66
 67      - name: Test
 68        run: cargo test --locked
 69
 70      - name: Clippy
 71        run: cargo clippy --all-targets --locked -- -D warnings
 72
 73      # `cargo package` builds the crate exactly as crates.io will receive it, which is
 74      # how an `exclude` that drops a file the tests need, or a `readme` pointing at a
 75      # file that was renamed, gets caught here rather than during a release.
 76      - name: Package
 77        if: runner.os == 'Linux'
 78        run: cargo package --locked
 79
 80      # The documentation site is built by the tool it documents, so a docs page that no
 81      # longer builds is a product defect. `--strict` fails on broken internal links,
 82      # which is the failure mode a docs site actually has.
 83      - name: Build the documentation site
 84        run: cargo run --locked -- build docs -o docs/_site --strict
 85
 86  msrv:
 87    name: minimum supported Rust (1.88)
 88    runs-on: ubuntu-latest
 89    steps:
 90      - name: Checkout
 91        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
 92
 93      # Pinned to the version in Cargo.toml's `rust-version`. When that moves, this moves
 94      # with it in the same commit — a floor nobody checks is a floor nobody has.
 95      - name: Install Rust 1.88
 96        uses: dtolnay/rust-toolchain@1ff72ee08e3cb84d84adba594e0a297990fc1ed3 # stable
 97        with:
 98          toolchain: "1.88"
 99
100      - name: Cache cargo
101        uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
102
103      # Build only. The tests pull in dev-dependencies whose own floors move
104      # independently, and chasing those would make this job about someone else's MSRV.
105      #
106      # The floor is set by dependencies rather than by orgo — its own code compiles on
107      # 1.82 — which is precisely why it is checked here instead of reasoned about: a
108      # dependency raising its floor is invisible until someone on an older compiler
109      # tries to build.
110      - name: Build
111        run: cargo build --locked