lowRISC / lowRISC/opentitan

[ci] Add Automatic License Checking to CI Pipeline

Open
#27,300 4 comments 3 reactions 0 assignees View on GitHub
Component:CI
Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

This issue proposes the implementation of automated license checking within the OpenTitan Continuous Integration (CI) pipeline. This initiative is driven by the recent pull-in of a Python dependency with a GPLv3 license in PR [#27295](https://github.com/lowRISC/opentitan/pull/27295), which is incompatible with OpenTitan's Apache License.

To establish a robust guardrail against the unintentional inclusion of dependencies with incompatible licenses, we need to proactively identify and flag such issues during the CI process. This will prevent potential legal and compliance problems down the line.

**Scope:**

The automatic license checking should be applied to all sources from which dependencies _recursively_ are introduced into the OpenTitan codebase, including but not limited to:

* **Python Dependencies:** Libraries defined in `python-requirements.txt` and `project.toml`.
* **Bazel Dependencies:** External dependencies declared in `MODULE.bazel`.
* **Rust Dependencies:** (To be investigated) Dependencies managed by Cargo (e.g., `Cargo.toml` and `Cargo.lock`).
* **GitHub CI Templates:** Reused workflows or actions that might introduce implicit dependencies.

**Proposed Solution (Initial Thoughts):**

For Python dependencies, tools like [`python-license-check`](https://github.com/dhatim/python-license-check) offer a potential solution. However, a thorough evaluation of various license checking tools is necessary to determine the most suitable option for OpenTitan. Key considerations for tool selection should include:

* **Accuracy and Reliability:** Ability to correctly identify and interpret licenses.
* **Compatibility with OpenTitan's License (Apache-2.0):** Clear configuration for allowed licenses.
* **Integration with CI Systems:** Ease of integration into our existing GitHub Actions workflow.
* **Support for Multiple Package Managers:** Ability to handle Python (pip, poetry), Bazel, and potentially Rust (Cargo).
* **Maintainability and Community Support:** Active development and a supportive community.
* **Configuration and Customization:** Flexibility to define allowed/disallowed licenses and handle edge cases.

/cc @rsahita @adurbin-rivos @domrizz0 @davidschrammel

Contributor guide

Open the contributing guide

Research direction

Start by reviewing python-requirements.txt, project.toml, MODULE.bazel, Cargo.toml, Cargo.lock, and the GitHub Actions workflows, then compare available license-checking tools against these dependency sources. Done means the CI pipeline recursively checks supported dependencies, enforces the allowed-license policy, and flags incompatible licenses.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python, rust
Domain
ci-cd, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.