Merge pull request #176 from teepean/plink_support #326
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
# https://docs.github.com/en/actions | |
# https://github.com/codecov/example-python | |
# https://stackoverflow.com/a/3237883 | |
# https://stackoverflow.com/a/5688592 | |
# https://stackoverflow.com/a/6270803 | |
# https://github.com/actions/virtual-environments/issues/1341 | |
name: CI | |
on: | |
schedule: | |
- cron: '37 4 * * 0' | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
enable-workflow: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' || (github.event_name == 'schedule' && github.repository == 'apriha/snps') }} | |
steps: | |
- name: Enable workflow based on preconditions | |
run: echo "Workflow enabled." | |
lint-format: | |
needs: [enable-workflow] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Ruff | |
run: | | |
pip install ruff | |
- name: Lint with Ruff | |
run: | | |
ruff check | |
- name: Format with Ruff | |
run: | | |
ruff format --check | |
build-docs: | |
needs: [enable-workflow] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Sphinx | |
run: | | |
pip install -r docs/requirements.txt | |
pip install . | |
- name: Build docs with Sphinx | |
run: | | |
sphinx-build -W --keep-going -T -E -D language=en docs docs/_build | |
test: | |
needs: [lint-format, build-docs] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
include: | |
- os: macos-latest | |
python-version: '3.12' | |
- os: windows-latest | |
python-version: '3.12' | |
env: | |
JOB_ID: ${{ strategy.job-index }} | |
NUM_JOBS: ${{ strategy.job-total }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Ensure Python and source code are on same drive (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: cmd | |
run: | | |
mkdir C:\a | |
xcopy D:\a C:\a /s /e | |
- name: Determine if downloads are enabled for this job | |
# for testing, limit downloads from the resource servers to only the selected job for | |
# PRs and the master branch; note that the master branch is tested weekly via `cron`, | |
# so this ensures all Python versions will be periodically integration tested with the | |
# resource servers | |
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/master' }} | |
shell: bash | |
run: | | |
SELECTED_JOB=$((10#$(date +%V) % $NUM_JOBS)) | |
if [[ $SELECTED_JOB == $JOB_ID ]]; then | |
# set environment variable to download resources for selected job | |
echo "DOWNLOADS_ENABLED=true" >> $GITHUB_ENV | |
fi | |
- name: Install dependencies | |
run: | | |
pip install pytest-cov | |
pip install . | |
- name: Test with pytest (Ubuntu & macOS) | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
pytest --cov=snps tests | |
- name: Test with pytest (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
working-directory: C:\a\snps\snps | |
run: | | |
pytest --cov=snps tests | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
test-extras: | |
needs: [lint-format, build-docs] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip setuptools wheel | |
pip install pytest-cov | |
pip install .[ezancestry] | |
- name: Test with pytest | |
run: | | |
pytest --cov=snps tests |