diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index e8678aca..89cb8d3d 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -75,9 +75,7 @@ jobs: cancel-in-progress: ${{ github.event_name == 'pull_request' }} needs: [get-meta, minimize-old-comments] if: >- - (! failure()) && - ((github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-staging')) || - (github.event_name != 'pull_request')) + (! failure()) && ((github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-staging')) || (github.event_name != 'pull_request')) runs-on: ubuntu-24.04 timeout-minutes: 60 steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0ba1fdec..dbdacd4d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,3 +27,14 @@ jobs: . .github .vscode + + yamlfmt: + timeout-minutes: 15 + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + - name: Install yamlfmt + run: go install github.com/google/yamlfmt/cmd/yamlfmt@v0.12.1 # TODO: Apply selfup after https://github.com/google/yamlfmt/pull/180 + - run: yamlfmt -lint . diff --git a/.github/workflows/merge-bot-pr.yml b/.github/workflows/merge-bot-pr.yml index ad9b3a08..4b9a322b 100644 --- a/.github/workflows/merge-bot-pr.yml +++ b/.github/workflows/merge-bot-pr.yml @@ -21,8 +21,7 @@ jobs: - name: Judge id: conclusion if: >- - steps.dependabot.outputs.update-type != 'version-update:semver-major' || - contains(steps.dependabot.outputs.dependency-names, 'DeterminateSystems') + steps.dependabot.outputs.update-type != 'version-update:semver-major' || contains(steps.dependabot.outputs.dependency-names, 'DeterminateSystems') run: echo -n 'merge=true' | tee -a "$GITHUB_OUTPUT" dependabot: needs: [judge-dependabot] diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 1d656804..c1c7fabc 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ "recommendations": [ "editorconfig.editorconfig", "dprint.dprint", + "kachick.vscode-yamlfmt", "tekumara.typos-vscode", "github.vscode-github-actions", "timonwong.shellcheck", diff --git a/.vscode/settings.json b/.vscode/settings.json index bf88441f..b5d8106f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,12 @@ { "editor.defaultFormatter": "dprint.dprint", "editor.formatOnSave": true, + "[yaml]": { + "editor.defaultFormatter": "kachick.vscode-yamlfmt" + }, + "[github-actions-workflow]": { + "editor.defaultFormatter": "kachick.vscode-yamlfmt" + }, "[shellscript]": { "editor.defaultFormatter": "foxundermoon.shell-format" }, diff --git a/cmd/deps/main.go b/cmd/deps/main.go index 22966a4f..78e1c5bb 100644 --- a/cmd/deps/main.go +++ b/cmd/deps/main.go @@ -12,6 +12,7 @@ func main() { {Path: "makers", Args: []string{"--version"}}, {Path: "nix", Args: []string{"--version"}}, {Path: "dprint", Args: []string{"--version"}}, + {Path: "yamlfmt", Args: []string{"-version"}}, {Path: "shellcheck", Args: []string{"--version"}}, {Path: "shfmt", Args: []string{"--version"}}, {Path: "typos", Args: []string{"--version"}}, diff --git a/cmd/fmt/main.go b/cmd/fmt/main.go index eda9ad9a..624d935a 100644 --- a/cmd/fmt/main.go +++ b/cmd/fmt/main.go @@ -22,6 +22,7 @@ func main() { // Do not cover the same files in another formatter for parallel processing cmds := runner.Commands{ {Path: "dprint", Args: []string{"fmt"}}, + {Path: "yamlfmt", Args: []string{"."}}, {Path: "shfmt", Args: append([]string{"--language-dialect", "bash", "--write"}, bashPaths...)}, } diff --git a/cmd/lint/main.go b/cmd/lint/main.go index b60d62c2..db49ec33 100644 --- a/cmd/lint/main.go +++ b/cmd/lint/main.go @@ -21,6 +21,7 @@ func main() { cmds := runner.Commands{ {Path: "dprint", Args: []string{"check"}}, + {Path: "yamlfmt", Args: []string{"-lint", "."}}, {Path: "shfmt", Args: append([]string{"--language-dialect", "bash", "--diff"}, bashPaths...)}, {Path: "shellcheck", Args: bashPaths}, // nix fmt doesn't have check option: https://github.com/NixOS/nix/issues/6918, so do not include here diff --git a/dprint.json b/dprint.json index 82c93770..3a556902 100644 --- a/dprint.json +++ b/dprint.json @@ -6,10 +6,6 @@ }, "toml": { }, - "prettier": { - "printWidth": 120, - "singleQuote": true - }, "excludes": [ ".git", ".direnv", @@ -19,7 +15,6 @@ "plugins": [ "https://plugins.dprint.dev/json-0.19.2.wasm", "https://plugins.dprint.dev/markdown-0.17.0.wasm", - "https://plugins.dprint.dev/toml-0.6.1.wasm", - "https://plugins.dprint.dev/prettier-0.35.0.json@0df49c4d878bb1051af2fa1d1f69ba6400f4b78633f49baa1f38954a6fd32b40" + "https://plugins.dprint.dev/toml-0.6.1.wasm" ] } diff --git a/flake.nix b/flake.nix index d22022c4..71c222e5 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,7 @@ cargo-make edge-pkgs.dprint + edge-pkgs.yamlfmt edge-pkgs.typos edge-pkgs.go_1_22 edge-pkgs.goreleaser diff --git a/yamlfmt.yml b/yamlfmt.yml new file mode 100644 index 00000000..97e350bd --- /dev/null +++ b/yamlfmt.yml @@ -0,0 +1,7 @@ +gitignore_excludes: true +exclude: + - '.goreleaser.yaml' +line_ending: lf +formatter: + type: basic + retain_line_breaks_single: true