Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pip install #15

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/wheels.yml → .github/workflows/pip-install.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: wheels
name: pip-install

on:
release:
Expand All @@ -8,17 +8,22 @@ on:
jobs:

build:
name: Build source distribution
runs-on: ubuntu-latest
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python: ['3.7', '3.8', '3.9']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.8"
python-version: ${{ matrix.python }}

- name: Build
run: |
Expand All @@ -37,7 +42,7 @@ jobs:
venv-wheel/bin/python -m pip install dist/multiplanet*.whl
venv-wheel/bin/python -c "import multiplanet; print(multiplanet.__version__)"

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: dist/*

Expand All @@ -46,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
Expand Down
27 changes: 16 additions & 11 deletions tests/Bigplanet/test_bigplanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,39 @@
import subprocess
import sys
import warnings

import shutil
import numpy as np


def test_mp_bigplanet():
# gets current path
def test_bigplanet():
# Get current path
path = pathlib.Path(__file__).parents[0].absolute()
sys.path.insert(1, str(path.parents[0]))

# gets the number of cores on the machine
dir = (path / "MP_Bigplanet")
checkpoint = (path / ".MP_Bigplanet")

# Get the number of cores on the machine
cores = mp.cpu_count()
if cores == 1:
warnings.warn("There is only 1 core on the machine", stacklevel=3)
else:
# Remove anything from previous tests
if (dir).exists():
shutil.rmtree(dir)
if (checkpoint).exists():
os.remove(checkpoint)

# Run vspace
if not (path / "MP_Bigplanet").exists():
subprocess.check_output(["vspace", "vspace.in"], cwd=path)
subprocess.check_output(["vspace", "vspace.in"], cwd=path)

# Run multi-planet
if not (path / ".MP_Bigplanet").exists():
subprocess.check_output(
["multiplanet", "vspace.in", "-bp"], cwd=path
)
subprocess.check_output(["multiplanet", "vspace.in", "-bp"], cwd=path)

file = path / "MP_Bigplanet.bpa"

assert os.path.isfile(file) == True


if __name__ == "__main__":
test_mp_bigplanet()
test_bigplanet()
44 changes: 44 additions & 0 deletions tests/Checkpoint/test_checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import subprocess
import numpy as np
import os
import multiprocessing as mp
import warnings
import pathlib
import sys
import shutil

def test_checkpoint():
# Get current path
path = pathlib.Path(__file__).parents[0].absolute()
sys.path.insert(1, str(path.parents[0]))

dir = (path / "MP_Checkpoint")
checkpoint = (path / ".MP_Checkpoint")

# Get the number of cores on the machine
cores = mp.cpu_count()
if cores == 1:
warnings.warn("There is only 1 core on the machine",stacklevel=3)
else:
# Remove anything from previous tests
if (dir).exists():
shutil.rmtree(dir)
if (checkpoint).exists():
os.remove(checkpoint)

# Run vspace
subprocess.check_output(["vspace", "vspace.in"], cwd=path)

# Run multi-planet
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Gets list of folders
folders = sorted([f.path for f in os.scandir(dir) if f.is_dir()])

for i in range(len(folders)):
os.chdir(folders[i])
assert os.path.isfile('earth.earth.forward') == True
os.chdir('../')

if __name__ == "__main__":
test_checkpoint()
40 changes: 0 additions & 40 deletions tests/Checkpoint/test_multi-planet_checkpoint.py

This file was deleted.

38 changes: 21 additions & 17 deletions tests/MpStatus/test_mpstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,37 @@
import subprocess
import sys
import warnings

import numpy as np

import pathlib
import shutil

def test_mpstatus():
# gets current path
# Get current path
path = pathlib.Path(__file__).parents[0].absolute()
sys.path.insert(1, str(path.parents[0]))

# gets the number of cores on the machine
dir = (path / "MP_Status")
checkpoint = (path / ".MP_Status")

# Get the number of cores on the machine
cores = mp.cpu_count()
if cores == 1:
warnings.warn("There is only 1 core on the machine", stacklevel=3)
else:
# Remove anything from previous tests
if (dir).exists():
shutil.rmtree(dir)
if (checkpoint).exists():
os.remove(checkpoint)

# Run vspace
if not (path / "MP_Status").exists():
subprocess.check_output(["vspace", "vspace.in"], cwd=path)

# Run multi-planet
if not (path / ".MP_Status").exists():
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
subprocess.check_output(["mpstatus", "vspace.in"], cwd=path)

# gets list of folders
folders = sorted(
[f.path for f in os.scandir(path / "MP_Status") if f.is_dir()]
)
subprocess.check_output(["vspace", "vspace.in"], cwd=path)

# Run multi-planet and mpstatus
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
subprocess.check_output(["mpstatus", "vspace.in"], cwd=path)

# Get list of folders
folders = sorted([f.path for f in os.scandir(dir) if f.is_dir()])

for i in range(len(folders)):
os.chdir(folders[i])
Expand Down
40 changes: 0 additions & 40 deletions tests/Parallel/test_multi-planet_parallel.py

This file was deleted.

43 changes: 43 additions & 0 deletions tests/Parallel/test_parallel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import subprocess
import numpy as np
import os
import pathlib
import multiprocessing as mp
import warnings
import sys
import shutil

def test_parallel():
# Get current path
path = pathlib.Path(__file__).parents[0].absolute()
sys.path.insert(1, str(path.parents[0]))

dir = (path / "MP_Parallel")
checkpoint = (path / ".MP_Parallel")

# Get the number of cores on the machine
cores = mp.cpu_count()
if cores == 1:
warnings.warn("There is only 1 core on the machine",stacklevel=3)
else:
# Remove anything from previous tests
if (dir).exists():
shutil.rmtree(dir)
if (checkpoint).exists():
os.remove(checkpoint)

# Run vspace
subprocess.check_output(["vspace", "vspace.in"], cwd=path)

# Run multi-planet
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

folders = sorted([f.path for f in os.scandir(dir) if f.is_dir()])

for i in range(len(folders)):
os.chdir(folders[i])
assert os.path.isfile('earth.earth.forward') == True
os.chdir('../')

if __name__ == "__main__":
test_parallel()
35 changes: 0 additions & 35 deletions tests/Serial/test_multi-planet_serial.py

This file was deleted.

Loading
Loading