add auto-deploy GHA workflow #181
Workflow file for this run
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
name: GH Actions CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * 0" | |
concurrency: | |
group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
main-tests: | |
if: "github.repository == 'Becksteinlab/propkatraj'" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macOS-latest, ubuntu-latest, windows-latest] | |
python-version: ["3.10", "3.11", "3.12"] | |
mdanalysis-version: ["latest", "develop"] | |
# Manually exclude any combinations of the test matrix that can't be run | |
exclude: | |
# The latest release of MDAnalysis only supports up to Python 3.11 | |
# so we exclude 3.12 from the test matrix (issue #69) | |
- python-version: "3.12" | |
mdanalysis-version: "latest" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build information | |
run: | | |
uname -a | |
df -h | |
ulimit -a | |
- name: Install conda dependencies | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
environment-file: devtools/environment.yml | |
add-pip-as-python-dependency: true | |
architecture: x64 | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
channels: conda-forge, defaults | |
activate-environment: propkatraj-test | |
auto-update-conda: true | |
auto-activate-base: false | |
show-channel-urls: true | |
- name: Install MDAnalysis version | |
uses: MDAnalysis/install-mdanalysis@main | |
with: | |
version: ${{ matrix.mdanalysis-version }} | |
install-tests: true | |
installer: mamba | |
shell: bash -l {0} | |
- name: Install package | |
run: | | |
python --version | |
python -m pip install . --no-deps | |
- name: Python information | |
run: | | |
which python | |
which pip | |
pip list | |
mamba info | |
mamba list | |
- name: Test imports | |
run: | | |
python -Ic "import propkatraj; print(propkatraj.__version__)" | |
- name: Run tests | |
run: | | |
pytest -n auto --cov=propkatraj --cov-report=xml -v --color=yes propkatraj/tests/ | |
- name: codecov | |
if: ${{ github.repository == 'Becksteinlab/propkatraj' | |
&& github.event_name != 'schedule' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
fail_ci_if_error: True | |
verbose: True | |
pylint_check: | |
if: "github.repository == 'Becksteinlab/propkatraj'" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Pylint | |
run: | | |
which pip | |
which python | |
pip install pylint MDAnalysis>=2.0.0 | |
- name: Run Pylint | |
env: | |
PYLINTRC: .pylintrc | |
run: | | |
pylint propkatraj | |
pypi_check: | |
if: "github.repository == 'Becksteinlab/propkatraj'" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
pip install pipx twine | |
- name: Build package | |
run: | | |
python -m pipx run build --sdist | |
- name: Check package build | |
run: | | |
DISTRIBUTION=$(ls -t1 dist/propkatraj-*.tar.gz | head -n 1) | |
test -n "${DISTRIBUTION}" || { echo "no distribution dist/propkatraj-*.tar.gz found"; exit 1; } | |
echo "twine check $DISTRIBUTION" | |
twine check $DISTRIBUTION |