tenstorrent / tt-buda-demos

Repository of model demos using TT-Buda
Other
54 stars 14 forks source link

Fix license headers #88

Closed anirudTT closed 3 months ago

anirudTT commented 4 months ago

GitHub Actions Workflow for License Header Verification

Summary

This PR introduces a GitHub Actions workflow, similar to the one used in benchmarking, to ensure that all Python files in the repository have the correct license headers. This workflow is essential for maintaining licensing compliance.

Changes Introduced

  1. Addition of a License File:

    • Added a license file to the root of the repository for clear and consistent licensing information.
  2. Copyright Configuration File:

    • Introduced a configuration file for the GitHub Actions workflow. This file specifies which licenses are valid (currently allowing MIT and Apache 2.0). Any new files added must use the Apache 2.0 license. The file also includes a list of files to be ignored during the check.
  3. License Headers on Python Files:

    • Added the required license headers to all existing Python files to ensure compliance.

Workflow Logic

The workflow uses the check-copyright tool, similar to the one used by the TT Metal team. The workflow follows these steps:

  1. Check Out Code: Fetch the code from the repository.
  2. Set Up Python: Configure the required Python environment.
  3. Install Copyright Check Tool: Install the tool to perform the license check.
  4. Run License Check: Execute the license check and capture the output.
  5. Extract and List Files: Identify and list files that fail the check.
  6. Post PR Comment: If any issues are found, a comment is posted on the PR with details.

The workflow outputs something similar to this; which we aim to capture , clean up and then display as a PR comment:

To have this hook automatically insert the standard Espressif copyright notice, ensure the word "copyright" is not in any comment up to line 30 and the file is not on the ignore list.
Below is a list of files, which failed the copyright check.

Files which failed the copyright check:

  • ./model_demos/nlp_demos/fuyu8b/pytorch_fuyu8b_past_cache.py

Modified files:

  • ./model_demos/test.py

Above is a list of files, which were modified. Please check their contents, stage them and run the commit again!

An awk command is then used to capture the files that failed the copyright check, and GitHub Actions is used to post a comment on the PR.

github-actions[bot] commented 4 months ago

Our automated SPDX license verification process has discovered that the following files are missing a license header:

./model_demos/test.py

Please ensure each indicated file includes a valid SPDX license identifier. This is essential for maintaining licensing compliance. Your attention and cooperation in updating these files are greatly appreciated. Thank you.

github-actions[bot] commented 4 months ago

Our automated SPDX license verification process has discovered that the following files are missing a license header:

./model_demos/tests/conftest.py

Please ensure each indicated file includes a valid SPDX license identifier. This is essential for maintaining licensing compliance. Your attention and cooperation in updating these files are greatly appreciated. Thank you.

github-actions[bot] commented 4 months ago

Our automated SPDX license verification process has discovered that the following files are missing a license header:

./model_demos/tests/conftest.py

Please ensure each indicated file includes a valid SPDX license identifier. This is essential for maintaining licensing compliance. Your attention and cooperation in updating these files are greatly appreciated. Thank you.