Skip to content

Merge pull request #39 from libAtoms/pyproject_toml #154

Merge pull request #39 from libAtoms/pyproject_toml

Merge pull request #39 from libAtoms/pyproject_toml #154

Workflow file for this run

name: Build and test
# on all push actions AND can be triggered manually as well
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies and expyre
run: |
pip install flake8 pytest pytest-cov
- name: Install and configure slurm and ExPyRe
run: |
sudo apt-get install -u slurm-wlm mailutils
echo "SLURM apt-get done, doing local configuration"
host_s=$( hostname -s )
if [ -f /etc/slurm/slurm.conf ]; then sudo mv /etc/slurm/slurm.conf /etc/slurm/slurm.conf.orig; fi
sudo bash -c 'gzip -cd /usr/share/doc/slurmd/examples/slurm.conf.simple.gz > /etc/slurm/slurm.conf'
# sudo sed -E -i -e "s/^\s*ClusterName\s*=.*/ClusterName=github_expyre_test/" /etc/slurm/slurm.conf
sudo bash -c 'sed -E -i -e "s/^\s*SlurmctldHost\s*=.*/SlurmctldHost=_HOST_/" /etc/slurm/slurm.conf'
# sudo sed -E -i -e "s/^\s*DefaultStorageHost\s*=.*/DefaultStorageHost=none" /etc/slurm/slurm.conf
sudo bash -c 'echo "NodeName=_HOST_ CPUs=2 Weight=1 Sockets=1 CoresPerSocket=2 ThreadsPerCore=1 RealMemory=1000" >> /etc/slurm/slurm.conf'
sudo bash -c 'echo "PartitionName=standard Default=YES AllocNodes=_HOST_ Nodes=ALL State=UP" >> /etc/slurm/slurm.conf'
sudo sed -i -e "s/_HOST_/$host_s/g" /etc/slurm/slurm.conf
sudo mkdir -p /var/log/slurm
sudo mkdir -p /var/spool/slurmd
sudo service slurmd start
sudo service slurmctld start
sleep 5
echo "sinfo -s --long"
sinfo -s --long
mkdir $HOME/.expyre
cp .github/workflows_assets/config.json $HOME/.expyre
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 expyre/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 expyre/ --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
# - name: Test with pytest - no coverage
# run: |
# # env EXPYRE_PYTEST_SYSTEMS=github EXPYRE_PYTEST_MAX_NUM_NODES=1 pytest -v --clean -rxXs --basetemp $HOME/pytest
# env EXPYRE_PYTEST_SYSTEMS=github EXPYRE_PYTEST_MAX_NUM_NODES=1 pytest -v --clean -rxXs --basetemp $HOME/pytest
- name: Test with pytest - coverage
run: |
env EXPYRE_PYTEST_QUEUED_JOB_RESOURCES=$PWD/.github/workflows_assets/EXPYRE_PYTEST_QUEUED_JOB_RESOURCES.json EXPYRE_PYTEST_SYSTEMS=github EXPYRE_PYTEST_MAX_NUM_NODES=1 pytest -v --cov=expyre --cov-report term --cov-report html --cov-config=tests/.coveragerc --cov-report term-missing --cov-report term:skip-covered --clean -rxXs --basetemp $HOME/pytest
# - name: Upload Coverage Data
# uses: actions/upload-artifact@v2
# with:
# name: coverage-html
# path: coverage-html/
# retention-days: 7
docs:
runs-on: ubuntu-latest
needs: build
# if: github.ref == 'refs/heads/public'
steps:
- uses: actions/checkout@v2
- name: Build documentation
run: |
pip install sphinx sphinx-book-theme docutils==0.16 sphinx-click
pip install --upgrade jinja2
cd docs
make html
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html