Skip to content

Commit

Permalink
Merge pull request #64 from zuzg/develop
Browse files Browse the repository at this point in the history
update: new CI/CD workflows for deployment
  • Loading branch information
Tremirre authored Apr 16, 2023
2 parents e04efab + 2e217c9 commit 248383b
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 40 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/main.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy to Production

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python version
uses: actions/setup-python@v1
with:
python-version: "3.10"

- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt

- name: Test with pytest
run: |
pip install pytest
pip install pytest-cov
pytest tests/
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v2
with:
name: python-app
path: |
.
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
concurrency: production
environment:
name: "production"
url: ${{ vars.AZURE_WEBAPP_URL }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: python-app
path: .

- name: "Deploy to Azure Web App"
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.PROD_AZURE_PUBLISH_PROFILE }}
62 changes: 62 additions & 0 deletions .github/workflows/staging-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Deploy to Staging

on:
push:
branches:
- develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python version
uses: actions/setup-python@v1
with:
python-version: "3.10"

- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt

- name: Test with pytest
run: |
pip install pytest
pip install pytest-cov
pytest tests/
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v2
with:
name: python-app
path: |
.
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
concurrency: staging
environment:
name: "staging"
url: ${{ vars.AZURE_WEBAPP_URL }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: python-app
path: .

- name: "Deploy to Azure Web App"
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.STAGING_AZURE_PUBLISH_PROFILE }}
35 changes: 35 additions & 0 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Testing Workflow

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10.6
uses: actions/setup-python@v4
with:
python-version: 3.10.6
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
export PYTHONPATH=$PYTHONPATH:/home/runner/work/drug-screening/drug-screening/src
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # temporary comment for tests
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest
pip install pytest-cov
pytest tests/
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
![testing workflow](https://github.com/zuzg/drug-screening/actions/workflows/main.yml/badge.svg)
![Latest PR Test](https://github.com/zuzg/drug-screening/actions/workflows/test-pull-request.yml/badge.svg)
![Prod Deployment](https://github.com/zuzg/drug-screening/actions/workflows/prod-deploy.yml/badge.svg)
![Staging Deployment](https://github.com/zuzg/drug-screening/actions/workflows/staging-deploy.yml/badge.svg)

[![badges-are-fun](https://img.shields.io/badge/badges_are-fun-deeppink.svg)](https://tenor.com/view/excited-ron-swanson-giggle-so-much-fun-gif-14647008)
![fail](https://img.shields.io/badge/unless_they-fail-red.svg)

# drug-screening

## About

A project examining data from High Throughput Screening center in Poznan. HTS goal is to identify active compounds from hundreds of thousands.

## Setup

### Prepare repository

```
git clone https://github.com/zuzg/drug-screening.git
```
```

```
cd drug-screening
```

### Prepare environment

```
conda env create -f environment.yml
```

```
conda activate drug-screening
```

### Starting the dashboard

To start the dashboard enter the following command in the terminal (active in the root project directory) while the conda environment is active:

```
python -m dashboard
```
```

0 comments on commit 248383b

Please sign in to comment.