Skip to content

[INTT-39] feat: dart workflow#18

Open
td-famedly wants to merge 3 commits into
tlater/incrementalfrom
td/workflows
Open

[INTT-39] feat: dart workflow#18
td-famedly wants to merge 3 commits into
tlater/incrementalfrom
td/workflows

Conversation

@td-famedly

Copy link
Copy Markdown
Member

No description provided.

… move actions to running inside nix, this right now just generates the github workflow
@td-famedly td-famedly changed the title chore: workflows feat: workflows Jun 3, 2026

@tlater-famedly tlater-famedly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we should merge this as-is, let's wait for the generic prek hook at least and discuss the details I commented about.

perSystem =
{ config, ... }:
let
run-pre-commit = project: ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do the pre-commit as a different, generic workflow, and not inside the dart-specific workflow.

};

defaults.run.shell = "nu --no-config-file --no-history {0}";
env.DART_TERM_COLOR = "always";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually a thing (and necessary) or just halluci-copied from the rust workflow?

{ config, ... }:
let
run-pre-commit = project: ''
nix develop .#general --command sh -c ${lib.escapeShellArg "cd ${lib.escapeShellArg project} && prek run --all-files"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prek doesn't need project stuff, that's the entire point of using these workspaces, that should be removed. We shouldn't use a function for this at all.

dart = lib.getExe pkgs.dart;
grep = lib.getExe pkgs.gnugrep;

check-conventional-commits = pkgs.writeShellScript "check-conventional-commits" ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a general lint, not part of the dart pre-commit hooks.

Let's use a project like https://keisukeyamashita.github.io/commitlint-rs/ instead of a hand-rolled regex, too, or if we must write a shell script, use nushell.

dart-analyze = pkgs.writeShellScript "dart-analyze" ''
set -eu

if [ -f pubspec.yaml ] && ${grep} -Eq '^flutter:' pubspec.yaml; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need the complexity of testing for flutter vs dart projects? If we do, can we make this two separate lints instead, perhaps with an option defining which one should be used instead of doing this at runtime?

Comment on lines +40 to +46
${dart} format lib/ --set-exit-if-changed
"$command" pub get
"$command" analyze

if command -v dart_code_metrics >/dev/null 2>&1; then
dart_code_metrics analyze lib || true
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably be separate hooks, not a single one.

We should not do a check for the existence of software, and instead provide it via devshell/nix store paths.

@tlater-famedly tlater-famedly changed the title feat: workflows feat: dart workflow Jun 4, 2026
@tlater-famedly tlater-famedly changed the title feat: dart workflow [INTT-5] feat: dart workflow Jun 10, 2026
@tlater-famedly tlater-famedly changed the title [INTT-5] feat: dart workflow [INTT-39] feat: dart workflow Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants