Skip to content

Commit 22b3547

Browse files
authored
feat: add github workflow (#196)
This change replaces TravisCI with GitHub Actions for running CI tests.
1 parent 19086d3 commit 22b3547

File tree

6 files changed

+74
-34
lines changed

6 files changed

+74
-34
lines changed

.github/workflows/pyslurm.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: PySlurm
2+
on: [push]
3+
jobs:
4+
Build:
5+
runs-on: ubuntu-20.04
6+
strategy:
7+
matrix:
8+
python-version:
9+
- "3.6"
10+
- "3.7"
11+
- "3.8"
12+
- "3.9"
13+
fail-fast: false
14+
steps:
15+
- name: Checkout repository code
16+
uses: actions/checkout@v2
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install Dependencies
22+
run: |
23+
which python
24+
which python${{ matrix.python-version }}
25+
python${{ matrix.python-version }} -m pip install --upgrade pip
26+
python${{ matrix.python-verison }} -m pip install pipenv
27+
pipenv --python ${{matrix.python-version }} install --dev --skip-lock
28+
- name: Start Slurm Container
29+
uses: sudo-bot/action-docker-compose@latest
30+
with:
31+
cli-args: "-f docker-compose-github.yml up -d"
32+
env:
33+
PYTHON: ${{ matrix.python-version }}
34+
- name: Debug
35+
run: |
36+
docker ps -a
37+
docker version
38+
pwd
39+
ls -al
40+
docker inspect slurmctl
41+
env | sort
42+
- name: Build/Install/Test PySlurm
43+
run: |
44+
pipenv run pytest -sv scripts/run_tests_in_container.py
45+
env:
46+
PYTHON: ${{ matrix.python-version }}
47+

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

Pipfile.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
PySlurm: Slurm Interface for Python
33
***********************************
44

5-
.. image:: https://travis-ci.org/PySlurm/pyslurm.svg?branch=20.11
6-
:target: https://travis-ci.org/PySlurm/pyslurm
5+
.. image:: https://github.com/PySlurm/pyslurm/actions/workflows/pyslurm.yml/badge.svg
6+
:target: https://github.com/PySlurm/pyslurm/actions/workflows/pyslurm.yml
77

88
Overview
99
========

docker-compose-github.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.8"
2+
3+
services:
4+
slurm:
5+
image: giovtorres/docker-centos7-slurm:20.11.8
6+
hostname: slurmctl
7+
container_name: slurmctl
8+
stdin_open: true
9+
tty: true
10+
working_dir: /pyslurm
11+
environment:
12+
PYTHON: "3.9"
13+
volumes:
14+
- ${RUNNER_WORKSPACE}/pyslurm:/pyslurm

scripts/run_tests_in_container.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
"""Execute pytest inside the container."""
2+
3+
import os
4+
15
import testinfra
26

37

48
def test_run():
59
host = testinfra.get_host(f"docker://slurmctl")
6-
print(host.check_output("python3.9 setup.py build"))
7-
print(host.check_output("python3.9 setup.py install"))
10+
python = f'python{os.environ.get("PYTHON")}'
11+
print(host.check_output(f"{python} setup.py build"))
12+
print(host.check_output(f"{python} setup.py install"))
813
print(host.check_output("./scripts/configure.sh"))
14+
print(host.check_output(f"{python} -m pip uninstall --yes pytest"))
15+
print(host.check_output(f"{python} -m pip install pytest"))
916
print(host.check_output("pytest -v"))

0 commit comments

Comments
 (0)