Skip to content

Commit

Permalink
ci: move to conventional commits & release-please (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Feb 10, 2023
1 parent 4453f4a commit 6284db9
Show file tree
Hide file tree
Showing 80 changed files with 419 additions and 353 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/ci.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/conventional-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR
on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

jobs:
title-format:
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
91 changes: 91 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches_ignore: []

jobs:
cancel-previous:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: khan/[email protected]
with:
workflows: "main.yml"
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'

linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Install dependencies
run: |
pip install -r requirements/test_black.txt
pip freeze
- name: Run linting tools
run: |
make lint
- name: Comment PR
if: github.event_name == 'pull_request' && failure()
uses: marocchino/[email protected]
with:
message: 'Please format your code with [black](https://black.readthedocs.io): `make black`.'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

testing:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
needs: linting
steps:
- name: Install Python via conda
uses: s-weigand/setup-conda@v1
with:
python-version: ${{ matrix.python-version }}
conda-channels: defaults,bioconda,conda-forge

- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: true

- name: Install mamba
run: conda install -y mamba==0.27.0

- name: Prepare environment.yaml file
run: >
cp environment.yaml /tmp/environment.yaml && sed -i -e
's/- python/- python=${{ matrix.python-version }}/'
/tmp/environment.yaml
- name: Update environment using mamba
run: mamba env update --name root --file /tmp/environment.yaml

- name: Save time by installing packages via mamba.
run: mamba install -y pysam

- name: Install dependencies
run: |
pip install -r requirements/test_black.txt
pip freeze
- name: Run tests
run: pytest

- uses: codecov/codecov-action@v3
41 changes: 41 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
push:
branches:
- main

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:

- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
release-type: python
package-name: cubi-tk

- uses: actions/checkout@v2
if: ${{ steps.release.outputs.release_created }}
with:
fetch-depth: 0

- name: Set up Python
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Build package
if: ${{ steps.release.outputs.release_created }}
run: |
python -m pip install --upgrade pip
python setup.py sdist
- name: Publish to PyPI
if: ${{ steps.release.outputs.release_created }}
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
47 changes: 0 additions & 47 deletions HISTORY.md

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.md
include CHANGELOG.md
include LICENSE
include README.md

Expand Down
40 changes: 21 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,31 @@ all: black
black:
black -l 100 .

.PHONY: test
test:
.PHONY: black-check
black-check:
black -l 100 --check .

.PHONY: pytest
pytest:
pytest .

.PHONY: lint-all
lint-all: bandit pyflakes pep257

.PHONY: bandit
bandit:
bandit -c bandit.yml -r cubi_tk

.PHONY: pyflakes
pyflakes:
pyflakes cubi_tk tests
.PHONY: isort
isort:
isort --force-sort-within-sections --profile=black .

.PHONY: pep257
pep257:
pep257
.PHONY: isort-check
isort-check:
isort --force-sort-within-sections --profile=black --check .

.PHONY: flake8
flake8:
flake8

# .PHONY: mypy
# mypy: export MYPYPATH=stubs
# mypy:
# mypy clinvar_this clinvar_api tests

.PHONY: lint
lint: flake8 isort-check black-check
# lint: flake8 isort-check black-check mypy

.PHONY: pytest
pytest:
pytest .
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
![Continuous Integration Status](https://github.com/bihealth/cubi-tk/workflows/CI/badge.svg)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/71dd0ea53e444cd0949a00a7025face7)](https://www.codacy.com/gh/bihealth/cubi-tk/dashboard?utm_source=github.com&utm_medium=referral&utm_content=bihealth/cubi-tk&utm_campaign=Badge_Grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/71dd0ea53e444cd0949a00a7025face7)](https://www.codacy.com/gh/bihealth/cubi-tk/dashboard?utm_source=github.com&utm_medium=referral&utm_content=bihealth/cubi-tk&utm_campaign=Badge_Coverage)
[![Coveralls Status](https://coveralls.io/repos/github/bihealth/cubi-tk/badge.svg?branch=master)](https://coveralls.io/github/bihealth/cubi-tk?branch=master)
[![Documentation Status](https://readthedocs.org/projects/cubi-tk/badge/?version=latest)](https://cubi-tk.readthedocs.io/en/latest/?badge=latest)
[![CI](https://github.com/bihealth/cubi-tk/actions/workflows/main.yml/badge.svg)](https://github.com/bihealth/cubi-tk/actions/workflows/main.yml)
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

# CUBI Toolkit
Expand Down
19 changes: 10 additions & 9 deletions cubi_tk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@

import argparse
import logging
import os
import sys

import argcomplete
import logzero
import os
from logzero import logger

from cubi_tk import __version__

from .archive import run as run_archive
from .archive import setup_argparse as setup_argparse_archive
from .common import run_nocmd
from .irods import run as run_irods
from .irods import setup_argparse as setup_argparse_irods
from .isa_tab import run as run_isa_tab
from .isa_tab import setup_argparse as setup_argparse_isa_tab
from .isa_tpl import run as run_isa_tpl
from .isa_tpl import setup_argparse as setup_argparse_isa_tpl
from .snappy import run as run_snappy
from .snappy import setup_argparse as setup_argparse_snappy
from .sodar import run as run_sodar
from .sodar import setup_argparse as setup_argparse_sodar
from .irods import run as run_irods
from .irods import setup_argparse as setup_argparse_irods
from .org_raw import run as run_org_raw
from .org_raw import setup_argparse as setup_argparse_org_raw
from .sea_snap import run as run_sea_snap
from .sea_snap import setup_argparse as setup_argparse_sea_snap
from .archive import run as run_archive
from .archive import setup_argparse as setup_argparse_archive
from .snappy import run as run_snappy
from .snappy import setup_argparse as setup_argparse_snappy
from .sodar import run as run_sodar
from .sodar import setup_argparse as setup_argparse_sodar


def setup_argparse_only(): # pragma: nocover
Expand Down
4 changes: 2 additions & 2 deletions cubi_tk/archive/common.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""``cubi-tk archive``: common features"""

import argparse
import attr
import json
import os
from pathlib import Path
import subprocess
import sys
import typing

from pathlib import Path
import attr


@attr.s(frozen=True, auto_attribs=True)
Expand Down
Loading

0 comments on commit 6284db9

Please sign in to comment.