Skip to content
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
84 changes: 73 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,96 @@ name: Run Python Test
on: [push, pull_request]

jobs:
build-and-test:
build-and-test-ubuntu:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install prerequisites
shell: bash -e {0}
run: |
ansible-galaxy role install https://github.com/galaxyproject/ansible-slurm/archive/1.0.1.tar.gz
sudo apt-get update
pip install ninja
- name: Setup ansible playbook for slurm
uses: 1arp/create-a-file-action@0.2
with:
file: slurm-playbook.yml
content: |
- name: Slurm all in One
hosts: localhost
roles:
- role: 1.0.1
become: true
vars:
slurm_upgrade: true
slurm_roles: ['controller', 'exec']
slurm_config_dir: /etc/slurm
slurm_config:
ClusterName: cluster
SlurmctldLogFile: /var/log/slurm/slurmctld.log
SlurmctldPidFile: /run/slurmctld.pid
SlurmdLogFile: /var/log/slurm/slurmd.log
SlurmdPidFile: /run/slurmd.pid
SlurmdSpoolDir: /tmp/slurmd # the default /var/lib/slurm/slurmd does not work because of noexec mounting in github actions
StateSaveLocation: /var/lib/slurm/slurmctld
SelectType: select/cons_tres
slurm_create_user: yes
slurm_nodes:
- name: localhost
State: UNKNOWN
Sockets: 1
CoresPerSocket: 2
RealMemory: 2000
slurm_user:
comment: "Slurm Workload Manager"
gid: 1002
group: slurm
home: "/var/lib/slurm"
name: slurm
shell: "/bin/bash"
uid: 1002
- name: Setup slurm
shell: bash -e {0}
run: |
mkdir -p /tmp/1002-runtime # work around podman issue (https://github.com/containers/podman/issues/13338)
echo XDG_RUNTIME_DIR=/tmp/1002-runtime >> $GITHUB_ENV
ansible-playbook slurm-playbook.yml || (journalctl -xe && exit 1)
- name: Install simexpal
run: |
pip install .
- name: Run tests
run: |
pip install pytest
pytest

build-and-test-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python latest
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install libomp (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install libomp
- name: Install ninja
run: |
python -m pip install ninja
pip install ninja
- name: Install simexpal
run: |
python -m pip install --upgrade pip
pip install .
- name: Run tests
run: |
pip install pytest==6.2.5
pytest
pip install pytest
pytest -k "not slurm"

# This job checks whether the current workflow is triggered by a new tag with the following form: INT.INT or INT.INT.INT (for example: 1.0, 1.0.1, ...)
# The result is saved in a variable and used as a conditional variable when uploading packages.
Expand All @@ -52,7 +115,7 @@ jobs:
if: needs.check-release-tag.outputs.is-release == 'true' && github.repository == 'hu-macsy/simexpal'
name: 'PyPi release upload'
runs-on: ubuntu-20.04
needs: [build-and-test, check-release-tag]
needs: [build-and-test-ubuntu, check-release-tag]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
Expand All @@ -61,7 +124,6 @@ jobs:
python-version: 3.11
- name: Create wheel
run: |
python -m pip install --upgrade pip
pip install wheel
python3 -m pip wheel ./ --wheel-dir=./dist --no-deps
- name: Create source package
Expand Down
16 changes: 10 additions & 6 deletions tests/cli/test_experiments.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@

import os
import pytest
import subprocess

file_dir = os.path.abspath(os.path.dirname(__file__))
yml_dirs = ['/../../examples/sorting/'] # List of directories that should be tested.

@pytest.mark.parametrize('rel_yml_path', yml_dirs)
def test_simex_e_launch_fork(rel_yml_path):

@pytest.mark.parametrize("launcher", ["fork", "slurm"])
@pytest.mark.parametrize("rel_yml_path", yml_dirs)
def test_simex_e_launch(launcher, rel_yml_path):
# Make sure that the needed instances are installed.
# The main test follows afterwards.
cwd = file_dir + rel_yml_path
ret_code = subprocess.check_call(['simex', 'i', 'install'], cwd=cwd)
ret_code = subprocess.check_call(["simex", "i", "install"], cwd=cwd)
assert ret_code == 0

ret_code = subprocess.check_call(['simex', 'e', 'launch', '--launch-through=fork'], cwd=cwd)
ret_code = subprocess.check_call(
["simex", "e", "launch", f"--launch-through={launcher}"], cwd=cwd
)

assert ret_code == 0

@pytest.mark.parametrize('rel_yml_path', yml_dirs)

@pytest.mark.parametrize("rel_yml_path", yml_dirs)
def test_simex_e_purge_all(rel_yml_path):
cwd = file_dir + rel_yml_path
ret_code = subprocess.check_call(['simex', 'e', 'purge', '--all', '-f'], cwd=cwd)
Expand Down
Loading