Skip to content

Commit

Permalink
Switches to use version.py file for python package version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Chu committed Apr 15, 2021
1 parent b21f3a7 commit 5bd392e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 18 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools pipenv
rm ./script_runner/version.py
# pipenv lock --dev --requirements > requirements.dev.txt
# pip install -r requirements.txt
# - name: Lint with flake8
Expand All @@ -52,11 +53,16 @@ jobs:
# - name: Test with pytest
# run: |
# pytest
- name: Inject package version
uses: nowactions/envsubst@v1
with:
input: ./script_runner/version.py.tmpl
output: ./script_runner/version.py
env:
SCRIPT_RUNNER_VERSION: ${{ steps.prep.outputs.version }}
- name: Build python package
run: |
python setup.py sdist
env:
SCRIPT_RUNNER_VERSION: ${{ steps.prep.outputs.version }}
- name: Deploy to PyPI
if: success() && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down Expand Up @@ -131,7 +137,7 @@ jobs:
publish-docker-example:
needs: publish-pypi
if: startsWith(github.ref, 'refs/tags')
name: Build and push script-runner-server-example docker image
name: Publish script-runner-example to dockerhub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand Down Expand Up @@ -192,7 +198,7 @@ jobs:
deploy-aws-example:
needs: publish-docker-example
if: startsWith(github.ref, 'refs/tags')
name: Deploy swabseq-analysis-example to AWS
name: Deploy script-runner-example to AWS
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand Down Expand Up @@ -295,7 +301,7 @@ jobs:
deploy-azure-example:
needs: publish-docker-example
if: startsWith(github.ref, 'refs/tags')
name: Deploy swabseq-analysis-example to Azure
name: Deploy script-runner-example to Azure
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ services:
server:
image: labflow/script-runner-example:latest
build:
dockerfile: ./docker/Dockerfile.example
context: .
dockerfile: ./Dockerfile.example
context: ./docker
args:
SERVER_VERSION: local+devcontainer
command: "python3 -m flask run --host=0.0.0.0 --port=5000"
Expand All @@ -23,8 +23,8 @@ services:
worker:
image: labflow/script-runner-example:latest
build:
context: .
dockerfile: ./docker/Dockerfile.example
dockerfile: ./Dockerfile.example
context: ./docker
args:
SERVER_VERSION: local+devcontainer
command: "python3 -m celery -A script_runner.analysis worker"
Expand Down
15 changes: 7 additions & 8 deletions docker/Dockerfile.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ ARG SCRIPT_RUNNER_VERSION=local+container
# Start with rocker/tidyverse base image
FROM rocker/verse:3.6.3

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# get and install bcl2fastq
RUN cd /tmp \
&& wget https://www.dropbox.com/s/idi0xfu0thurk7q/bcl2fastq2-v2-20-0-linux-x86-64.zip \
&& unzip bcl2fastq2-v2-20-0-linux-x86-64.zip -p \
| tar xvz -C / usr/local/bin/bcl2fastq \
&& rm /tmp/bcl2fastq2*

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Install extra *nix utils
# x11, mesa, glu1 are so we can install paletteer
Expand All @@ -27,6 +19,7 @@ RUN apt-get update \
wget \
parallel \
python3-pip \
bsdtar \
bzip2 \
libcairo2-dev \
libfontconfig1-dev \
Expand All @@ -35,6 +28,12 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# get and install bcl2fastq
RUN wget -qO- https://www.dropbox.com/s/idi0xfu0thurk7q/bcl2fastq2-v2-20-0-linux-x86-64.zip \
| bsdtar -xOf - bcl2fastq2-v2.20.0.422-Linux-x86_64.rpm \
| bsdtar -xf - -C / usr/local/bin/bcl2fastq

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# R Deps
RUN install2.r --error \
Expand Down
4 changes: 4 additions & 0 deletions script_runner/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = ('__version__',)
__version__ = "latest"
4 changes: 4 additions & 0 deletions script_runner/version.py.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = ('__version__',)
__version__ = "$SCRIPT_RUNNER_VERSION"
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import os
from distutils.core import setup

def get_version():
"""
Gets the latest version number out of the package,
saving us from maintaining it in multiple places.
"""
local_results = {}
with open('script_runner/version.py') as version_file:
exec(version_file.read(), {}, local_results)
return local_results['__version__']

setup(
name="script-runner-api",
packages=[
"script_runner",
"script_runner.api",
],
scripts=["script_runner/main.py"],
version=os.environ.get("SCRIPT_RUNNER_VERSION", "latest"),
version=get_version(),
license="MIT",
description="Provides an API server + celery worker module for running arbitrary scripts.",
author="Robert Chu",
Expand Down

0 comments on commit 5bd392e

Please sign in to comment.