Skip to content

Commit

Permalink
add yamllint scaffold, and prettify variables.yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Luar <[email protected]>
  • Loading branch information
luarss committed Oct 13, 2024
1 parent 387ac09 commit a21367c
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 154 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/github-actions-yaml-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: ORFS variables.yaml tester and linter

on:
push:

jobs:
docs-test-job:
name: 'Tests for variables.yaml'
runs-on: ubuntu-latest
container:
image: openroad/ubuntu-cpp20
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Run YAML script
run: |
python3 flow/scripts/generate-variable-docs.py
- name: Run YAML Lint
run: |
pip install yamllint==1.35.1
yamllint flow/scripts/variables.yaml
docs-pr-update:
name: 'Create PR to update ORFS FlowVariables.md'
needs:
- docs-test-job
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run generate-variable-docs.py
run: |
python3 flow/scripts/generate-variable-docs.py
- name: Create branch if diff exists
id: docs-update
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if [ -n "$(git status --porcelain)" ]; then
echo "has_update=true" >> "$GITHUB_OUTPUT"
else
echo "has_update=false" >> "$GITHUB_OUTPUT"
fi
git add .
git commit --signoff -m "[Docs]: Update ORFS FlowVariables.md"
- name: Only push if not master
if: "github.event.client_payload.branch != 'master'"
id: remote-update-pr
run: |
git push origin "HEAD:refs/pull/${{ github.event.client_payload.branch }}/head"
- name: Create docs update PR
if: "steps.remote-update.outputs.has_update == 'true' && github.event.client_payload.branch == 'master'"
uses: peter-evans/create-pull-request@v5
with:
token: ${{ github.token }}
signoff: true
delete-branch: true
title: "[BOT] Update ORFS variables"
reviewers: |
vvbandeira
maliberty
draft: true
branch: bot-update-variables
commit-message: |
[BOT] Update ORFS variables
37 changes: 37 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
extends: default

rules:
# General formatting
indentation:
level: error # options: 'error' (strict), 'warning' (less strict)
spaces: 2 # number of spaces per indentation level
line-length:
max: 120 # maximum allowed length for lines
level: warning
allow-non-breakable-words: false # non-breakable words exceeding line-length

# Document structure
document-start:
level: error # documents should start with '---'

# Trailing spaces
trailing-spaces:
level: error # no trailing spaces allowed

# Comments
comments:
level: warning
require-starting-space: true # comments should have a space after '#'

# Special characters
key-duplicates:
level: error # duplicate keys are not allowed
truthy:
level: warning # warn on 'yes/no' and 'on/off'; prefer 'true/false'

# File properties
empty-lines:
max: 2 # no more than 2 consecutive empty lines
level: warning
new-line-at-end-of-file:
level: warning # files should end with a newline
2 changes: 1 addition & 1 deletion etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _installCommon() {
source /opt/rh/rh-python38/enable
set -u
fi
local pkgs="pandas numpy firebase_admin click pyyaml"
local pkgs="pandas numpy firebase_admin click pyyaml yamllint"
if [[ $(id -u) == 0 ]]; then
pip3 install --no-cache-dir -U $pkgs
else
Expand Down
Loading

0 comments on commit a21367c

Please sign in to comment.