-
Notifications
You must be signed in to change notification settings - Fork 1
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 #22 from saudzahirr/Fix-ci/cd-pipeline
Fix ci/cd pipeline
- Loading branch information
Showing
384 changed files
with
245 additions
and
149 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,2 @@ | ||
#!/usr/bin/bash | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,57 @@ | ||
name: Linux Build and Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- Fix-ci/cd-pipeline | ||
pull_request: | ||
branches: | ||
- master | ||
- Fix-ci/cd-pipeline | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create Environment | ||
run: | | ||
conda env create -f environment.yml | ||
- name: Build | ||
run: | | ||
source $(conda info --base)/etc/profile.d/conda.sh | ||
conda activate vm | ||
python install.py install | ||
vonMises -m test/test-data/MATRIX.mat -k A > vonMises.log 2>&1 | ||
- name: Unittest | ||
run: | | ||
source $(conda info --base)/etc/profile.d/conda.sh | ||
conda activate vm | ||
pytest -s test/unit-test | ||
- name: Code Lint | ||
run: | | ||
source $(conda info --base)/etc/profile.d/conda.sh | ||
conda activate vm | ||
ruff version | ||
ruff format --check . | ||
ruff check --output-format=github . | ||
- name: Archive Logs | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: test-logs | ||
path: | | ||
build.log | ||
vonMises.log | ||
test/unit-test.log | ||
test/*.log |
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,53 @@ | ||
name: Windows Build and Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- Fix-ci/cd-pipeline | ||
pull_request: | ||
branches: | ||
- master | ||
- Fix-ci/cd-pipeline | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Miniconda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
|
||
- name: Create Environment | ||
run: conda env create -f environment.yml | ||
|
||
- name: Build | ||
run: | | ||
conda activate vm | ||
python install.py install | ||
vonMises -m test\test-data\MATRIX.mat -k A > vonMises.log 2>&1 | ||
- name: Unittest | ||
run: | | ||
conda activate vm | ||
pytest -s test\unit-test | ||
- name: Code Lint | ||
run: | | ||
conda activate vm | ||
ruff version | ||
ruff format --check . | ||
ruff check --output-format=github . | ||
- name: Archive Logs | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: test-logs | ||
path: | | ||
build.log | ||
vonMises.log | ||
test\unit-test.log | ||
test\*.log |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
__pycache__ | ||
.vscode/ | ||
.ruff_cache | ||
.pytest_cache | ||
|
||
*.egg-info | ||
_skbuild/ | ||
|
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ name: vm | |
channels: | ||
- conda-forge | ||
dependencies: | ||
- python=3.11 | ||
- python | ||
- pip | ||
- wheel | ||
- setuptools | ||
|
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 |
---|---|---|
@@ -1,12 +1,70 @@ | ||
import subprocess | ||
import time | ||
import shlex | ||
import shutil | ||
import subprocess | ||
import sys | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
|
||
wheel_cmd = shlex.split("python -m build -n -x --wheel") | ||
build_cmd = shlex.split("pip wheel . -v -w dist ") | ||
install_cmd = shlex.split("pip install . -v") | ||
develop_cmd = shlex.split("pip install -e . -v") | ||
|
||
|
||
def main(args=sys.argv[1:]): | ||
prog = ArgumentParser(prog="Build vonMises") | ||
prog.add_argument( | ||
"mode", | ||
help="""Build mode: | ||
wheel -- only builds the wheel | ||
develop -- creates an editable install | ||
install -- performs a normal install | ||
clean -- removes all build data""", | ||
type=str, | ||
choices=["wheel", "install", "develop", "clean"], | ||
) | ||
|
||
args = prog.parse_args(args) | ||
|
||
# Log to a file | ||
log_file = "build.log" | ||
|
||
def run_command(command, log_file=log_file): | ||
with open(log_file, "w") as log: | ||
subprocess.run(command, check=True, stdout=log, stderr=log) | ||
|
||
if args.mode == "wheel": | ||
print("Starting wheel build") | ||
run_command(build_cmd) | ||
|
||
elif args.mode == "install": | ||
print("Starting install") | ||
run_command(install_cmd) | ||
|
||
elif args.mode == "develop": | ||
print("Starting development build") | ||
run_command(develop_cmd) | ||
print("Finished development build") | ||
|
||
elif args.mode == "clean": | ||
print("Starting cleanup") | ||
subprocess.run(shlex.split("python -m pip uninstall vonMises -y"), check=True) | ||
subprocess.run(shlex.split("git clean -xdff"), cwd="src", check=True) | ||
|
||
for entry in Path("").iterdir(): | ||
if entry.name in [ | ||
"_skbuild", | ||
"dist", | ||
"build", | ||
".pytest_cache", | ||
] or entry.name.endswith("egg-info"): | ||
print(f"Removing '{entry}'") | ||
shutil.rmtree(entry) | ||
if entry.suffix == ".log": | ||
print(f"Removing '{entry}'") | ||
entry.unlink() | ||
print("Finished cleanup") | ||
|
||
wheel_cmd = shlex.split("python -m pip wheel . -v -w dist ") | ||
install_cmd = shlex.split("python -m pip install -e . -v") | ||
|
||
with open("build.log", "w") as log: | ||
rv = subprocess.Popen(wheel_cmd, stdout=log, stderr=log) | ||
while rv.poll() is None: | ||
time.sleep(0.5) | ||
subprocess.run(install_cmd, stdout=log, stderr=log) | ||
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
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
import sys | ||
from skbuild import setup | ||
|
||
setup() | ||
cmake_args = [] | ||
if sys.platform == "win32": | ||
cmake_args.append("-G") | ||
cmake_args.append("MinGW Makefiles") | ||
|
||
setup(cmake_args=cmake_args) |
File renamed without changes.
Oops, something went wrong.