Skip to content

Commit

Permalink
Init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Frank committed Sep 11, 2024
0 parents commit cd7afa6
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Changelog
on:
pull_request

jobs:
Check-Changelog:
name: Check Changelog Action
runs-on: ubuntu-20.04
steps:
- uses: tarides/changelog-check-action@v2
with:
changelog: CHANGELOG.md

91 changes: 91 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI

on:
pull_request:
push:
branches: [main]
workflow_dispatch:
inputs:
debug_enabled:
description: "Run the build with tmate debugging enabled"
required: false

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Cancel previous workflows that are still running
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout latest commit
uses: actions/checkout@v2
with:
fetch-depth: 0 # fetch all history with version tags
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Set up pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ matrix.tox-env }}-${{ runner.os }}
- name: Set up environment
run: |
pip install --upgrade pip wheel setuptools
pip install bandit[toml]==1.7.4 ruff==0.5.5
- name: Linting check
run: |
bandit -qr -c pyproject.toml src/
ruff check src/ tests/
ruff format --check src/ tests
unit-tests:
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: password
options: >-
--health-cmd "pg_isready -d postgres://test:password@localhost:5432"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
env:
PIP_CACHE_DIR: .cache/pip
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
steps:
- name: Cancel previous workflows that are still running
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout latest commit
uses: actions/checkout@v2
with:
fetch-depth: 0 # fetch all history with version tags
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up pip cache
uses: actions/cache@v2
with:
path: .cache/pip
key: ${{ matrix.tox-env }}-${{ matrix.os }}
- name: Set up environment
run: |
pip install --upgrade pip
pip install mypy==1.8.0
pip install -e ".[dev]"
- name: Running mypy and tests
run: |
mypy src/
pytest --color=yes
32 changes: 32 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Docker Image

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
bluebrain/neuroagent:${{ github.ref_name }}
bluebrain/neuroagent:latest
50 changes: 50 additions & 0 deletions .github/workflows/docs_buildings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: GitHub Pages

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-22.04
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Upgrade pip
run: |
# install pip=>20.1 to use "pip cache dir"
python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: python3 -m pip install mkdocs-material mkdocstrings[python]

- run: mkdocs build

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Push Python Package

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/neuroagent/
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
First version of the neuroagent package.
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[build-system]
requires = ["setuptools"]

[project]
name = "neuroagent"
authors = [
{name = "Blue Brain Project, EPFL"},
]
description = "Search agent for neuroscience."
readme = "README.md"
requires-python = ">=3.10"
dynamic = ["version"]
dependencies = [
]

[tool.setuptools.dynamic]
version = {attr = "neuroagent.__version__"}

[tool.setuptools.packages.find]
where = ["src"]
namespaces = false
1 change: 1 addition & 0 deletions src/neuroagent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.0"

0 comments on commit cd7afa6

Please sign in to comment.