-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds a data validation workflow. Data is validated by performing a Hotelling T2 test on the collected data.
- Loading branch information
Showing
6 changed files
with
416 additions
and
41 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 @@ | ||
import sys | ||
from itertools import product | ||
from pathlib import Path | ||
|
||
sys.path.insert(0, str(Path(__file__).parent.parent)) | ||
|
||
import tarfile | ||
from io import BytesIO | ||
from test.utils import Variant | ||
from urllib.error import HTTPError | ||
from urllib.request import urlopen | ||
import json | ||
|
||
|
||
def get_latest_release() -> str: | ||
with urlopen( | ||
"https://api.github.com/repos/p403n1x87/austin/releases/latest" | ||
) as stream: | ||
return json.loads(stream.read().decode("utf-8"))["tag_name"].strip("v") | ||
|
||
|
||
def download_release(version: str, dest: Path, variant_name: str = "austin") -> Variant: | ||
if version == "dev": | ||
return Variant(f"src/{variant_name}") | ||
|
||
binary_dest = dest / version | ||
binary = binary_dest / variant_name | ||
|
||
if not binary.exists(): | ||
prefix = "https://github.com/p403n1x87/austin/releases/download/" | ||
for flavour, v in product({"-gnu", ""}, {"", "v"}): | ||
try: | ||
with urlopen( | ||
f"{prefix}v{version}/{variant_name}-{v}{version}{flavour}-linux-amd64.tar.xz" | ||
) as stream: | ||
buffer = BytesIO(stream.read()) | ||
binary_dest.mkdir(parents=True, exist_ok=True) | ||
tar = tarfile.open(fileobj=buffer, mode="r:xz") | ||
tar.extract(variant_name, str(binary_dest)) | ||
except HTTPError: | ||
continue | ||
break | ||
else: | ||
raise RuntimeError(f"Could not download Austin version {version}") | ||
|
||
variant = Variant(str(binary)) | ||
|
||
out = variant("-V").stdout | ||
assert f"{variant_name} {version}" in out, (f"{variant_name} {version}", out) | ||
|
||
return variant | ||
|
||
|
||
def download_latest(dest: Path, variant_name: str = "austin") -> Variant: | ||
return download_release(get_latest_release(), dest, variant_name) | ||
|
||
|
||
def get_dev(variant_name: str = "austin") -> Variant: | ||
return download_release("dev", None, variant_name) |
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,3 @@ | ||
austin-python~=1.5 | ||
numpy | ||
scipy |
Oops, something went wrong.