-
Notifications
You must be signed in to change notification settings - Fork 1
Address license handling #4
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
Open
figueroa1395
wants to merge
9
commits into
main
Choose a base branch
from
feature/correct-license-handling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6608196
first try
figueroa1395 79448ac
better workflow
figueroa1395 3ec1e0d
try aggresive cleanup and build
figueroa1395 95bd6b3
debugging
figueroa1395 73e3262
debugging 2
figueroa1395 be2320e
debugging 3
figueroa1395 1eb3c09
cleanup
figueroa1395 1c09798
forbid manual publishing
figueroa1395 22761a3
extend to the whole repo
figueroa1395 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,13 +61,98 @@ jobs: | |
ls src/pgm_build_dependencies/eigen/ | ||
ls src/pgm_build_dependencies/msgpack_cxx/ | ||
|
||
- name: License scan - entire repository | ||
uses: fossology/fossology-action@v1 | ||
continue-on-error: true | ||
with: | ||
scan_mode: repo | ||
scanners: 'nomos ojo' | ||
report_format: 'SPDX_JSON' | ||
|
||
- name: Install jq | ||
run: sudo apt-get update && sudo apt-get install -y jq | ||
|
||
- name: Remove files with non-accepted license | ||
id: license-cleanup | ||
run: | | ||
# Find the SPDX JSON file | ||
SPDX_FILE=$(find . -name "*spdx*.json" -o -name "sbom*.json" -o -name "*sbom.json"| head -1) | ||
|
||
if [ -z "$SPDX_FILE" ]; then | ||
echo "No SPDX JSON file found! Fossology scan may have failed." | ||
echo "Available files:" | ||
find . -name "*.json" || echo "No JSON files found" | ||
exit 1 | ||
fi | ||
echo "Found SPDX file: $SPDX_FILE" | ||
|
||
# Get badly licensed files (excluding .git and .github directories) | ||
echo "Extracting and deduplicating badly licensed files..." | ||
BAD_FILES=$(jq -r ' | ||
[.files[] | | ||
select(.licenseInfoInFiles[]? | type == "string" and test("GPL"; "i")) | | ||
select(.fileName | test("^\\.git/") | not) | | ||
select(.fileName | test("^\\.github/") | not) | | ||
.fileName] | | ||
unique | | ||
.[] | ||
' "$SPDX_FILE") | ||
|
||
if [ -z "$BAD_FILES" ]; then | ||
echo "No badly licensed files found - nothing to delete!" | ||
else | ||
echo "Badly licensed files found:" | ||
echo "$BAD_FILES" | while read -r file_name; do | ||
if [ -n "$file_name" ]; then | ||
echo " - $file_name" | ||
|
||
if [ -f "$file_name" ]; then | ||
rm -f "$file_name" | ||
echo "Deleted: $file_name" | ||
else | ||
echo "File not found: $file_name" | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
fi | ||
continue-on-error: true | ||
|
||
- name: Check license cleanup status | ||
run: | | ||
if [ "${{ steps.license-cleanup.outcome }}" = "failure" ]; then | ||
echo "ERROR: License cleanup step failed!" | ||
echo "Terminating workflow due to license scanning issues." | ||
exit 1 | ||
else | ||
echo "License cleanup completed successfully" | ||
fi | ||
|
||
- name: Upload Scan Results Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: license-scan-results | ||
path: results/ | ||
|
||
- name: build wheel | ||
run: | | ||
python -m build --wheel --outdir dist | ||
ls dist/ | ||
echo "VERSION=v$(date +'%Y.%m.%d')" >> $GITHUB_ENV | ||
|
||
- name: Debug workflow trigger | ||
run: | | ||
echo "Event name: ${{ github.event_name }}" | ||
echo "Force publish input: ${{ inputs.force_publish }}" | ||
echo "Will commit on schedule or when force_publish is true: ${{ github.event_name == 'schedule' || inputs.force_publish }}" | ||
|
||
- name: Check git status before commit | ||
run: | | ||
git status | ||
git diff --name-only || echo "No differences found" | ||
|
||
- name: Commit and push changes | ||
if: ${{ github.event_name == 'schedule' || inputs.force_publish }} | ||
id: commit | ||
uses: stefanzweifel/git-auto-commit-action@v6 | ||
with: | ||
|
@@ -78,7 +163,7 @@ jobs: | |
commit_author: GitHub Actions Bot <[email protected]> | ||
|
||
- name: publish | ||
if: ${{ inputs.force_publish || steps.commit.outputs.changes_detected == 'true' }} | ||
if: ${{ inputs.force_publish || (steps.commit.outputs.changes_detected == 'true' && github.event_name == 'schedule') }} | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.