-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from Clinical-Genomics/add_workflows
Fix #48 - add GitHub Actions workflows
- Loading branch information
Showing
24 changed files
with
805 additions
and
316 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Publish to PyPI, Docker Hub and GitHub IO | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python distribution to PyPI | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Check out git repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install build tools | ||
run: >- | ||
python -m | ||
pip install | ||
wheel | ||
twine | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: >- | ||
python | ||
setup.py | ||
sdist | ||
bdist_wheel | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
docker-image-CI: | ||
name: Docker Image CI | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check out git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Publish main image (Dockerfile) to Registry | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: clinicalgenomics/stranger | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
tags: "latest,${{ github.event.release.tag_name }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: "Changelog Reminder" | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] | ||
|
||
jobs: | ||
# Enforces the update of a changelog file on every pull request | ||
changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dangoslen/changelog-enforcer@v3 | ||
with: | ||
changeLogPath: 'CHANGELOG.md' | ||
skipLabels: 'Skip-Changelog' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Lint files and fix lint errors | ||
|
||
# This will only correct linting in local PRs | ||
on: ["push"] | ||
|
||
jobs: | ||
build: | ||
|
||
name: Lint-and-fix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.12] | ||
|
||
steps: | ||
|
||
# Check out code | ||
- name: Check out git repository | ||
uses: actions/checkout@v4 | ||
|
||
# Set up python | ||
- name: Set up Python ${{ matrix.python-version}} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version}} | ||
|
||
- name: Install Python Dependencies | ||
run: | | ||
pip install black flake8 | ||
- name: Run linters | ||
uses: wearerequired/lint-action@v2 | ||
# Let linters fix problems if they can | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
auto_fix: true | ||
# Enable linters | ||
black: true | ||
black_args: "-l 100" | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8: true | ||
flake8_args: "stranger/ --count --select=E9,F63,F7,F82 --show-source --statistics" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Lint files - no fixing | ||
|
||
# This will check linting in local PRs | ||
on: ["push", "pull_request"] | ||
|
||
jobs: | ||
build: | ||
|
||
name: Lint-only | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.12] | ||
|
||
steps: | ||
|
||
# Check out code | ||
- name: Check out git repository | ||
uses: actions/checkout@v4 | ||
|
||
# Set up python | ||
- name: Set up Python ${{ matrix.python-version}} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version}} | ||
|
||
- name: Install Python Dependencies | ||
run: | | ||
pip install black flake8 isort | ||
- name: Run linters | ||
uses: wearerequired/lint-action@v2 | ||
# Let linters fix problems if they can | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
auto_fix: false | ||
# Enable linters | ||
black: true | ||
black_args: "--check -l 100" | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8: true | ||
flake8_args: "stranger/ --count --select=E9,F63,F7,F82 --show-source --statistics" | ||
|
||
- name: Run isort | ||
uses: jamescurtin/isort-action@master | ||
with: | ||
configuration: "--check-only --diff -m 3 --tc --fgw 0 --up -n -l 100" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Publish to Docker stage | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
docker-stage-push: | ||
name: Create staging docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out git repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/branch-names@v7 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
if: steps.branch-name.outputs.is_default == 'false' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
tags: "clinicalgenomics/stranger-stage:${{steps.branch-name.outputs.current_branch}}, clinicalgenomics/stranger-stage:latest" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Run tests and push coverage to Codecov | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
# Cache package installation step to speed up the following step | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} }} | ||
|
||
- name: Install deps | ||
run: | | ||
pip install --upgrade --upgrade-strategy eager -e . | ||
pip check | ||
test: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
# Cache package installation step to speed up the following step | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} | ||
|
||
- name: Install pytest | ||
run: pip install pytest pytest-cov | ||
|
||
- name: Run pytest | ||
run: pytest --cov --rootdir=/home/runner/work/stranger | ||
|
||
- name: Upload coverage | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage${{ matrix.group }} | ||
path: .coverage | ||
|
||
coverage: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
- name: Install deps | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install coverage | ||
- name: Download all artifacts | ||
# Download and combine coverage1, coverage2, etc. | ||
uses: actions/download-artifact@v4 | ||
- name: Run coverage | ||
run: | | ||
coverage combine coverage*/.coverage* | ||
coverage report | ||
coverage xml | ||
- uses: codecov/codecov-action@v4 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "Vulture - Find unused code" | ||
on: | ||
- pull_request | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: vulture | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Find changed Python files | ||
id: files | ||
uses: Ana06/get-changed-files@v2.2.0 | ||
with: | ||
filter: "*.py" | ||
|
||
- name: Scavenge | ||
uses: anaynayak/python-vulture-action@v1.0 | ||
id: vulture | ||
with: | ||
vulture-args: --min-confidence 80 --ignore-names cls,args,kwargs,real_variant_database ${{steps.files.outputs.all}} | ||
continue-on-error: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: woke | ||
on: | ||
- pull_request | ||
jobs: | ||
woke: | ||
name: Non-inclusive language check with woke | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: woke | ||
uses: get-woke/woke-action@v0 | ||
with: | ||
fail-on-error: false |
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
Oops, something went wrong.