Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: improve doc check #1454

Merged
merged 5 commits into from
Sep 18, 2024
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
35 changes: 22 additions & 13 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,14 @@ name: "Generate docs/examples"

on:
push:
branches:
- main
tags:
- v*
pull_request:

jobs:
generate-docs:
runs-on: ubuntu-latest

steps:
# Regular (non-PR) checkout
- uses: actions/checkout@v4
if: ${{ github.event_name == 'push' }}

# Checkout PRs (including from forks) to allow committing doc changes
- uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- uses: cachix/install-nix-action@V28
with:
Expand All @@ -35,6 +23,7 @@ jobs:
- name: Generate doc options
run: devenv shell devenv-generate-doc-options
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
add: docs/reference/options.md
Expand All @@ -43,6 +32,7 @@ jobs:
- name: Verify individual docs
run: devenv shell devenv-verify-individual-docs
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
message: 'Auto generate missing individual markdowns'
Expand All @@ -53,6 +43,7 @@ jobs:
devenv shell devenv-generate-languages-example
devenv shell devenv-generate-individual-docs
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
add: docs examples/supported-languages/devenv.nix
Expand All @@ -61,8 +52,26 @@ jobs:
- name: Generate JSON schema
run: devenv generate-json-schema
- uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
default_author: github_actions
add: docs/devenv.schema.json
message: 'Auto generate docs/devenv.schema.json'

- name: Check for uncommitted changes
run: |
diff=$(git diff --stat)
if [[ -n "$diff" ]]; then
message="There are uncommitted doc changes in the repository.

${diff}

To resolve this, you can:
a. Run the failing devenv-generate-* commands locally and commit the changes.
b. Let CI auto-commit the changes to your fork of the repo. You may need to enable this workflow on your fork."

echo "::error::${message//$'\n'/%0A}"
exit 1
else
echo "No uncommitted doc changes found."
fi
28 changes: 3 additions & 25 deletions docs/reference/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -35792,7 +35792,7 @@ path


*Default:*
` "/home/runner/work/devenv/devenv/.devenv/state/caddy" `
` "${config.env.DEVENV_STATE}/caddy" `

*Declared by:*
- [https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix)
Expand Down Expand Up @@ -40179,7 +40179,7 @@ package


*Default:*
` <derivation trafficserver-9.2.3> `
` pkgs.trafficserver `

*Declared by:*
- [https://github.com/cachix/devenv/blob/main/src/modules/services/trafficserver](https://github.com/cachix/devenv/blob/main/src/modules/services/trafficserver)
Expand Down Expand Up @@ -40508,28 +40508,6 @@ File layout used by Traffic Server
*Type:*
unspecified value *(read only)*



*Default:*

```
{
bindir = "/nix/store/p4vjvd38l79jsxzxlv9q2hbajm7g2js9-trafficserver-9.2.3/bin";
cachedir = "/home/runner/work/devenv/devenv/.devenv/state/trafficserver/cache";
datadir = "/home/runner/work/devenv/devenv/.devenv/state/trafficserver/share";
exec_prefix = "/home/runner/work/devenv/devenv/.devenv/state/trafficserver";
includedir = "/nix/store/p4vjvd38l79jsxzxlv9q2hbajm7g2js9-trafficserver-9.2.3/include";
libdir = "/nix/store/p4vjvd38l79jsxzxlv9q2hbajm7g2js9-trafficserver-9.2.3/lib";
libexecdir = "/nix/store/p4vjvd38l79jsxzxlv9q2hbajm7g2js9-trafficserver-9.2.3/libexec";
localstatedir = "/home/runner/work/devenv/devenv/.devenv/state/trafficserver/state";
logdir = "/home/runner/work/devenv/devenv/.devenv/state/trafficserver/log";
prefix = "/home/runner/work/devenv/devenv/.devenv/state/trafficserver";
runtimedir = "/run/user/1001/devenv-0957646/trafficserver";
sbindir = "/nix/store/p4vjvd38l79jsxzxlv9q2hbajm7g2js9-trafficserver-9.2.3/bin";
sysconfdir = <derivation trafficserver-config>;
}
```

*Declared by:*
- [https://github.com/cachix/devenv/blob/main/src/modules/services/trafficserver](https://github.com/cachix/devenv/blob/main/src/modules/services/trafficserver)

Expand Down Expand Up @@ -40656,7 +40634,7 @@ strings concatenated with “\\n”


*Default:*
` "/home/runner/work/devenv/devenv/.devenv/state/trafficserver/cache 256M" `
` "${config.services.traffic-server.runroot.cachedir} 256M" `



Expand Down
2 changes: 1 addition & 1 deletion docs/supported-services/caddy.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ path


*Default:*
` "/home/runner/work/devenv/devenv/.devenv/state/caddy" `
` "${config.env.DEVENV_STATE}/caddy" `



Expand Down
2 changes: 1 addition & 1 deletion src/modules/services/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ in

dataDir = mkOption {
default = "${config.env.DEVENV_STATE}/caddy";
defaultText = literalExpression ''"${config.env.DEVENV_STATE}/caddy"'';
defaultText = literalExpression "\"\${config.env.DEVENV_STATE}/caddy\"";
type = types.path;
description = ''
The data directory, for storing certificates. Before 17.09, this
Expand Down
5 changes: 4 additions & 1 deletion src/modules/services/trafficserver/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ in
package = lib.mkOption {
type = types.package;
default = pkgs.trafficserver;
defaultText = lib.literalExpression "pkgs.trafficserver";
description = "Apache Traffic Server package";
};

runroot = lib.mkOption {
readOnly = true;
default = runroot;
description = "File layout used by Traffic Server";
};

Expand Down Expand Up @@ -298,6 +298,7 @@ in
storage = lib.mkOption {
type = types.lines;
default = "${runroot.cachedir} 256M";
defaultText = lib.literalExpression "\"\${config.services.traffic-server.runroot.cachedir} 256M\"";
example = "/dev/disk/by-id/XXXXX volume=1";
description = ''
List all the storage that make up the Traffic Server cache.
Expand Down Expand Up @@ -358,5 +359,7 @@ in

services.trafficserver.records.proxy.config.body_factory.template_sets_dir =
lib.mkDefault "${cfg.package}/etc/trafficserver/body_factory";

services.trafficserver.runroot = runroot;
};
}