Skip to content

Commit

Permalink
tidy: Improve dockerfile support by using parse-dockerfile and variou…
Browse files Browse the repository at this point in the history
…s minor improvements
  • Loading branch information
taiki-e committed Feb 1, 2025
1 parent 882ff08 commit 8ffb408
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 66 deletions.
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,md,rb,sh,yml,yaml}]
[*.{css,html,json,md,rb,sh,yml,yaml}]
indent_size = 2

[*.{js,yml,yaml}]
quote_type = single

[*.sh]
# https://google.github.io/styleguide/shellguide.html#s5.3-pipelines
binary_next_line = true
# https://google.github.io/styleguide/shellguide.html#s5.5-case-statement
switch_case_indent = true
9 changes: 6 additions & 3 deletions .github/workflows/tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ jobs:
run: |
trap -- 's=$?; printf >&2 "%s\n" "${0##*/}:${LINENO}: \`${BASH_COMMAND}\` exit with ${s}"; exit ${s}' ERR
IFS=$'\n\t'
printf 'github.event_name=%s\n' "${{ github.event_name }}"
printf 'github.ref=%s\n' "${{ github.ref }}"
printf 'github.repository_owner=%s\n' "${{ github.repository_owner }}"
if [[ -n "$(git ls-files '*.rs')" ]]; then
printf 'rust=true\n' >>"${GITHUB_OUTPUT}"
metadata=$(cargo metadata --format-version=1 --no-deps)
Expand All @@ -111,6 +108,9 @@ jobs:
fi
fi
fi
if [[ -n "$(git ls-files '*Dockerfile*')" ]]; then
printf 'dockerfile=true\n' >>"${GITHUB_OUTPUT}"
fi
if [[ -e "${{ inputs.codegen-script }}" ]]; then
pip3 install yq
job=$(yq -c ".jobs.\"${{ inputs.codegen-job }}\"" "${{ inputs.codegen-workflow }}")
Expand All @@ -129,6 +129,7 @@ jobs:
rust-pub: ${{ steps.prepare.outputs.rust-pub }}
rust-pub-lib: ${{ steps.prepare.outputs.rust-pub-lib }}
rust-pub-proc-macro: ${{ steps.prepare.outputs.rust-pub-proc-macro }}
dockerfile: ${{ steps.prepare.outputs.dockerfile }}
codegen: ${{ steps.prepare.outputs.codegen }}
codegen-commit: ${{ steps.prepare.outputs.codegen-commit }}

Expand All @@ -149,6 +150,8 @@ jobs:
if: needs.prepare.outputs.rust == 'true'
- uses: taiki-e/install-action@shellcheck
- uses: taiki-e/install-action@shfmt
- uses: taiki-e/install-action@parse-dockerfile
if: needs.prepare.outputs.dockerfile == 'true'
- run: cat -- tools/.tidy-check-license-headers
- run: cat -- .cspell.json
- run: printf 'REMOVE_UNUSED_WORDS=1\n' >>"${GITHUB_ENV}"
Expand Down
Loading

0 comments on commit 8ffb408

Please sign in to comment.