Skip to content

Commit 006095c

Browse files
committed
ci: adopt task-first ci module and x shared toolchains
Replace the bespoke Dagger-first flow (which pinned now-removed x go, prettier, cosign, and syft toolchains) with x's task-first pattern. - Move toolchains/kclipper to ci; rename the module to Ci (dagger/ci) and register it in the root dagger.json alongside the remote devbox and commitlint toolchains. - Pin the remaining remote x toolchains (devbox, goreleaser, security, zizmor) to 8990610a338bb60f9aa8708d5fa89e1c3c6725dc. cosign and syft are now folded into goreleaser; EnsureGitRepo and VerifyBinaryPlatform are methods on it. - Run go build/test/lint/format locally via devbox; the ci module reproduces them with task targets inside the devbox toolchain container. Tests build with cgo and the netgo tag. - Preserve the full release pipeline: cgo + Zig cross-compile, KCL language-server bundling, macOS SDK via Nix, macOS notarization, and KCL module publishing. - Restructure .taskfiles local-first and point CI workflows at the ci toolchain.
1 parent ef39b73 commit 006095c

42 files changed

Lines changed: 1170 additions & 1023 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.commitlintrc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ rules:
2020
scope-enum:
2121
- 2
2222
- always
23-
- - cli
23+
- - ci
24+
- cli
2425
- deps
2526
- modules
2627
- plugin

.github/renovate.json5

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,29 @@
2525
matchStringsStrategy: "recursive",
2626
datasourceTemplate: "helm",
2727
},
28+
// Tool and image versions pinned as Go constants in the ci module,
29+
// annotated with `// renovate:` comments, e.g.:
30+
// renovateVersion = "43.224.0" // renovate: datasource=npm depName=renovate
31+
// nixImage = "ghcr.io/nixos/nix:2.34.7" // renovate: datasource=docker depName=ghcr.io/nixos/nix
32+
// For image references, the version is the tag after the last colon.
2833
{
2934
customType: "regex",
30-
managerFilePatterns: ["/toolchains/.+/main\\.go$/"],
35+
managerFilePatterns: ["/^ci/.+\\.go$/"],
3136
matchStrings: [
32-
// The optional non-captured prefix strips the image name from full
33-
// refs (e.g. "ghcr.io/nixos/nix:2.32.8"), leaving only the tag as
34-
// currentValue.
35-
'\\w+\\s*=\\s*"(?:[^"]*:)?(?<currentValue>[^":]+)"\\s*//\\s*renovate:\\s*datasource=(?<datasource>[^\\s]+)\\s+depName=(?<depName>[^\\s]+)(?:\\s+extractVersion=(?<extractVersion>[^\\s]+))?',
37+
'"(?:[^"]*:)?(?<currentValue>[^":]+)"\\s*// renovate: datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)',
3638
],
39+
versioningTemplate: "{{#if (equals datasource 'docker')}}docker{{else}}semver-coerced{{/if}}",
40+
},
41+
// Tool versions pinned in Taskfiles as `<value> # renovate:` annotations.
42+
// (devbox.json tool versions are handled by Renovate's built-in devbox
43+
// manager, so they need no customManager here.)
44+
{
45+
customType: "regex",
46+
managerFilePatterns: ["/(^|/)Taskfile\\.yaml$/", "/(^|/)\\.taskfiles/.+\\.yaml$/"],
47+
matchStrings: [
48+
'(?<currentValue>v?[0-9][^\\s#"]*)\\s*#\\s*renovate: datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)',
49+
],
50+
versioningTemplate: "{{#if (equals datasource 'docker')}}docker{{else}}semver-coerced{{/if}}",
3751
},
3852
],
3953
packageRules: [

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ jobs:
3232
uses: dagger/dagger-for-github@v8.4.1
3333
with:
3434
version: "v0.21.4"
35-
call: kclipper build --output=./dist
35+
call: ci build --output=./dist
3636
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
3737
enable-github-summary: "true"

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
with:
6464
version: "v0.21.4"
6565
call: >-
66-
kclipper release
66+
ci release
6767
--github-token=env://GITHUB_TOKEN
6868
--registry-username="${{ github.actor }}"
6969
--registry-password=env://REGISTRY_PASSWORD
@@ -127,7 +127,7 @@ jobs:
127127
with:
128128
version: "v0.21.4"
129129
call: >-
130-
kclipper publish-kclmodules
130+
ci publish-kclmodules
131131
--tag="${{ steps.tag.outputs.value }}"
132132
--registry-username="${{ github.actor }}"
133133
--registry-password=env://REGISTRY_PASSWORD

.github/workflows/renovate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ env:
3434
LOG_LEVEL: "${{ inputs.logLevel || 'info' }}"
3535
RENOVATE_AUTODISCOVER: true
3636
RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}"
37-
RENOVATE_DRY_RUN: "${{ inputs.dryRun == true }}"
37+
RENOVATE_DRY_RUN: "${{ inputs.dryRun == 'true' }}"
3838
RENOVATE_PLATFORM: github
3939
RENOVATE_PLATFORM_COMMIT: true
4040
RENOVATE_ALLOWED_COMMANDS: '["^kcl .+$"]'

.github/workflows/validate.yaml

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,74 @@ permissions:
1515

1616
jobs:
1717
check:
18-
name: check
18+
name: check (${{ matrix.task }})
1919
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
# Each entry is a function on the `ci` toolchain. lint and test run the
24+
# matching Taskfile target inside the devbox environment
25+
# (dagger -> devbox -> task); the rest compose a toolchain or Node
26+
# container directly: security (Trivy via the security toolchain),
27+
# lint-actions (zizmor via the zizmor toolchain), lint-renovate
28+
# (renovate-config-validator in a Node container), and lint-releaser /
29+
# lint-kclmodules (goreleaser/kcl). Mirrors the gates developers run via
30+
# `task check:all`.
31+
task:
32+
- lint
33+
- test
34+
- security
35+
- lint-actions
36+
- lint-renovate
37+
- lint-releaser
38+
- lint-kclmodules
2039
steps:
2140
- name: Checkout
2241
uses: actions/checkout@v6
2342
with:
2443
persist-credentials: false
25-
fetch-depth: 2
2644

27-
- name: Run all checks (lint + generator freshness in parallel)
45+
- name: Run ci ${{ matrix.task }}
46+
uses: dagger/dagger-for-github@v8.4.1
47+
with:
48+
version: "v0.21.4"
49+
call: ci ${{ matrix.task }}
50+
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
51+
enable-github-summary: "true"
52+
53+
toolchains:
54+
name: toolchains
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v6
59+
with:
60+
persist-credentials: false
61+
62+
- name: Run ci toolchain tests
2863
uses: dagger/dagger-for-github@v8.4.1
2964
with:
3065
version: "v0.21.4"
3166
verb: check
32-
args: go:lint kclipper:lint-prettier kclipper:lint-actions kclipper:lint-releaser kclipper:lint-kclmodules go:generate go:tidy
67+
args: -m ci/tests
3368
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
3469
enable-github-summary: "true"
3570

71+
coverage:
72+
name: coverage
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v6
77+
with:
78+
persist-credentials: false
79+
3680
- name: Export coverage profile
3781
if: ${{ !cancelled() }}
3882
uses: dagger/dagger-for-github@v8.4.1
3983
with:
4084
version: "v0.21.4"
41-
call: go test-coverage --output=coverage.txt
85+
call: ci test-coverage --output=coverage.txt
4286
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
4387
enable-github-summary: "true"
4488

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ dist/
2626

2727
# Devbox environment
2828
.devbox/
29+
30+
# Worktrees
31+
.worktrees/
32+
33+
# SARIF scan output (from `task security:sarif-source` / `sarif-image`)
34+
*.sarif

.lefthook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pre-commit:
44
commands:
55
check:
6-
run: devbox run -- dagger check
6+
run: devbox run -- task check
77

88
commit-msg:
99
commands:

.taskfiles/fmt/Taskfile.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,35 @@ version: "3"
33
set: [errexit, nounset, pipefail]
44
shopt: [globstar]
55

6+
# Prettier checks and formats YAML, JSON, and Markdown; devbox provides it on
7+
# PATH (it bundles its own Node runtime). Patterns are quoted so prettier does
8+
# its own globbing; .prettierignore excludes dagger.json files, testdata, and
9+
# the Helm chart templates (which contain Go template syntax, not valid YAML).
10+
vars:
11+
PRETTIER_CONFIG: ./.prettierrc.yaml
12+
PRETTIER_PATTERNS: '"*.yaml" "*.md" "*.json" "**/*.yaml" "**/*.md" "**/*.json"'
13+
14+
# `sources` lets Task skip prettier entirely when no formattable file changed.
15+
# The globs mirror PRETTIER_PATTERNS, and the `exclude:` entries mirror
16+
# .prettierignore (which Task does not read); .prettierignore and the config
17+
# itself are sources too, so editing either re-runs prettier. `exclude:` must
18+
# follow the positive globs it negates.
619
tasks:
7-
# The kclipper toolchain exposes a single format function covering both
8-
# Go and prettier targets; there is no standalone prettier module at the
9-
# repo root, so format here applies both.
10-
format:
11-
desc: Formats Go, YAML, JSON, and Markdown files via Dagger
20+
lint:
21+
desc: Lints YAML, JSON, and Markdown formatting with prettier
22+
sources: &prettier-sources
23+
- "**/*.yaml"
24+
- "**/*.md"
25+
- "**/*.json"
26+
- .prettierignore
27+
- exclude: "**/dagger.json"
28+
- exclude: "**/testdata/**"
29+
- exclude: "**/templates/**"
1230
cmds:
13-
- dagger call -y kclipper format
31+
- prettier --config {{.PRETTIER_CONFIG}} --check {{.PRETTIER_PATTERNS}}
1432

15-
lint:
16-
desc: Lints YAML, JSON, and Markdown files via Dagger
33+
format:
34+
desc: Formats YAML, JSON, and Markdown with prettier
35+
sources: *prettier-sources
1736
cmds:
18-
- dagger check kclipper:lint-prettier
37+
- prettier --config {{.PRETTIER_CONFIG}} -w {{.PRETTIER_PATTERNS}}

.taskfiles/gh/Taskfile.yaml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,41 @@ version: "3"
33
set: [errexit, nounset, pipefail]
44
shopt: [globstar]
55

6+
# GitHub configuration linting. Both checks run through Dagger via the `ci`
7+
# toolchain: Actions workflows through the zizmor toolchain, the Renovate config
8+
# through a pinned renovate-config-validator in a Node container. Neither tool is
9+
# on the devbox PATH.
610
tasks:
7-
lint:
8-
desc: Lints GitHub Actions workflows via Dagger
11+
actions:lint:
12+
desc: Lints GitHub Actions workflows with zizmor
13+
summary: |
14+
Linting runs zizmor via the `ci` toolchain's zizmor toolchain dependency,
15+
against .github/workflows with .github/zizmor.yaml. It runs through Dagger
16+
because zizmor is not on the devbox PATH.
17+
# `sources` skips the Dagger invocation when no workflow or zizmor config
18+
# changed. A zizmor version bump (pinned in the `ci` module) is not tracked
19+
# here; re-run with --force or `task clean` after upgrading the toolchain.
20+
sources:
21+
- .github/workflows/*.yaml
22+
- .github/workflows/*.yml
23+
- .github/zizmor.yaml
24+
cmds:
25+
- dagger call ci lint-actions
26+
27+
renovate:lint:
28+
desc: Validates the Renovate configuration with renovate-config-validator
29+
summary: |
30+
Validation runs renovate-config-validator at a pinned version in a Node
31+
container via the `ci` toolchain. It runs through Dagger because neither
32+
devbox nor a shared toolchain provides the validator.
33+
# `sources` skips the Dagger invocation when the Renovate config is
34+
# unchanged. The validator version is pinned in the `ci` module and is not
35+
# tracked here; re-run with --force or `task clean` after upgrading it.
36+
sources:
37+
- .github/renovate.json5
938
cmds:
10-
- dagger check kclipper:lint-actions
39+
- dagger call ci lint-renovate
40+
41+
lint:
42+
desc: Lints GitHub configuration (Actions workflows + Renovate config)
43+
deps: [actions:lint, renovate:lint]

0 commit comments

Comments
 (0)