Skip to content

Commit 7855278

Browse files
committed
replace yamllint with yamlfix, add sanity check before commit in gh action
Signed-off-by: Jack Luar <[email protected]>
1 parent 4747ecc commit 7855278

File tree

5 files changed

+32
-53
lines changed

5 files changed

+32
-53
lines changed

.github/workflows/github-actions-yaml-test.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ jobs:
1414
uses: actions/checkout@v4
1515
with:
1616
submodules: 'recursive'
17-
- name: Run YAML script
17+
- name: Run generate-variable-docs.py
1818
run: |
1919
python3 flow/scripts/generate-variable-docs.py
20-
- name: Run YAML Lint
20+
- name: Run yamlfix check
2121
run: |
22-
pip install yamllint==1.35.1
23-
yamllint flow/scripts/variables.yaml
22+
yamlfix -c yamlfix.toml flow/scripts/variables.yaml --check
2423
2524
docs-pr-update:
26-
name: 'Create PR to update ORFS FlowVariables.md'
25+
name: 'Create PR to update ORFS FlowVariables.md and variables.yaml'
2726
needs:
2827
- docs-test-job
2928
runs-on: ubuntu-latest
@@ -33,8 +32,12 @@ jobs:
3332
- name: Run generate-variable-docs.py
3433
run: |
3534
python3 flow/scripts/generate-variable-docs.py
35+
- name: Run yamlfix
36+
run: |
37+
pip install yamlfix==1.17.0
38+
yamlfix -c yamlfix.toml flow/scripts/variables.yaml
3639
- name: Create branch if diff exists
37-
id: docs-update
40+
id: variables-update
3841
run: |
3942
git config --local user.email "github-actions[bot]@users.noreply.github.com"
4043
git config --local user.name "github-actions[bot]"
@@ -43,15 +46,22 @@ jobs:
4346
else
4447
echo "has_update=false" >> "$GITHUB_OUTPUT"
4548
fi
46-
git add .
49+
git add flow/scripts/variables.yaml
50+
git add docs/user/FlowVariables.md
4751
git commit --signoff -m "[Docs]: Update ORFS FlowVariables.md"
52+
53+
# Sanity check that no other files are unstaged
54+
if [ -n "$(git status --porcelain)" ]; then
55+
echo "Error: Unstaged changes after commit."
56+
exit 1
57+
fi
4858
- name: Only push if not master
4959
if: "github.event.client_payload.branch != 'master'"
50-
id: remote-update-pr
60+
id: variables-update-pr
5161
run: |
5262
git push origin "HEAD:refs/pull/${{ github.event.client_payload.branch }}/head"
53-
- name: Create docs update PR
54-
if: "steps.remote-update.outputs.has_update == 'true' && github.event.client_payload.branch == 'master'"
63+
- name: Create variables update PR
64+
if: "steps.variables-update.outputs.has_update == 'true' && github.event.client_payload.branch == 'master'"
5565
uses: peter-evans/create-pull-request@v5
5666
with:
5767
token: ${{ github.token }}

.yamllint

Lines changed: 0 additions & 37 deletions
This file was deleted.

etc/DependencyInstaller.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _installCommon() {
2929
source /opt/rh/rh-python38/enable
3030
set -u
3131
fi
32-
local pkgs="pandas numpy firebase_admin click pyyaml yamllint"
32+
local pkgs="pandas numpy firebase_admin click pyyaml yamlfix"
3333
if [[ $(id -u) == 0 ]]; then
3434
pip3 install --no-cache-dir -U $pkgs
3535
else

flow/scripts/variables.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,19 @@ GENERATE_ARTIFACTS_ON_FAILURE:
66
working with a Makefile flow, it is more natural to fail the step and leave
77
the user to manually inspect the logs and artifacts directly via the file
88
system.
9-
109
Set to 1 to change the behavior to generate artifacts upon failure to e.g.
1110
do a global route. The exit code will still be non-zero on all other
1211
failures that aren't covered by the "useful to inspect the artifacts on
1312
failure" use-case.
14-
1513
Example: just like detailed routing, a global route that fails with
1614
congestion, is not a build failure(as in exit code non-zero), it is a
1715
successful(as in zero exit code) global route that produce reports
1816
detailing the problem.
1917
2018
Detailed route will not proceed, if there is global routing congestion
21-
2219
This allows build systems, such as bazel, to create artifacts for global and
2320
detailed route, even if the operation had problems, without having know
2421
about the semantics between global and detailed route.
25-
2622
Considering that global and detailed route can run for a long time and use a
2723
lot of memory, this allows inspecting results on a laptop for a build that
2824
ran on a server.
@@ -31,7 +27,6 @@ TNS_END_PERCENT:
3127
description: >
3228
Default TNS_END_PERCENT value for post CTS timing repair. Try fixing all
3329
violating endpoints by default (reduce to 5% for runtime).
34-
3530
Specifies how many percent of violating paths to fix [0-100]. Worst path
3631
will always be fixed.
3732
default: 100

yamlfix.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
explicit_start = true
2+
line_length = 120
3+
preserve_quotes = true
4+
quote_representation = "'"
5+
section_whitelines = 0
6+
sequence_style = "block_style"
7+
comments_min_spaces_from_content = 2
8+
allow_duplicate_keys = false
9+
indent_mapping = 2
10+
indent_offset = 2
11+
indent_sequence = 4

0 commit comments

Comments
 (0)