-
Notifications
You must be signed in to change notification settings - Fork 694
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
Format yaml files #615
Format yaml files #615
Conversation
Signed-off-by: adetunjii <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #615 +/- ##
============================================
- Coverage 70.19% 70.16% -0.04%
============================================
Files 110 110
Lines 60052 60052
============================================
- Hits 42154 42135 -19
- Misses 17898 17917 +19 |
.github/workflows/ci.yml
Outdated
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- uses: actions/setup-go@v5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we pin to a commit for setup-go
too? @bjosv, thoughts?
.github/workflows/ci.yml
Outdated
- name: Format Yaml files | ||
run: | | ||
go install github.com/google/yamlfmt/cmd/yamlfmt@latest | ||
yamlfmt . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this go into ./deps
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it formats all the yaml files present in the repository
I'm a little confused because I thought in the daily.yml we had some inconsistently formatted files. The CI flow you added isn't failing though, so it doesn't look like it would catch those inconsistencies. |
I might have to format it locally then push. Subsequently, it should fix all inconsistencies |
Hm, I think I understand better. It looks like it's just formatting it in the CI temporary directory, which happens in a separate directory from the one that will eventually get merged. Ideally we want the step to fail if it encounters any files it needs to format. |
Then I think we need a linter instead of a formatter. |
Generally a format checker is a subset of linting, since linting is a broad term for code analysis. We should be able to use the format checker you proposed for the linting, and then give instructions for how the end user can use the same formatting tool to fix it. |
Okay. I'll have a look. |
@adetunjii Maybe take a look at https://github.com/valkey-io/valkey/blob/unstable/.github/workflows/clang-format.yml for an example for how we do the style checking with clang. |
Signed-off-by: adetunjii <[email protected]>
@madolson Are we excluding yaml files in the |
@adetunjii Yes, exclude the files in deps. |
Signed-off-by: adetunjii <[email protected]>
5b3cede
to
aa240a1
Compare
Signed-off-by: adetunjii <[email protected]>
…ix/format-yaml
.github/workflows/ci.yml
Outdated
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's pin to a commit like we did for other actions
.github/workflows/daily.yml
Outdated
./src/valkey-cli save | grep OK > /dev/null | ||
vmtouch -v ./dump.rdb > /dev/null | ||
- name: test | ||
run: "echo \"test SAVE doesn't increase cache\"\nCACHE0=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')\necho \"$CACHE0\"\n./src/valkey-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080 --repl-diskless-sync no --pidfile /tmp/master/valkey.pid --rdbcompression no --enable-debug-command yes\n./src/valkey-cli -p 8080 debug populate 10000 k 102400\n./src/valkey-server --daemonize yes --logfile /dev/null --dir /tmp/slave --port 8081 --repl-diskless-load disabled --rdbcompression no\n./src/valkey-cli -p 8080 save > /dev/null\nVMOUT=$(vmtouch -v /tmp/master/dump.rdb)\necho $VMOUT\ngrep -q \" 0%\" <<< $VMOUT \nCACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')\necho \"$CACHE\"\nif [ \"$(( $CACHE-$CACHE0 ))\" -gt \"8000000\" ]; then exit 1; fi\n#magic___^_^___line\necho \"test replication doesn't increase cache\"\n./src/valkey-cli -p 8081 REPLICAOF 127.0.0.1 8080 > /dev/null\nwhile [ $(./src/valkey-cli -p 8081 info replication | grep \"master_link_status:down\") ]; do sleep 1; done;\nsleep 1 # wait for the completion of cache reclaim bio\nVMOUT=$(vmtouch -v /tmp/master/dump.rdb)\necho $VMOUT\ngrep -q \" 0%\" <<< $VMOUT \nVMOUT=$(vmtouch -v /tmp/slave/dump.rdb)\necho $VMOUT\ngrep -q \" 0%\" <<< $VMOUT \nCACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')\necho \"$CACHE\"\nif [ \"$(( $CACHE-$CACHE0 ))\" -gt \"8000000\" ]; then exit 1; fi\n#magic___^_^___line\necho \"test reboot doesn't increase cache\"\nPID=$(cat /tmp/master/valkey.pid)\nkill -15 $PID\nwhile [ -x /proc/${PID} ]; do sleep 1; done\n./src/valkey-server --daemonize yes --logfile /dev/null --dir /tmp/master --port 8080\nwhile [ $(./src/valkey-cli -p 8080 info persistence | grep \"loading:1\") ]; do sleep 1; done;\nsleep 1 # wait for the completion of cache reclaim bio\nVMOUT=$(vmtouch -v /tmp/master/dump.rdb)\necho $VMOUT\ngrep -q \" 0%\" <<< $VMOUT\nCACHE=$(grep -w file /sys/fs/cgroup/memory.stat | awk '{print $2}')\necho \"$CACHE\"\nif [ \"$(( $CACHE-$CACHE0 ))\" -gt \"8000000\" ]; then exit 1; fi\n#magic___^_^___line\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the result of the yml format? it is a lot harder to read now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is caused by trailing whitespaces on some lines. See: google/yamlfmt#185
Signed-off-by: adetunjii <[email protected]>
Signed-off-by: adetunjii <[email protected]>
…ix/format-yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you @adetunjii!
Closes valkey-io#533 --------- Signed-off-by: adetunjii <[email protected]>
Closes #533