diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 0000000..06795c7 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -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 + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..58cdabe --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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/cancel-workflow-action@0.8.0 + 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/cancel-workflow-action@0.8.0 + 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 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..03d7aec --- /dev/null +++ b/.github/workflows/docker.yml @@ -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 diff --git a/.github/workflows/docs_buildings.yaml b/.github/workflows/docs_buildings.yaml new file mode 100644 index 0000000..9c422a5 --- /dev/null +++ b/.github/workflows/docs_buildings.yaml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c0598c8 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..242e836 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +First version of the neuroagent package. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b4edde7 --- /dev/null +++ b/pyproject.toml @@ -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 \ No newline at end of file diff --git a/src/neuroagent/__init__.py b/src/neuroagent/__init__.py new file mode 100644 index 0000000..3aa0d7b --- /dev/null +++ b/src/neuroagent/__init__.py @@ -0,0 +1 @@ +__version__ = "0.0.0" \ No newline at end of file