Skip to content

Commit

Permalink
try updated workflow
Browse files Browse the repository at this point in the history
*** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨🍰✨***

test if this workflow runs

add license header

add nlp_demos/falcon/utils/configuration_RW.py to ignore list

update path and re test workflow

try this path

introduce test file

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

try this workflow

remove this and -- workflow should pass

test another workflow

remove and test

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

check if workflow does not fail

remove pytorch perceiverio
  • Loading branch information
anirudTT committed Jun 10, 2024
1 parent 0650aad commit 36e970f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 87 deletions.
96 changes: 64 additions & 32 deletions .github/workflows/license-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ on:

jobs:
check-spdx-licenses:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
cache: "pip"
- name: Install check-copyright
python-version: "3.8"
- name: Install copyright check tool
run: pip install git+https://github.com/espressif/check-copyright.git@master
- name: Check SPDX licenses
id: check_spdx_licenses
Expand All @@ -30,37 +31,68 @@ jobs:
output=$(python -m check_copyright --verbose --dry-run --config ./check_copyright_config.yaml . 2>&1)
exit_code=$?
clean_output=$(echo "$output" | sed 's/\x1b\[[0-9;]*m//g')
echo "$clean_output"
echo "clean_output<<EOF" >> $GITHUB_ENV
echo "CLEAN_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$clean_output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "exit_code=$exit_code" >> $GITHUB_ENV
echo "EXIT_CODE=$exit_code" >> $GITHUB_ENV
exit 0
- name: Add PR comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
- name: Debug Extracted Files
run: |
echo "Extracted Files:"
echo "$CLEAN_OUTPUT"
- name: Extract Files
id: extract_files
run: |
set +e
files=$(echo "$CLEAN_OUTPUT" | awk '
/Files which failed the copyright check:/, /Additional information about this hook and copyright headers may be found here:/ {
if ($0 !~ /Files which failed the copyright check:/ && $0 !~ /Additional information about this hook and copyright headers may be found here:/) print
}
/Some files are without a copyright note and a license header needs to be added:/, /Additional information about this hook and copyright headers may be found here:/ {
if ($0 !~ /Some files are without a copyright note and a license header needs to be added:/ && $0 !~ /Additional information about this hook and copyright headers may be found here:/) print
}' | sed 's/^ *//' | sed '/^$/d' | grep '^.')
echo "FILES<<EOF" >> $GITHUB_ENV
echo "$files" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Extracted Files: $files"
exit 0
- name: Debug Extracted Files
run: |
echo "Extracted Files:"
echo "$FILES"
- name: Extract File Paths
if: env.FILES != ''
run: |
# Extract lines starting with './' but ignore any paths following "Modified files:" until a stop marker
files_clean=$(echo "$FILES" | awk '/^Modified files:/ {ignore = 1} /^Above is a list of files/ {ignore = 0} !ignore && /^\.\// {print}' | sort | uniq)
# Save the cleaned files into a new environment variable 'FILES_CLEAN'
echo "FILES_CLEAN<<EOF" >> $GITHUB_ENV
echo "$files_clean" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Extracted Paths: $files_clean"
- name: Debug Extracted Paths
run: |
echo "Extracted Paths:"
echo "$FILES_CLEAN"
echo "---------------------------------"
- name: Comment on PR or Issue
if: env.FILES_CLEAN != ''
uses: actions/github-script@v7
with:
script: |
const output = process.env.clean_output;
const failedFilesRegex = /Files which failed the copyright check:[\s\S]*?Additional information about this hook and copyright headers may be found here:/;
const failedFilesMatch = output.match(failedFilesRegex);
if (failedFilesMatch) {
const failedFiles = failedFilesMatch[0]
.replace('Files which failed the copyright check:', '')
.replace('Additional information about this hook and copyright headers may be found here:', '')
.replace(/Some files are without a copyright note and a license header needs to be added:/, '')
.trim()
.split('\n')
.map(file => file.trim())
.filter(file => file !== '');
const filesToComment = failedFiles.join('\n');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `The following files are not compliant with the required licensing standards :\n\`\`\`\n${filesToComment}\n\`\`\` \nPlease update the license header within them. Your attention and cooperation in this matter are greatly appreciated.\nThank you.`
});
}
if (process.env.exit_code != 0) {
core.setFailed(`Check SPDX licenses failed with exit code ${process.env.exit_code}`);
}
script: |
const formattedOutput = process.env.FILES_CLEAN;
const issueNumber = context.issue.number || context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
if (formattedOutput) {
const commentBody = `Our automated SPDX license verification process has discovered that the following files are missing a license header:\n\`\`\`\n${formattedOutput}\n\`\`\`\nPlease 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.`;
await github.rest.issues.createComment({
issue_number: issueNumber,
owner: owner,
repo: repo,
body: commentBody
});
core.setFailed("SPDX license issues found.");
} else {
console.log("No SPDX license issues found.");
}
6 changes: 3 additions & 3 deletions check_copyright_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DEFAULT:
allowed_licenses:
- Apache-2.0
- MIT

license_for_new_files: Apache-2.0 # License to be used when inserting a new copyright notice

new_notice_python: |
Expand All @@ -25,8 +26,7 @@ ignore: # You can also select ignoring files here
perform_check: no # Don't check files from that block
include:
- .github/*
- __pycache__/*
- /CONTRIBUTING.md
- /MAINTAINERS.md
- /model_demos/cv_demos/yolo_v3/holli_src/*
- /model_demos/nlp_demos/falcon/utils/*
- /model_demos/nlp_demos/falcon/utils/configuration_RW.py

3 changes: 3 additions & 0 deletions model_demos/cv_demos/dla/onnx_dla.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC
# SPDX-License-Identifier: Apache-2.0

import os
import urllib

Expand Down
51 changes: 0 additions & 51 deletions model_demos/cv_demos/perceiverio/pytorch_perceiverio.py

This file was deleted.

2 changes: 1 addition & 1 deletion model_demos/tests/test_pytorch_perceiverio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def test_perceiverio_fourier_pytorch(clear_pybuda):

@pytest.mark.perceiverio
def test_perceiverio_learned_pytorch(clear_pybuda):
run_perceiverio_learned_pytorch()
run_perceiverio_learned_pytorch()

0 comments on commit 36e970f

Please sign in to comment.