From 3a20a60823a13b8e20e9b2588cae4b0922f57aa6 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Tue, 27 Oct 2026 09:17:51 -0700 Subject: [PATCH] ci(github): check with nix on every push `ci.yaml` runs two jobs on GitHub-hosted runners, gated on the repository name so that forks do not run them. `cargo-deny` checks licenses, advisories and sources. `lint` runs `nix flake check`, which builds every check of the flake, and the repository's own macro rules from the justfile. The triggers are the ones komorebi for Mac uses: pull requests, pushes to master, feature and hotfix branches, version tags, a weekly schedule and a manual run. The Nix store is cached with cache-nix-action, which needs no account. komorebi follows the tip of nixpkgs-unstable, so `flake.lock` moves, and KWin with it. `update-flake-lock.yaml` opens a pull request each week with the title `chore(deps): flake.lock: Update`; the same jobs run on it, which is what says whether the new KWin still works. Dependabot keeps the actions and the crates up to date, and the pull request template carries over from komorebi for Mac. CONTRIBUTING.md describes what CI runs. --- .github/dependabot.yml | 21 +++++++++++ .github/pull_request_template.md | 7 ++++ .github/workflows/ci.yaml | 46 ++++++++++++++++++++++++ .github/workflows/update-flake-lock.yaml | 25 +++++++++++++ CONTRIBUTING.md | 9 +++++ 5 files changed, 108 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/update-flake-lock.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..92e09e76 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + assignees: + - "LGUG2Z" + commit-message: + prefix: chore + include: scope + + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "weekly" + assignees: + - "LGUG2Z" + commit-message: + prefix: chore + include: scope \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..5059bfde --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,7 @@ + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..b84c775b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,46 @@ +# Every job is gated on the repository, so that a fork does not run them on its own runners. + +name: ci + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - feature/* + - hotfix/* + tags: + - v* + schedule: + - cron: "30 0 * * 0" # Every Sunday at 00:30 UTC + workflow_dispatch: + +jobs: + cargo-deny: + if: github.repository == 'LGUG2Z/komorebi-for-kde' + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: EmbarkStudios/cargo-deny-action@v2 + + # Everything that does not need a virtual machine: the formatting, clippy, rustdoc and the tests, + # as derivations. The jobs that boot KWin are separate. + lint: + if: github.repository == 'LGUG2Z/komorebi-for-kde' + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: cachix/install-nix-action@v31 + - uses: nix-community/cache-nix-action@v7 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', '**/Cargo.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + gc-max-store-size-linux: 8G + - run: nix flake check -L + - run: nix develop --command just lint diff --git a/.github/workflows/update-flake-lock.yaml b/.github/workflows/update-flake-lock.yaml new file mode 100644 index 00000000..8507438e --- /dev/null +++ b/.github/workflows/update-flake-lock.yaml @@ -0,0 +1,25 @@ +# komorebi tracks the tip of nixpkgs-unstable, so the lock moves every week. The pull request runs +# the same jobs as any other, which is what says whether the new KWin still works. + +name: update-flake-lock + +on: + schedule: + - cron: "0 3 * * 1" # Every Monday at 03:00 UTC + workflow_dispatch: + +jobs: + update: + if: github.repository == 'LGUG2Z/komorebi-for-kde' + runs-on: ubuntu-24.04 + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v7 + - uses: cachix/install-nix-action@v31 + - uses: DeterminateSystems/update-flake-lock@v29 + with: + commit-msg: "chore(deps): flake.lock: Update" + pr-title: "chore(deps): flake.lock: Update" + pr-assignees: LGUG2Z diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7574fec0..2b129d43 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,6 +42,15 @@ warnings denied. `just fmt` formats the Rust sources, and `nix fmt` every file type the repository has. `nix flake check` is what CI runs; it builds the same checks, plus `cargo deny`, as derivations. +## Continuous integration + +[`ci.yaml`](.github/workflows/ci.yaml) runs on every pull request and on every +push to `master`, `feature/*` and `hotfix/*`, in this repository only. The +`lint` job runs `nix flake check` and the repository's own lint rules, and +`cargo-deny` checks licenses and advisories. A weekly +[workflow](.github/workflows/update-flake-lock.yaml) opens a pull request that +moves `flake.lock`, and the same jobs run on it. + ## Commits Commit messages follow the