Skip to content

Commit

Permalink
Merge pull request #25 from gipplab/dev
Browse files Browse the repository at this point in the history
📦 New Release
  • Loading branch information
jpwahle authored Aug 11, 2022
2 parents f688607 + d77d033 commit 3adcc90
Show file tree
Hide file tree
Showing 58 changed files with 3,815 additions and 286 deletions.
3 changes: 1 addition & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
exclude = .venv, venv/
docstring-convention = google
max-line-length = 100

ignore = D104, D205, D415, W503
ignore = D104, D205, D415, W503, ANN401
per-file-ignores = tests/*: D1
3 changes: 0 additions & 3 deletions .github/issue-branch.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/branch.yml

This file was deleted.

28 changes: 16 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: 🏁 Checkout
uses: actions/checkout@v2

- name: ✅ Setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install poetry

- name: 💿 Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies

- name: 📦 Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run tests

- name: 🌱 Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
with:
mongodb-version: 5.0.9

- name: 🧪 Run tests
run: |
poetry run poe alltest
140 changes: 83 additions & 57 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,113 +8,140 @@ jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: 🏁 Checkout
uses: actions/checkout@v2

- name: ✅ Setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install poetry

- name: 💿 Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies

- name: 📦 Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run test

- name: 🌱 Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
with:
mongodb-version: 5.0.9

- name: 🧪 Run tests
run: |
poetry run poe alltest
Release:
needs: [Test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏁 Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"#
persist-credentials: false
- uses: actions/setup-python@v2

- name: ✅ Setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Bump version and push tag

- name: 🏷 Bump version and push tag
uses: anothrNick/github-tag-action@1.36.0
id: tagging
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
- name: Build Changelog

- name: 📝 Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install poetry

- name: 📦 Create Release
uses: actions/create-release@v1
with:
release_name: ${{steps.tagging.outputs.tag}}
body: ${{steps.build_changelog.outputs.changelog}}
tag_name: ${{steps.tagging.outputs.tag}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 💿 Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies

- name: 📦 Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Update package version to git tag

- name: ⬆️ Update package version
run: |
poetry version $(git describe --tags --abbrev=0)
- name: Commit files
- name: ➕ Commit files
run: |
git config --local user.email "jan.philip.wahle@gmail.com"
git config --local user.name "github-actions[bot]"
git add pyproject.toml
git commit -m "[release-bot] Update pyproject.toml version"
- name: Push changes
- name: 💨 Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
branch: ${{ github.ref }}
- name: Create Release
uses: actions/create-release@v1
with:
release_name: ${{steps.tagging.outputs.tag}}
body: ${{steps.build_changelog.outputs.changelog}}
tag_name: ${{steps.tagging.outputs.tag}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 🔑 Docker GitHub package login
run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}

- name: 🐳 Build docker image
run: docker build -t ghcr.io/gipplab/cs-insights-backend:${{steps.tagging.outputs.tag}} -t ghcr.io/gipplab/cs-insights-prediction-endpoint:latest .

- name: 📦 Push docker image
run: |
docker push ghcr.io/gipplab/cs-insights-prediciton-endpoint:${{steps.tagging.outputs.tag}}
docker push ghcr.io/gipplab/cs-insights-prediction-endpoint:latest
Coverage:
needs: [Test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: 🏁 Checkout
uses: actions/checkout@v2

- name: ✅ Setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install poetry

- name: 💿 Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies

- name: 📦 Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run tests

- name: 🌱 Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
with:
mongodb-version: 5.0.9

- name: 🧪 Run tests
run: |
poetry run poe test
- name: Upload coverage report
poetry run poe alltest
- name: ⬆ Upload coverage report
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -125,27 +152,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

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

- name: 💿 Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies

- name: 📦 Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Generate docs

- name: 📘 Generate docs
run: |
poetry run poe doc
- name: Deploy docs 🚀
- name: 🚀 Deploy docs
uses: JamesIves/github-pages-deploy-action@4.0.0
with:
branch: docs
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ dmypy.json
.vercel
.DS_Store
docs/oas.json
poetry.lock

# vim specific swap files
*.swp
10 changes: 7 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
"--experimental-string-processing"
],
"editor.formatOnSave": true,
"editor.rulers": [100],
"python.testing.pytestArgs": ["tests"],
"editor.rulers": [
100
],
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
}
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM python:3.8

WORKDIR /app
ADD pyproject.toml /app/pyproject.toml

RUN apt-get update &&\
apt-get install liblapack-dev libblas-dev gfortran -y
RUN pip install poetry
RUN poetry install

COPY . /app
WORKDIR /cs-insights-prediction-endpoint
COPY test.env /cs-insights-prediction-endpoint/.env
COPY . /cs-insights-prediction-endpoint

RUN poetry install --no-dev
8 changes: 8 additions & 0 deletions Dockerfile.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.8

RUN apt-get update &&\
apt-get install liblapack-dev libblas-dev gfortran -y
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install poetry

WORKDIR /cs-insights-prediction-endpoint
30 changes: 1 addition & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,7 @@

## Installation & Setup

### Production

To spin up the production version of this project, switch into the root directory of this project and run:

```console
docker-compose up --build
```

### Development

For development install [poetry](https://python-poetry.org/):

```console
pip install poetry
```

Then run:

```console
poetry install
```

Then you can use the api like this:

```console
poetry run python dev.py
```

If you are using VSCode, you can also run debugging using the `.vscode/launch.json`.
This project is part of the `cs-insights`-ecosystem. Please refer to the readme [here](https://github.com/gipplab/cs-insights-main) to spin up the development and production system.

## Code quality and tests

Expand Down
File renamed without changes.
Loading

0 comments on commit 3adcc90

Please sign in to comment.