Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into rdf
Browse files Browse the repository at this point in the history
  • Loading branch information
loesvdbiggelaar committed Apr 4, 2024
2 parents f426463 + 9a6596e commit 0e06071
Show file tree
Hide file tree
Showing 133 changed files with 11,732 additions and 10,283 deletions.
7 changes: 5 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[bumpversion]
current_version = 0.5.17
current_version = 0.5.40
commit = True
tag = True
files = pyproject.toml
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}

[bumpversion:file:pyproject.toml]

[bumpversion:file:biocypher/_metadata.py]
12 changes: 12 additions & 0 deletions .github/actions/build_docs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Build docs'
description: 'Build docs and run doc tests'

runs:
using: "composite"
steps:
- name: Test code snippets in documentation
run: poetry run make doctest --directory docs/
shell: bash
- name: Build documentation
run: poetry run make html --directory docs/
shell: bash
29 changes: 29 additions & 0 deletions .github/actions/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Install'
description: 'Install dependencies'
inputs:
PYTHON_VERSION:
description: 'Python version'
default: 3.9

runs:
using: "composite"
steps:
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ inputs.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
shell: bash
- name: Install library
run: poetry install --no-interaction
shell: bash
34 changes: 34 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Setup'
description: 'Setup Python and Poetry'
inputs:
PYTHON_VERSION:
description: 'Python version'
default: 3.9
POETRY_VERSION:
description: 'Poetry version'
default: 1.5.1

runs:
using: "composite"
steps:
- name: Set up Python ${{inputs.PYTHON_VERSION}}
uses: actions/setup-python@v4
with:
python-version: ${{inputs.PYTHON_VERSION}}
- name: Load cached Poetry installation
if: runner.os == 'Linux' # TODO: add support for other OS
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-cache-${{ runner.os }}-${{ inputs.PYTHON_VERSION }}-${{ inputs.POETRY_VERSION }}
- name: Install and configure Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Check Poetry installation
run: poetry --version
shell: bash
40 changes: 40 additions & 0 deletions .github/actions/test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Test and code quality'
description: 'Run tests and code quality checks'

runs:
using: "composite"
steps:
#----------------------------------------------
# setup docker containers for testing
#----------------------------------------------
# currently only available for ubuntu and macos
- name: Install Docker
uses: douglascamata/setup-docker-macos-action@v1-alpha
if: ${{ runner.os == 'macOS' }}
- name: Start Neo4j Docker
run: docker run --restart always --publish=7474:7474 --publish=7687:7687 --env NEO4J_AUTH=neo4j/your_password_here --env NEO4J_PLUGINS='["apoc"]' --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes -d neo4j:4.4-enterprise
shell: bash
if: ${{ runner.os != 'Windows' }}
- name: Start Postgres Docker
run: docker run --restart always --publish=5432:5432 --env POSTGRES_PASSWORD=postgres -d postgres:11.21-bullseye
shell: bash
if: ${{ runner.os != 'Windows' }}
#----------------------------------------------
# run tests and code quality checks
#----------------------------------------------
- name: Run Tests (Windows)
run: |
source .venv/scripts/activate
pytest --version
pytest --password=your_password_here
shell: bash
if: runner.os == 'Windows'
- name: Run tests (Linux and MacOS)
run: |
source .venv/bin/activate
pytest --version
pytest --password=your_password_here
shell: bash
if: runner.os != 'Windows'
- name: Check code quality
uses: pre-commit/[email protected]
24 changes: 24 additions & 0 deletions .github/actions/test_coverage/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Test coverage'
description: 'Check test coverage'

inputs:
token:
description: 'A Github PAT'
required: true

runs:
using: "composite"
steps:
- name: Generate coverage report
run: poetry run coverage run -m pytest --password=your_password_here
shell: bash
- name: Generate coverage badge
run: poetry run coverage-badge -f -o docs/coverage/coverage.svg
shell: bash
- name: Commit changes
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: coverage
FOLDER: docs/coverage
GITHUB_TOKEN: ${{ inputs.token }}
75 changes: 75 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Docs

on:
pull_request:
push:
branches:
- main

jobs:
build_docs:
runs-on: ubuntu-latest
permissions: write-all
steps:
#----------------------------------------------
# check-out repo and set-up python and poetry
#----------------------------------------------
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python and Poetry
uses: ./.github/actions/setup
#----------------------------------------------
# install dependencies
#----------------------------------------------
- name: Install dependencies
uses: ./.github/actions/install
- name: Install pandoc
run: sudo apt-get -y install pandoc
#----------------------------------------------
# build docs
#----------------------------------------------
- name: Build docs
uses: ./.github/actions/build_docs

build_and_deploy_docs:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions: write-all
steps:
#----------------------------------------------
# check-out repo and set-up python and poetry
#----------------------------------------------
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python and Poetry
uses: ./.github/actions/setup
#----------------------------------------------
# install dependencies
#----------------------------------------------
- name: Install dependencies
uses: ./.github/actions/install
- name: Install pandoc
run: sudo apt-get -y install pandoc
#----------------------------------------------
# build docs
#----------------------------------------------
- name: Install dependencies
uses: ./.github/actions/build_docs
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
touch docs/_build/html/.nojekyll
echo 'biocypher.org' > docs/_build/html/CNAME
git add -f docs/_build/
git commit -m "Update autodoc" -a
#----------------------------------------------
# deploy docs
#----------------------------------------------
- name: Deploy
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: gh-pages
FOLDER: docs/_build/html
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests and code quality checks for pull requests

on: [pull_request]

jobs:
tests_and_code_quality:
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
env:
POETRY_VERSION: 1.5.1
defaults:
run:
shell: bash

steps:
#----------------------------------------------
# checkout repo and set-up python and poetry
#----------------------------------------------
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python and Poetry
uses: ./.github/actions/setup
with:
PYTHON_VERSION: ${{ matrix.python-version }}
POETRY_VERSION: ${{ env.POETRY_VERSION }}
#----------------------------------------------
# install dependencies
#----------------------------------------------
- name: Install dependencies
uses: ./.github/actions/install
with:
PYTHON_VERSION: ${{ matrix.python-version }}
#----------------------------------------------
# run tests and code quality checks
#----------------------------------------------
- name: Run tests
uses: ./.github/actions/test
64 changes: 64 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish

on:
push:
branches:
- main
tags:
- "*"
# TODO: ensure semver style - "[0-9]+.[0-9]+.[0-9]+(-[a-z]+)?(.[0-9]+)?"

jobs:
call-tests_and_code_quality:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: "./.github/workflows/tests_and_code_quality.yaml"

build_and_deploy_artifact:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: call-tests_and_code_quality
runs-on: ubuntu-latest
env:
PYTHON_VERSION: 3.9
environment:
name: release
url: https://upload.pypi.org/legacy/
permissions:
id-token: write
contents: write
steps:
#----------------------------------------------
# check-out repo and set-up python and poetry
#----------------------------------------------
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python and Poetry
uses: ./.github/actions/setup
#----------------------------------------------
# install dependencies
#----------------------------------------------
- name: Install dependencies
uses: ./.github/actions/install
#----------------------------------------------
# build artifact
#----------------------------------------------
- name: Build artifact
run: poetry build
#----------------------------------------------
# upload to PyPi
#----------------------------------------------
- name: Publish artifact to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://upload.pypi.org/legacy/
#----------------------------------------------
# create Github release
#----------------------------------------------
- name: Create Github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--generate-notes
56 changes: 0 additions & 56 deletions .github/workflows/sphinx_autodoc.yml

This file was deleted.

Loading

0 comments on commit 0e06071

Please sign in to comment.