-
-
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
373 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Data validation | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
validation: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install build dependencies | ||
run: | | ||
sudo apt-get -y install libunwind-dev binutils-dev libiberty-dev | ||
- name: Install Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Compile Austin | ||
run: | | ||
autoreconf --install | ||
./configure --enable-debug-symbols true | ||
make | ||
- name: Install runtime dependencies | ||
run: | | ||
python3.10 -m venv .venv | ||
source .venv/bin/activate | ||
pip install --upgrade pip | ||
pip install -r scripts/requirements-val.txt | ||
deactivate | ||
- name: Run data validation | ||
run: | | ||
ulimit -c unlimited | ||
source .venv/bin/activate | ||
python scripts/validation.py --format markdown | tee comment.txt | ||
deactivate | ||
- name: Post results on PR | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
path: comment.txt |
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.