-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
2,220 additions
and
982 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright (c) 2020-2021, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
name: Copyright check | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.run_id }} | ||
fetch-depth: 0 | ||
|
||
- name: Check files have copyright notice | ||
run: | | ||
cd ${{ github.run_id }} | ||
# Files ending with .py should have Copyright notice in the first 10 lines | ||
find_files_with_missing_copyright() { | ||
find ./ -type f -name '*.py' -not -path "./.git/*" -not -path "./*__init__.py" | while read path; do | ||
echo -en $path"\t" | ||
head -n 10 $path | tr '\n' '\t' | sed 's/\t$/\n/' | ||
done \ | ||
| egrep -iv 'Copyright.*NVIDIA CORPORATION.*' \ | ||
| egrep -iv '*MIT.*Licen.e.*' \ | ||
| egrep -iv '*Copyright.*Apache.*' \ | ||
| egrep -iv '*Apache.*License.*' \ | ||
| while read line; do | ||
echo $line | cut -d' ' -f1 | ||
done | ||
} | ||
declare RESULT=($(find_files_with_missing_copyright)) # (..) = array | ||
if [ "${#RESULT[@]}" -gt 0 ]; then | ||
echo "Error: Found files with missing copyright:" | ||
for (( i=0; i<"${#RESULT[@]}"; i++ )); do | ||
echo "path= ${RESULT[$i]}" | ||
done | ||
exit 1; | ||
else | ||
echo "Ok: All (Python) files start with copyright notice" | ||
fi |
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,35 +1,37 @@ | ||
# # Copyright (c) 2020-2021, NVIDIA CORPORATION. | ||
# # | ||
# # Licensed under the Apache License, Version 2.0 (the "License"); | ||
# # you may not use this file except in compliance with the License. | ||
# # You may obtain a copy of the License at | ||
# # | ||
# # http://www.apache.org/licenses/LICENSE-2.0 | ||
# # | ||
# # Unless required by applicable law or agreed to in writing, software | ||
# # distributed under the License is distributed on an "AS IS" BASIS, | ||
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# # See the License for the specific language governing permissions and | ||
# # limitations under the License. | ||
# name: Secrets detector | ||
# Copyright (c) 2020-2021, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
name: Secrets detector | ||
|
||
# on: | ||
# pull_request: | ||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
# jobs: | ||
# main: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# path: ${{ github.run_id }} | ||
# fetch-depth: 0 | ||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.run_id }} | ||
fetch-depth: 0 | ||
|
||
# - name: Install secrets detector | ||
# run: pip install detect-secrets | ||
- name: Install secrets detector | ||
run: pip install detect-secrets | ||
|
||
# - name: Run on change-set | ||
# run: | | ||
# cd ${{ github.run_id }} | ||
# git diff --name-only --diff-filter=d --merge-base origin/${{ github.base_ref }} -z | xargs -0 detect-secrets-hook --baseline .github/workflows/config/.secrets.baseline | ||
- name: Run on change-set | ||
run: | | ||
cd ${{ github.run_id }} | ||
git diff --name-only --diff-filter=d --merge-base origin/main -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline |
This file contains 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
Oops, something went wrong.