Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from zivid/split-requirements-files
Restructure pipeline workflow
- Loading branch information
Showing
10 changed files
with
126 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
ROOT_DIR=$(realpath "$SCRIPT_DIR/../..") | ||
|
||
pip install --upgrade pip || exit $? | ||
echo "Building zivid-python..." | ||
pip install "$ROOT_DIR" || exit $? | ||
|
||
echo Success! ["$0"] |
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
File renamed without changes.
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 @@ | ||
requests==2.22.0 |
File renamed without changes.
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,51 @@ | ||
import tempfile | ||
import sys | ||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def _run_process(args): | ||
sys.stdout.flush() | ||
try: | ||
process = subprocess.Popen(args) | ||
exit_code = process.wait() | ||
if exit_code != 0: | ||
raise RuntimeError("Wait failed with exit code {}".format(exit_code)) | ||
except Exception as ex: | ||
raise type(ex)("Process failed: '{}'.".format(" ".join(args))) from ex | ||
finally: | ||
sys.stdout.flush() | ||
|
||
|
||
def _install_pip_dependencies(): | ||
print("Installing python build requirements", flush=True) | ||
_run_process( | ||
( | ||
"pip", | ||
"install", | ||
"--requirement", | ||
"continuous-integration/python-requirements/setup.txt", | ||
) | ||
) | ||
|
||
|
||
def _install_zivid_sdk(): | ||
import requests | ||
|
||
with tempfile.TemporaryDirectory() as temp_dir: | ||
zivid_installer_url = "https://www.zivid.com/hubfs/softwarefiles/releases/1.8.1+6967bc1b-1/windows/ZividSetup_1.8.1+6967bc1b-1.exe" | ||
print("Downloading {}".format(zivid_installer_url), flush=True) | ||
zivid_installer = Path(temp_dir) / "ZividSetup.exe" | ||
response = requests.get(zivid_installer_url) | ||
zivid_installer.write_bytes(response.content) | ||
print("Installing {}".format(zivid_installer), flush=True) | ||
_run_process((str(zivid_installer), "/S")) | ||
|
||
|
||
def _main(): | ||
_install_pip_dependencies() | ||
_install_zivid_sdk() | ||
|
||
|
||
if __name__ == "__main__": | ||
_main() |
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,48 @@ | ||
import argparse | ||
import sys | ||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def _options(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--root", required=True, help="The repository root", type=Path) | ||
return parser.parse_args() | ||
|
||
|
||
def _run_process(args): | ||
sys.stdout.flush() | ||
try: | ||
process = subprocess.Popen(args) | ||
exit_code = process.wait() | ||
if exit_code != 0: | ||
raise RuntimeError("Wait failed with exit code {}".format(exit_code)) | ||
except Exception as ex: | ||
raise type(ex)("Process failed: '{}'.".format(" ".join(args))) from ex | ||
finally: | ||
sys.stdout.flush() | ||
|
||
|
||
def _test(root): | ||
_run_process( | ||
( | ||
"echo", | ||
"TODO: ", | ||
"python", | ||
"-m", | ||
"pytest", | ||
str(root), | ||
"-c", | ||
str(root / "pytest.ini"), | ||
) | ||
) | ||
|
||
|
||
def _main(): | ||
options = _options() | ||
|
||
_test(options.root) | ||
|
||
|
||
if __name__ == "__main__": | ||
_main() |