Skip to content

Commit

Permalink
Merge branch '4.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
HaidYi committed May 7, 2024
2 parents 8097053 + b6b296e commit b943ac4
Show file tree
Hide file tree
Showing 25 changed files with 557 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.git
.venv
.ruff_cache
db
docs
tests
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/01-bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Bug report
description: Report something that is broken or incorrect
labels: bug
body:
- type: markdown
attributes:
value: |
**Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports)
detailing how to provide the necessary information for us to reproduce your bug. In brief:
* Please provide exact steps how to reproduce the bug in a clean Python environment.
* In case it's not clear what's causing this bug, please provide the data or the data generation procedure.
* Sometimes it is not possible to share the data, but usually it is possible to replicate problems on publicly
available datasets or to share a subset of your data.
- type: textarea
id: report
attributes:
label: Report
description: A clear and concise description of what the bug is.
validations:
required: true

- type: textarea
id: versions
attributes:
label: Version information
description: |
Please paste below the output of
```python
import session_info
session_info.show(html=False, dependencies=True)
```
placeholder: |
-----
dbcan 0.1.dev357+g4e1041c.d20240223
session_info 1.0.0
-----
google NA
sphinxcontrib NA
-----
Python 3.10.13 (main, Nov 15 2023, 11:07:58) [Clang 14.0.0 (clang-1400.0.29.202)]
macOS-12.7.3-x86_64-i386-64bit
-----
Session information updated at 2024-02-22 20:12
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/02-feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Feature request
description: Propose a new feature for scHub
labels: enhancement
body:
- type: textarea
id: description
attributes:
label: Description of feature
description: Please describe your suggestion for a new feature. It might help to describe a problem or use case, plus any alternatives that you have considered.
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
29 changes: 29 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check Build

on:
push:
branches: [master]
pull_request:
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install build dependencies
run: python -m pip install --upgrade pip wheel twine build
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*.whl
34 changes: 0 additions & 34 deletions .github/workflows/ci.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/docker_pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: publish docker package

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
push:
branches: ['master']

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# minimal
type=semver,pattern={{version}}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

29 changes: 29 additions & 0 deletions .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PyPI Release

on:
release:
types: [published]

# Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/
jobs:
release:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dbcan
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
with:
filter: blob:none
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- run: python -m pip install --upgrade pip wheel twine build
- run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
84 changes: 84 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Test

on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: "0 5 1,15 * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0} # -e to fail on error

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]

name: ${{ matrix.name }} Python ${{ matrix.python }}

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v3

# - name: Set up Python ${{ matrix.python }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}
# cache: "pip"
# cache-dependency-path: "**/pyproject.toml"

- uses: conda-incubator/setup-miniconda@v3
with:
mamba-version: "*"
auto-update-conda: true
auto-activate-base: false
python-version: ${{ matrix.python }}
channels: conda-forge, bioconda, defaults
activate-environment: test_dbcan
environment-file: envs/test.yml

- name: export test_dbcan environment
run: mamba env export

# - name: Install test dependencies
# run: |
# python -m pip install --upgrade pip wheel
# - name: create run_dbcan environment
# run: conda create -n run_dbcan python=${{ matrix.python }}
# - name: activate run_dbcan environment
# run: conda activate run_dbcan

- name: Install dependencies
run: |
pip install ${{ matrix.pip-flags }} ".[dev,test]"
# - name: Add conda to PATH
# run: |
# echo ::add-path::$CONDA/bin

- name: Build dbCAN Database
run: |
dbcan_build --cpus 1 --db-dir db --clean
# conda install -y -c bioconda -c conda-forge hmmer diamond blast prodigal
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
coverage run -m pytest -v --color=yes
32 changes: 32 additions & 0 deletions .github/workflows/testpypi_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test PyPI Release

on:
push:
tags:
- "v*"

# Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/
jobs:
release:
name: Publish pre-release Python distributions to TestPyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/dbcan
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
with:
filter: blob:none
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- run: python -m pip install --upgrade pip wheel twine build
- run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ wheels/
*.egg
MANIFEST
output*
.vscode/

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -127,10 +126,12 @@ conda-recipe/meta.yaml

Hotpep_bkp*

#ignore example data
EscheriaColiK12MG1655.*


34*

output*
# IDE
.idea/
.vscode/

# ignore version file
**/_version.py
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ repos:
- id: trailing-whitespace
- id: check-case-conflict
- id: check-added-large-files
args: ["--maxkb=5000"]
- id: check-toml
- id: check-yaml
- id: check-merge-conflict
Expand Down
Loading

0 comments on commit b943ac4

Please sign in to comment.