diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml deleted file mode 100644 index bb44fdda..00000000 --- a/.github/workflows/formatting.yml +++ /dev/null @@ -1,35 +0,0 @@ -# YAML schema for GitHub Actions: -# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions -# -# Helpful YAML parser to clarify YAML syntax: -# https://yaml-online-parser.appspot.com/ -# -# This workflow will run nightly or when triggered from PR comment - -name: Formatting - -on: - workflow_call: - inputs: - trigger-sha: - required: true - type: string - -jobs: - check-code-style: - runs-on: ubuntu-latest - - name: Code Style - steps: - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - uses: actions/checkout@v3 - with: - ref: ${{ inputs.trigger-sha }} - - name: Install dependencies - run: | - pip3 install pyink - - name: Check code style - run: | - ci/test_code_style.sh diff --git a/.github/workflows/run_pre_merge.yml b/.github/workflows/run_pre_merge.yml index 98022a44..6dcc230c 100644 --- a/.github/workflows/run_pre_merge.yml +++ b/.github/workflows/run_pre_merge.yml @@ -51,13 +51,6 @@ jobs: }) continue-on-error: true - run-formatting: - name: Formatting - needs: remove-ci-run-label - uses: ./.github/workflows/formatting.yml - with: - trigger-sha: ${{ github.event.pull_request.head.sha }} - run-generative-api-examples: name: Generative API Examples needs: remove-ci-run-label diff --git a/ci/test_code_style.sh b/ci/test_code_style.sh deleted file mode 100755 index a333faa9..00000000 --- a/ci/test_code_style.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2024 The AI Edge Torch Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -set -e - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -ROOT_DIR=${SCRIPT_DIR}/.. -cd "${ROOT_DIR}" - -# Download pigweed for the license and formatting checks. -./ci/pigweed_download.sh - -# Explicitly disable exit on error so that we can report all the style errors in -# one pass and clean up the temporary git repository even when one of the -# scripts fail with an error code. -set +e - -# --fix_formatting to let the script fix both code and build file format error. -FIX_FORMAT_FLAG=${1} - -############################################################ -# License Check -############################################################ -.downloads/pigweed/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py \ - -p copyright_notice \ - -e .downloads \ - -e .github \ - -e CODEOWNERS \ - -e bazel \ - -e venv \ - -e "\.md" \ - -e "\.ipynb" \ - -e "\.patch" \ - -e "\.pt" \ - -e "\.jpg" \ - -e "\.png" \ - -e "\.jar" \ - --output-directory /tmp - -LICENSE_CHECK_RESULT=$? - -############################################################ -# Python formatting -############################################################ - -PYINK_COMMAND="pyink --pyink-use-majority-quotes --pyink-indentation=2 --preview --unstable --line-length 80 - --extend-exclude bazel - --extend-exclude .downloads - --extend-exclude test/image_segmentation/android --check ./" - -echo "Testing python formatting with ${PYINK_COMMAND}" -${PYINK_COMMAND} -PYTHON_FORMAT_RESULT=$? - -# Re-enable exit on error now that we are done with the temporary git repo. -set -e - -if [[ ${LICENSE_CHECK_RESULT} != 0 || \ - ${PYTHON_FORMAT_RESULT} != 0 \ - ]] -then - exit 1 -fi