Merge pull request #129 from nlesc-nano/dependabot/github_actions/act… #233
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: ${{ matrix.os }}; py ${{ matrix.version }}${{ matrix.special }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
special: [""] | |
include: | |
- os: ubuntu-latest | |
special: '; pre-release' | |
version: '3.11' | |
- os: ubuntu-latest | |
special: '; slow' | |
version: '3.11' | |
env: | |
CP2K_DATA_DIR: "/home/runner/work/nano-CAT/nano-CAT/cp2k/data" | |
MATCH: "/home/runner/work/nano-CAT/nano-CAT/MATCH/MATCH" | |
PerlChemistry: "/home/runner/work/nano-CAT/nano-CAT/MATCH/PerlChemistry" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cp2k | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
git clone https://github.com/cp2k/cp2k -q | |
cd cp2k | |
git -c advice.detachedHead=false checkout tags/v9.1.0 | |
wget -nv https://github.com/cp2k/cp2k/releases/download/v9.1.0/cp2k-9.1-Linux-x86_64.ssmp -O cp2k.ssmp | |
chmod a+rx cp2k.ssmp | |
mv cp2k.ssmp /usr/local/bin/cp2k.popt | |
- name: Install MATCH | |
if: matrix.special == '; slow' | |
run: | | |
git clone https://github.com/nlesc-nano/MATCH -q | |
cd MATCH | |
git -c advice.detachedHead=false checkout main | |
chmod -R a+rx MATCH/scripts | |
ln -s MATCH/scripts/*.pl /usr/local/bin/ | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.version }} | |
- name: Install dependencies | |
run: | | |
case "${{ matrix.special }}" in | |
"; pre-release") | |
pip install --pre -e .[test] --upgrade --force-reinstall | |
pip install git+https://github.com/nlesc-nano/CAT@master --upgrade | |
pip install git+https://github.com/nlesc-nano/auto-FOX@master --upgrade | |
pip install git+https://github.com/SCM-NV/qmflows@master --upgrade | |
pip install git+https://github.com/SCM-NV/PLAMS@master --upgrade | |
;; | |
*) | |
pip install -e .[test] | |
pip install git+https://github.com/nlesc-nano/CAT@master --upgrade | |
;; | |
esac | |
- name: Info Python | |
run: | | |
which python | |
python --version | |
- name: Info installed packages | |
run: pip list | |
- name: Info CP2K | |
if: matrix.os == 'ubuntu-latest' | |
run: cp2k.popt --version | |
- name: Run tests | |
run: | | |
case "${{ matrix.special }}" in | |
"; slow") | |
pytest -m "slow" ;; | |
*) | |
pytest -m "not slow" ;; | |
esac | |
- name: Run codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
name: codecov-umbrella | |
Linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python on ubuntu-latest | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.*" | |
- name: Install linters | |
run: pip install "flake8>=3.8.0" | |
- name: Python info | |
run: | | |
which python | |
python --version | |
- name: Installed packages | |
run: pip list | |
- name: Run flake8 | |
run: flake8 nanoCAT tests |