Skip to content

Setup a SLURM cluster in the GitHub CI for integration tests [MT-34] #13

Setup a SLURM cluster in the GitHub CI for integration tests [MT-34]

Setup a SLURM cluster in the GitHub CI for integration tests [MT-34] #13

Workflow file for this run

name: Setup a Slurm Cluster for tests
on: [push, pull_request]
jobs:
slurm_testing:
runs-on: ubuntu-latest
# For the action to work, you have to supply a mysql
# service as defined below.
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- "8888:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# TODO: Would like to use the SLURM cluster as a "service", so it's available
# through all the steps below..
# fake_mila:
# image: koesterlab/setup-slurm-action@v1
strategy:
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v3
# - uses: koesterlab/setup-slurm-action@v1
- uses: ./.github/custom_setup_slurm_action
- name: Test if the slurm cluster is setup correctly
run: srun --nodes=1 --ntasks=1 --cpus-per-task=1 --mem=1G --time=00:01:00 hostname
- name: Setup passwordless SSH access to localhost for tests
# Adapted from https://stackoverflow.com/a/60367309/6388696
run: |
ssh-keygen -t ed25519 -f ~/.ssh/testkey -N ''
cat > ~/.ssh/config <<EOF
Host localhost
User $USER
HostName 127.0.0.1
IdentityFile ~/.ssh/testkey
EOF
echo -n 'from="127.0.0.1" ' | cat - ~/.ssh/testkey.pub > ~/.ssh/authorized_keys
chmod og-rw ~
ssh -o 'StrictHostKeyChecking no' localhost id
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --with=dev
- name: Launch unit tests that require a connection to a SLURM cluster
run: poetry run pytest tests/cli/test_slurm_remote.py -s
env:
SLURM_CLUSTER: localhost