Skip to content

Commit

Permalink
decouple CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyminium committed Apr 7, 2024
1 parent 7c5ae8d commit e8b3fb5
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 7 deletions.
166 changes: 166 additions & 0 deletions .github/workflows/gh-ci-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: GH Actions CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Weekly tests at midnight on Sundays run on main by default:
# Scheduled workflows run on the latest commit on the default or base branch.
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
- cron: "0 0 * * 0"

concurrency:
# Specific group naming so CI is only cancelled
# within same PR or on merge to main
group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

jobs:
environment-config:
runs-on: ubuntu-latest
outputs:
stable-python-version: ${{ steps.get-python-version.outputs.python-version }}
steps:
- uses: actions/checkout@v4

- id: get-compatible-python
uses: MDAnalysis/mdanalysis-compatible-python@main
with:
release: "develop"

main-tests:
if: "github.repository == 'MDAnalysis/mdahole2'"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: {% raw %}${{ fromJSON(needs.environment-config.outputs.python-matrix) }}{% endraw %}
mdanalysis-version: develop

steps:
- uses: actions/checkout@v3

- name: Build information
run: |
uname -a
df -h
ulimit -a
# More info on options: https://github.com/conda-incubator/setup-miniconda
- name: Install conda dependencies
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
environment-file: devtools/conda-envs/test_env.yaml
add-pip-as-python-dependency: true
architecture: x64

miniforge-variant: Mambaforge
use-mamba: true
channels: conda-forge, defaults

activate-environment: mdahole2-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: false
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
conda info
conda list
- name: Run tests
env:
DUECREDIT_ENABLE: 'yes'
run: |
pytest -n 2 -v --cov=mdahole2 --cov-report=xml --color=yes mdahole2/tests/
- name: codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
verbose: True


pylint_check:
if: "github.repository == 'MDAnalysis/mdahole2'"
needs: environment-config
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ needs.environment-config.outputs.stable-python-version }}

- name: Install Pylint
run: |
which pip
which python
pip install pylint
- name: Run Pylint
env:
PYLINTRC: .pylintrc
run: |
pylint mdahole2
pypi_check:
if: "github.repository == 'MDAnalysis/mdahole2'"
needs: environment-config
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ needs.environment-config.outputs.stable-python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ needs.environment-config.outputs.stable-python-version }}

- 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/mdahole2-*.tar.gz | head -n 1)
test -n "${DISTRIBUTION}" || { echo "no distribution dist/mdahole2-*.tar.gz found"; exit 1; }
echo "twine check $DISTRIBUTION"
twine check $DISTRIBUTION
13 changes: 6 additions & 7 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- id: get-python-version
uses: MDAnalysis/get-latest-python-version@main
- id: get-compatible-python
uses: MDAnalysis/mdanalysis-compatible-python@main
with:
last-n-minor-release: 1
release: "latest"

main-tests:
if: "github.repository == 'MDAnalysis/mdahole2'"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# os: [macOS-latest, ubuntu-latest, windows-latest]
os: [ubuntu-latest, macOS-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
mdanalysis-version: ["latest", "develop"]
os: [macOS-latest, ubuntu-latest]
python-version: {% raw %}${{ fromJSON(needs.environment-config.outputs.python-matrix) }}{% endraw %}
mdanalysis-version: latest

steps:
- uses: actions/checkout@v3
Expand Down

0 comments on commit e8b3fb5

Please sign in to comment.