Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of SPDX License Compliance Checker workflows #17

Merged
merged 15 commits into from
Apr 12, 2024

Conversation

anirudTT
Copy link
Contributor

@anirudTT anirudTT commented Apr 10, 2024

Integration of SPDX License Compliance Checker workflows-- within Github Actions

Overview

This pull request introduces changes to GitHub Actions workflows, focusing on ensuring adherence to SPDX license requirements for Python files. It adds two new workflows, check-license-year.yml and license-checker.yml, to automate the verification of SPDX license headers and the checking of the correct license year within all changed and new Python files involved/added via a PR to main.

Additions / Changes to repository via PR or otherwise :

  1. SPDX License Year Validation Workflow (check-license-year.yml):

    • Automates the validation of the SPDX license year within changed Python files in a PR against the current year (2024).
    • Flags files missing the correct year or without an SPDX license identifier and adds a comment on PR listing those flagged files , and prevents PR merging until compliance is achieved.
  2. SPDX License Header Check Workflow (license-checker.yml):

    • Checks for the presence of valid SPDX license headers in Python files included in the PR, according to predefined rules in check_copyright_config.yaml.
    • Lists non-compliant files in an automated PR comment, requesting updates to meet the project's licensing standards.
  3. Configuration File (check_copyright_config.yaml):

    • Defines the criteria for the SPDX license checks, including allowed licenses (Apache-2.0, MIT), the default license for new files, and a custom notice template for Python files.
  4. Updates to CONTRIBUTING.md:: to better explain contributors on how to navigate workflow failures and passing criteria.

  5. Outside the PR: https://github.com/tenstorrent/benchmarking/settings/rules --- rule set will be added to prevent a PR being merged unless all checks are passed

How It Works

Upon opening or updating a PR, the newly implemented workflows run automatically. Non-compliance with our SPDX licensing standards triggers informative comments within the PR, illustrating precisely what needs to be corrected. (See included screenshots for examples of these automated comments.)

Screenshots

  1. PR comments:
    Screenshot 2024-04-10 at 12 22 28 PM

  2. Shows clearly that the workflow failed:
    Screenshot 2024-04-10 at 12 22 41 PM

anirudTT and others added 10 commits April 9, 2024 20:21
* test 4 buggy files

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* remove all files for testing

---------

Co-authored-by: anirudTT <anirudTT@users.noreply.github.com>
* change this in this PR ; an already existing file

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* try with a 2024 year

* try this workflow

* try with a better comment approach

* update comment

* update workflow name

* lets update lc checker and try

* test failure

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* test without weird ''' block within the code

* update name

* update comment again

* correct spelling

* correct file name as well

* add thank you in the end

* keep it a same as main

* remove this file for starting PR

* make simar to main

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* re update comment

* update name again

---------

Co-authored-by: anirudTT <anirudTT@users.noreply.github.com>
@anirudTT anirudTT marked this pull request as ready for review April 10, 2024 16:55
@anirudTT anirudTT requested a review from milank94 April 10, 2024 16:55
@anirudTT anirudTT self-assigned this Apr 10, 2024
@anirudTT anirudTT added the enhancement New feature or request label Apr 10, 2024
anirudTT and others added 2 commits April 11, 2024 10:39
to reflect the correct copyright notice.

Co-authored-by: Milan Kordic <78221808+milank94@users.noreply.github.com>
to reflect the correct copyright notice.

Co-authored-by: Milan Kordic <78221808+milank94@users.noreply.github.com>
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
* add dynamic year

* introduce bugs to test

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* try again

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* add a comment

* rename files

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* set as env variable to ensure PR is commented

* correct comment structuring

* add a lc header here

* check that it does work

* check if this errors out

* remove this and check

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* add in all correct stuff n check

* re do the workflow

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* add more check and verify

* *** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

* make it more easier to understand errors

* check now that no errors come

* try this

* try this checker

* try with rename

* check this Ai stuff

* correct and check

* update all to allow for broader mentions

* correct mention

* delete this tester file

---------

Co-authored-by: anirudTT <anirudTT@users.noreply.github.com>
Copy link
Contributor Author

@anirudTT anirudTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made requested changes

Copy link
Contributor Author

@anirudTT anirudTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated:

  1. the workflow name as I felt both almost are named the same
  2. updated to remove the name python files from PR comment body

Copy link
Collaborator

@milank94 milank94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Looks good

@anirudTT anirudTT merged commit 1aa7982 into tenstorrent:main Apr 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants