Skip to content

Towards a better optional package system #1315

Towards a better optional package system

Towards a better optional package system #1315

Workflow file for this run

name: "linters"
on:
pull_request:
branches:
- develop
concurrency:
# Probably overly cautious group naming.
# Commits to develop will cancel each other, but PRs will only cancel
# commits within the same PR
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
darker_lint:
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pull-requests: write
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: darker-main-code
id: darker-main-code
uses: akaihola/[email protected]
continue-on-error: true
with:
version: "~=1.6.1"
options: "--check --diff --color"
src: "./package/MDAnalysis"
revision: "HEAD^"
lint: "flake8"
- name: darker-test-code
id: darker-test-code
uses: akaihola/[email protected]
continue-on-error: true
with:
version: "~=1.6.1"
options: "--check --diff --color"
src: "./testsuite/MDAnalysisTests"
revision: "HEAD^"
lint: "flake8"
- name: get-pr-info
uses: actions/github-script@v6
with:
script:
const prNumber = context.payload.number;
core.exportVariable('PULL_NUMBER', prNumber);
- name: save-status
env:
MAIN: ${{ steps.darker-main-code.outcome }}
TEST: ${{ steps.darker-test-code.outcome }}
shell: python
run: |
import os
import json
from pathlib import Path
Path('./darker_results/').mkdir(exist_ok=True)
d = {
'main_stat': os.environ['MAIN'],
'test_stat': os.environ['TEST'],
'PR_NUM': os.environ['PULL_NUMBER'],
'RUN_ID': os.environ['GITHUB_RUN_ID'],
}
with open('darker_results/status.json', 'w') as f:
json.dump(d, f)
- name: check-json
run: cat darker_results/status.json
- name: upload-status
uses: actions/upload-artifact@v3
with:
name: darkerlint
path: darker_results/
retention-days: 1
pylint_check:
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: install
run: |
python -m pip install pylint
- name: pylint
env:
PYLINTRC: package/.pylintrc
run: |
pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests
mypy :
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: setup_micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: mda
create-args: >-
python=3.9
pip
# using jaime's shim to avoid pulling down the cudatoolkit
condarc: |
channels:
- jaimergp/label/unsupported-cudatoolkit-shim
- conda-forge
- bioconda
- name: install_deps
uses: ./.github/actions/setup-deps
with:
micromamba: true
full-deps: true
numpy: numpy=1.22.3
- name: install
run: |
python -m pip install mypy
- name: "Run mypy"
run: |
mypy package/MDAnalysis/