diff --git a/.github/workflows/bash_formatter.yaml b/.github/workflows/bash_formatter.yaml deleted file mode 100644 index fd1d254bf6..0000000000 --- a/.github/workflows/bash_formatter.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Proper Formatting on bash files - -on: [push, pull_request] - -jobs: - format_bash_files: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install ShellCheck - run: sudo apt install -y shellcheck - - - name: Bash Formatting Guidelines - run: | - echo "### Bash Files Formatting Guidelines ### - If there are errors and warnings regarding your bash files, - You can check that error code definitions in https://www.shellcheck.net/wiki/ site. - You can correct them using the https://www.shellcheck.net/ site. - You have to ignore disable errors in .shellcheckrc file. - " - - - name: Fetch master branch - run: git fetch origin master - - - name: Set up changed files - run: | - git diff --name-only origin/master...HEAD | grep -E '^.*\.sh$' | grep -v '^apps/' > changed_files_in_PR.txt || true - - - name: Display changed files - run: cat changed_files_in_PR.txt - - - name: Run ShellCheck on changed files - run: | - cat changed_files_in_PR.txt | xargs -I {} shellcheck {} - shell: bash - - diff --git a/.github/workflows/linting_bash_python_yaml_files.yaml b/.github/workflows/linting_bash_python_yaml_files.yaml new file mode 100644 index 0000000000..33e5e6914c --- /dev/null +++ b/.github/workflows/linting_bash_python_yaml_files.yaml @@ -0,0 +1,144 @@ +name: Proper linting on Bash, Python, and YAML files + +on: [push, pull_request] + +jobs: + format_python_files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Python Files Formatting Guidelines + run: | + echo "### Python Files Formatting Guidelines ### + If there is a formatting error in your python files, + 1. First install black + It requires Python 3.8+ to run. + Install with 'pip install black' and if you use pipx, install Black with 'pipx install black'. + If you want to format Jupyter Notebooks, install with 'pip install black[jupyter]'. + + 2. Run the command + 'python -m black {source_file_or_directory}' or + 'black {source_file_or_directory}' + to format python files. + " + + - uses: psf/black@stable + with: + src: | + ./common + ./example + + format_YAML_files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install yamllint + run: pip install yamllint + + - name: YAML Formatting Guidelines + run: | + echo "### YAML Formatting Guidelines ### + If there is a formatting error in your YAML file, you will see errors like the one below: + 'Error: 6:4 [indentation] wrong indentation: expected 2 but found 3' + + To fix these errors, refer to the YAML formatting rules at: + https://yamllint.readthedocs.io/en/stable/rules.html# + + Search for the keyword inside the brackets [] in the error message. In this example, it's 'indentation'. + + Note: Some rules have been customized in the '.yamllint.yaml' file. Below is the content of that file: + + extends: default + + rules: + document-start: + present: false + document-end: + present: false + indentation: + indent-sequences: false + line-length: + max: 400 + " + + - name: Fetch master branch + run: git fetch origin master + + - name: Set up changed files + id: changed_files + run: | + git diff --name-only origin/master...HEAD | grep -E '^common/.*\.ya?ml$|^example/.*\.ya?ml$' > changed_files_in_PR.txt || true + if [ ! -s changed_files_in_PR.txt ]; then + echo "No YAML files have changed in this PR." > changed_files_in_PR.txt + fi + + - name: Display changed files + run: cat changed_files_in_PR.txt + + - name: Run yamllint on changed files + id: lint + run: | + if grep -q 'No YAML files have changed in this PR.' changed_files_in_PR.txt; then + echo "No YAML files have changed in this PR." + else + cat changed_files_in_PR.txt | xargs -I {} yamllint {} || exit 1 + fi + shell: bash + + - name: Check YAML lint results + if: success() && steps.lint.outcome == 'success' + run: echo "No styling issues with YAML files." + shell: bash + + format_bash_files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install ShellCheck + run: sudo apt install -y shellcheck + + - name: Bash Formatting Guidelines + run: | + echo "### Bash Files Formatting Guidelines ### + If there are errors and warnings regarding your bash files, + You can check the error code definitions at https://www.shellcheck.net/wiki/. + You can correct them using the https://www.shellcheck.net/ site. + You have to ignore disable errors in the .shellcheckrc file. + " + + - name: Fetch master branch + run: git fetch origin master + + - name: Set up changed files + id: changed_files + run: | + git diff --name-only origin/master...HEAD | grep -E '^.*\.sh$' | grep -v '^apps/' > changed_files_in_PR.txt || true + if [ ! -s changed_files_in_PR.txt ]; then + echo "No bash files have changed in this PR." + fi + + - name: Display changed files + if: always() # Always run this step + run: cat changed_files_in_PR.txt || echo "No bash files have changed in this PR." + + - name: Run ShellCheck on changed files + id: lint + run: | + if grep -q 'No bash files have changed in this PR.' changed_files_in_PR.txt; then + echo "No bash files have changed in this PR." + else + cat changed_files_in_PR.txt | xargs -I {} shellcheck {} || exit 1 + fi + shell: bash + + - name: Check Bash lint results + if: success() && steps.lint.outcome == 'success' + run: echo "No styling issues with Bash files." + shell: bash diff --git a/.github/workflows/python_formatter.yaml b/.github/workflows/python_formatter.yaml deleted file mode 100644 index ba470cad84..0000000000 --- a/.github/workflows/python_formatter.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Proper Formatting on Python files - -on: [push, pull_request] - -jobs: - format_python_files: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Python Files Formatting Guidelines - run: | - echo "### Python Files Formatting Guidelines ### - If there is a formatting errors in your python files, - 1. First install black - It requires Python 3.8+ to run. - Install with "pip install black" and if you use pipx, install Black with "pipx install black" - If you want to format Jupyter Notebooks, install with pip install "black[jupyter]" - - 2. Run the command - "python -m black {source_file_or_directory}" or - "black {source_file_or_directory}" - to format python files. - " - - - uses: psf/black@stable - with: - src: | - ./common - ./example - - \ No newline at end of file diff --git a/.github/workflows/yaml_formatter.yaml b/.github/workflows/yaml_formatter.yaml deleted file mode 100644 index dca73409d4..0000000000 --- a/.github/workflows/yaml_formatter.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Proper Formatting on YAML files - -on: [push, pull_request] - -jobs: - format_YAML_files: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install yamllint - run: pip install yamllint - - - name: YAML Formatting Guidelines - run: | - echo "### YAML Formatting Guidelines ### - If there is a formatting error in your YAML file, you will see errors like the one below: - 'Error: 6:4 [indentation] wrong indentation: expected 2 but found 3' - - To fix these errors, refer to the YAML formatting rules at: - https://yamllint.readthedocs.io/en/stable/rules.html# - - Search for the keyword inside the brackets [] in the error message. In this example, it's 'indentation'. - - Note: Some rules have been customized in the '.yamllint.yaml' file. Below is the content of that file: - - extends: default - - rules: - document-start: - present: false - document-end: - present: false - indentation: - indent-sequences: false - line-length: - max: 400 - " - - - name: Fetch master branch - run: git fetch origin master - - - name: Set up changed files - run: | - git diff --name-only origin/master...HEAD | grep -E '^common/.*\.ya?ml$|^example/.*\.ya?ml$' > changed_files_in_PR.txt || true - - - name: Display changed files - run: cat changed_files_in_PR.txt - - - name: Run yamllint on changed files - run: | - chmod +x ./run_yamllint.sh - ./run_yamllint.sh - shell: bash - - - diff --git a/README.md b/README.md index 7b85df7d35..a94653e123 100644 --- a/README.md +++ b/README.md @@ -550,4 +550,4 @@ The Kubeflow security working group follows a responsible disclosure policy for - **Q:** What versions of Istio, Knative, Cert-Manager, Argo, ... are compatible with Kubeflow? \ **A:** Please refer to each individual component's documentation for a dependency compatibility range. For Istio, Knative, Dex, Cert-Manager and OIDC-AuthService, the versions in `common` are the ones we have validated. - **Q:** Can I use earlier version of Kustomize with Kubeflow manifests? - **A:** No, it is not supported anymore, although it might be possible with manual effort. + **A:** No, it is not supported anymore, although it might be possible with manual effort. \ No newline at end of file