Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions .github/workflows/scancode-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,7 @@ jobs:
path: dist

- name: test install app archive
run: |
for f in `find dist -type f -name "*.zip"`; \
do \
unzip file.zip $f; \
done
for f in `find dist -type f -name "*.tar.gz"`; \
do \
python etc/release/scancode_release_tests.py $f; \
done
run: python etc/release/scancode_release_tests.py --directory dist


smoke_test_install_and_run_app_archives_on_macos:
Expand Down Expand Up @@ -393,15 +385,7 @@ jobs:
path: dist

- name: test install app archive
run: |
for f in `find dist -type f -name "*.zip"`; \
do \
unzip file.zip $f; \
done
for f in `find dist -type f -name "*.tar.gz"`; \
do \
python etc/release/scancode_release_tests.py $f; \
done
run: python etc/release/scancode_release_tests.py --directory dist


smoke_test_install_and_run_app_archives_on_windows:
Expand Down Expand Up @@ -438,8 +422,7 @@ jobs:
path: dist

- name: test install app archive
run: |
for %%F in (dist/*.zip) do python etc/release/scancode_release_tests.py dist/%%F
run: python etc/release/scancode_release_tests.py --directory dist

publish_to_gh_release:
permissions:
Expand Down
52 changes: 49 additions & 3 deletions etc/release/scancode_release_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,35 @@

import os
import shutil
import glob
import subprocess
import sys

on_windows = "win32" in str(sys.platform).lower()


def find_app_archives(directory: str):
"""
Find all application archives in the given directory.
Supported formats:
- .tar.gz
- .zip
"""
if not os.path.isdir(directory):
print(f"Directory does not exist: {directory}")

patterns = ("*.tar.gz", "*.zip")

archives = []
for pattern in patterns:
archives.extend(glob.glob(os.path.join(directory, pattern)))

if not archives:
print(f"No app archives found in {directory}")
sys.exit(1)

return archives

def run_app_smoke_tests(app_archive):
"""
Run basic "smoke" scancode tests for the app release archive `app_archive`
Expand Down Expand Up @@ -112,8 +135,31 @@ def run_command(args):
print(cpe.output)
sys.exit(128)

def main():
args = sys.argv[1:]

if not args:
print("ERROR: No arguments provided")
print("Usage:")
print(" python scancode_release_tests.py <archive_path>")
print(" python scancode_release_tests.py --directory <dir_path>")
sys.exit(1)

if args[0] == "--directory":
if len(args) < 2:
print("--directory flag requires a directory path")
sys.exit(1)
directory = args[1]
if not os.path.isdir(directory):
print(f"Directory does not exist: {directory}")
sys.exit(1)

archives = find_app_archives(directory)
for archive in archives:
run_app_smoke_tests(archive)
else:
archive = args[0]
run_app_smoke_tests(archive)

if __name__ == "__main__":
args = sys.argv[1:]
archive = args[0]
run_app_smoke_tests(archive)
main()
Loading