Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Co-authored-by: Yossi Farjoun <[email protected]>
Co-authored-by: Jeff Gentry <[email protected]>
Co-authored-by: Tim Fennell <[email protected]>
Co-authored-by: Nils Homer <[email protected]>
Co-authored-by: Erin McAuley <[email protected]>
Co-authored-by: Matt Stone <[email protected]>
  • Loading branch information
6 people committed Aug 21, 2024
0 parents commit 820c511
Show file tree
Hide file tree
Showing 102 changed files with 13,471 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Default owners: Nils and Tim
* @nh13 @tfenne
130 changes: 130 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: publish

on:
push:
tags: '\d+.\d+.\d+'

env:
POETRY_VERSION: 1.8.2

jobs:
on-main-branch-check:
runs-on: ubuntu-latest
outputs:
on_main: ${{ steps.contains_tag.outputs.retval }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: rickstaa/action-contains-tag@v1
id: contains_tag
with:
reference: "main"
tag: "${{ github.ref_name }}"

tests:
name: tests
needs: on-main-branch-check
if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }}
uses: "./.github/workflows/tests.yml"

build-wheels:
name: build wheels
needs: tests
uses: "./.github/workflows/wheels.yml"

build-sdist:
name: build source distribution
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry==${{env.POETRY_VERSION}}
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true

- name: Install dependencies
run: poetry install --no-interaction --no-root --without=dev

- name: Install project
run: poetry install --no-interaction --without=dev

- name: Build package
run: poetry build --format=sdist

- uses: actions/upload-artifact@v4
with:
name: prymer-sdist
path: dist/*.tar.gz

publish-to-pypi:
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: packages
pattern: 'prymer-*'
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: packages/
skip-existing: true
verbose: true

make-changelog:
runs-on: ubuntu-latest
needs: publish-to-pypi
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout the Repository at the Tagged Commit
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}

- name: Generate a Changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: pyproject.toml
args: --latest --verbose
env:
GITHUB_REPO: ${{ github.repository }}

make-github-release:
runs-on: ubuntu-latest
environment: github
permissions:
contents: write
pull-requests: read
needs: make-changelog
steps:
- name: Create Draft Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body: |
${{ needs.draft-changelog.outputs.release_body }}
draft: false
prerelease: false
105 changes: 105 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: tests

on:
push:
branches:
- "**"
tags:
- "!**"
workflow_call:

env:
POETRY_VERSION: 1.8.2

jobs:
Tests:
runs-on: ubuntu-latest
strategy:
matrix:
PYTHON_VERSION: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Checkout fulcrumgenomics/bwa
uses: actions/checkout@v4
with:
repository: fulcrumgenomics/bwa
ref: interactive_aln
path: bwa
fetch-depth: 0

- name: Set up Python ${{ matrix.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON_VERSION }}

- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge,bioconda
activate-environment: prymer
environment-file: prymer.yml
channel-priority: true
auto-update-conda: true
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}

- name: Install fulcrumgenomics/bwa
shell: bash -l {0}
run: |
conda activate prymer
pushd bwa
make -j $(nproc)
cp bwa ${CONDA_PREFIX}/bin
popd
- name: Configure poetry and check lock file
shell: bash -l {0}
run: |
conda activate prymer
poetry config virtualenvs.in-project false
poetry check --lock
- name: Poetry install
shell: bash -l {0}
run: |
conda activate prymer
poetry lock --no-update
poetry install --with dev
- name: Unit tests (with doctest and coverage)
shell: bash -l {0}
run: |
conda activate prymer
poetry run pytest --cov=prymer --cov-report=xml --cov-branch --doctest-plus --doctest-modules prymer tests
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Style checking
shell: bash -l {0}
run: |
conda activate prymer
poetry run ruff format --check
- name: Run lint
shell: bash -l {0}
run: |
conda activate prymer
poetry run ruff check
- name: Run mypy
shell: bash -l {0}
run: |
conda activate prymer
poetry run mypy
- name: Run docs
shell: bash -l {0}
run: |
conda activate prymer
set -euo pipefail
poetry run mkdocs build --strict
34 changes: 34 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build wheels

on:
pull_request:
workflow_call:
workflow_dispatch:

jobs:
build-wheels:
name: Build wheels for ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
with:
submodules: "true"

- name: Set up Python ${{ matrix.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Build wheels
run: pip wheel -w wheelhouse .

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: prymer-wheels-${{ matrix.python }}
path: ./wheelhouse/*.whl
if-no-files-found: error
Loading

0 comments on commit 820c511

Please sign in to comment.