-
Notifications
You must be signed in to change notification settings - Fork 30
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
1 parent
0399793
commit b897b9c
Showing
14 changed files
with
318 additions
and
247 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Build wheel from source using tox. | ||
name: build_wheel | ||
on: [push, pull_request] | ||
permissions: read-all | ||
jobs: | ||
build_wheel: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
include: | ||
- python-version: '3.7' | ||
toxenv: 'py37' | ||
- python-version: '3.8' | ||
toxenv: 'py38' | ||
- python-version: '3.9' | ||
toxenv: 'py39' | ||
- python-version: '3.10' | ||
toxenv: 'py310' | ||
- python-version: '3.11' | ||
toxenv: 'py311' | ||
- python-version: '3.12' | ||
toxenv: 'py312' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install build dependencies | ||
run: | | ||
sudo add-apt-repository universe && | ||
sudo add-apt-repository -y ppa:deadsnakes/ppa && | ||
sudo apt-get update && | ||
sudo apt-get install -y autoconf automake autopoint build-essential git libtool pkg-config python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools | ||
- name: Install tox | ||
run: | | ||
python3 -m pip install tox | ||
- name: Download test data | ||
run: | | ||
if test -x "synctestdata.sh"; then ./synctestdata.sh; fi | ||
- name: Prepare build | ||
run: | | ||
./synclibs.sh --use-head && ./autogen.sh && ./configure | ||
- name: Build Python wheel | ||
run: | | ||
tox -e${{ matrix.toxenv }} |
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
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,77 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Script to run Python test scripts. | ||
# | ||
# Version: 20231009 | ||
|
||
import glob | ||
import os | ||
import sys | ||
import unittest | ||
|
||
|
||
test_profile = ".pyvhdi" | ||
input_glob = "*" | ||
option_sets = [] | ||
|
||
|
||
def ReadIgnoreList(test_profile): | ||
"""Reads the test profile ignore file if it exists. | ||
Args: | ||
test_profile (str): test profile. | ||
Returns: | ||
set[str]: ignore list. | ||
""" | ||
ignore_file_path = os.path.join("tests", "input", test_profile, "ignore") | ||
if os.path.isfile(ignore_file_path): | ||
with open(ignore_file_path, "r", encoding="utf-8") as file_object: | ||
return set([line.strip() for line in file_object.readlines()]) | ||
|
||
return set() | ||
|
||
|
||
if __name__ == "__main__": | ||
print(f"Using Python version {sys.version!s}") | ||
|
||
test_loader = unittest.TestLoader() | ||
test_runner = unittest.TextTestRunner(verbosity=2) | ||
|
||
test_scripts = test_loader.discover("tests", pattern="*.py") | ||
|
||
ignore_list = ReadIgnoreList(test_profile) | ||
|
||
test_set = None | ||
source_file = None | ||
|
||
for test_set in glob.glob(os.path.join("tests", "input", "*")): | ||
test_set = test_set.rsplit(os.path.sep, maxsplit=1)[-1] | ||
if not test_set or test_set[0] == '.' or test_set in ignore_list: | ||
continue | ||
|
||
source_files = glob.glob(os.path.join( | ||
"tests", "input", test_set, input_glob)) | ||
if source_files: | ||
source_file = source_files[0] | ||
break | ||
|
||
setattr(unittest, "source", source_file) | ||
|
||
if source_file: | ||
for option_set in option_sets: | ||
test_file = os.path.basename(source_file) | ||
test_options_file_path = os.path.join( | ||
"tests", "input", test_profile, test_set, | ||
f"{test_file:s}.{option_set:s}") | ||
if os.path.isfile(test_options_file_path): | ||
with open(test_options_file_path, "r", encoding="utf-8") as file_object: | ||
lines = [line.strip() for line in file_object.readlines()] | ||
if lines[0] == "# libyal test data options": | ||
for line in lines[1:]: | ||
key, value = line.split("=", maxsplit=1) | ||
setattr(unittest, key, value) | ||
|
||
test_results = test_runner.run(test_scripts) | ||
if not test_results.wasSuccessful(): | ||
sys.exit(1) |
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.