Skip to content

Commit 5bd392e

Browse files
author
Robert Chu
committed
Switches to use version.py file for python package version.
1 parent b21f3a7 commit 5bd392e

6 files changed

Lines changed: 41 additions & 18 deletions

File tree

.github/workflows/publish.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
- name: Install dependencies
4242
run: |
4343
python -m pip install --upgrade pip wheel setuptools pipenv
44+
rm ./script_runner/version.py
4445
# pipenv lock --dev --requirements > requirements.dev.txt
4546
# pip install -r requirements.txt
4647
# - name: Lint with flake8
@@ -52,11 +53,16 @@ jobs:
5253
# - name: Test with pytest
5354
# run: |
5455
# pytest
56+
- name: Inject package version
57+
uses: nowactions/envsubst@v1
58+
with:
59+
input: ./script_runner/version.py.tmpl
60+
output: ./script_runner/version.py
61+
env:
62+
SCRIPT_RUNNER_VERSION: ${{ steps.prep.outputs.version }}
5563
- name: Build python package
5664
run: |
5765
python setup.py sdist
58-
env:
59-
SCRIPT_RUNNER_VERSION: ${{ steps.prep.outputs.version }}
6066
- name: Deploy to PyPI
6167
if: success() && startsWith(github.ref, 'refs/tags')
6268
uses: pypa/gh-action-pypi-publish@release/v1
@@ -131,7 +137,7 @@ jobs:
131137
publish-docker-example:
132138
needs: publish-pypi
133139
if: startsWith(github.ref, 'refs/tags')
134-
name: Build and push script-runner-server-example docker image
140+
name: Publish script-runner-example to dockerhub
135141
runs-on: ubuntu-latest
136142
steps:
137143
- name: Check out the repo
@@ -192,7 +198,7 @@ jobs:
192198
deploy-aws-example:
193199
needs: publish-docker-example
194200
if: startsWith(github.ref, 'refs/tags')
195-
name: Deploy swabseq-analysis-example to AWS
201+
name: Deploy script-runner-example to AWS
196202
runs-on: ubuntu-latest
197203
steps:
198204
- name: Check out the repo
@@ -295,7 +301,7 @@ jobs:
295301
deploy-azure-example:
296302
needs: publish-docker-example
297303
if: startsWith(github.ref, 'refs/tags')
298-
name: Deploy swabseq-analysis-example to Azure
304+
name: Deploy script-runner-example to Azure
299305
runs-on: ubuntu-latest
300306
steps:
301307
- name: Check out the repo

docker-compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ services:
33
server:
44
image: labflow/script-runner-example:latest
55
build:
6-
dockerfile: ./docker/Dockerfile.example
7-
context: .
6+
dockerfile: ./Dockerfile.example
7+
context: ./docker
88
args:
99
SERVER_VERSION: local+devcontainer
1010
command: "python3 -m flask run --host=0.0.0.0 --port=5000"
@@ -23,8 +23,8 @@ services:
2323
worker:
2424
image: labflow/script-runner-example:latest
2525
build:
26-
context: .
27-
dockerfile: ./docker/Dockerfile.example
26+
dockerfile: ./Dockerfile.example
27+
context: ./docker
2828
args:
2929
SERVER_VERSION: local+devcontainer
3030
command: "python3 -m celery -A script_runner.analysis worker"

docker/Dockerfile.example

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ ARG SCRIPT_RUNNER_VERSION=local+container
44
# Start with rocker/tidyverse base image
55
FROM rocker/verse:3.6.3
66

7-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8-
# get and install bcl2fastq
9-
RUN cd /tmp \
10-
&& wget https://www.dropbox.com/s/idi0xfu0thurk7q/bcl2fastq2-v2-20-0-linux-x86-64.zip \
11-
&& unzip bcl2fastq2-v2-20-0-linux-x86-64.zip -p \
12-
| tar xvz -C / usr/local/bin/bcl2fastq \
13-
&& rm /tmp/bcl2fastq2*
14-
157
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
168
# Install extra *nix utils
179
# x11, mesa, glu1 are so we can install paletteer
@@ -27,6 +19,7 @@ RUN apt-get update \
2719
wget \
2820
parallel \
2921
python3-pip \
22+
bsdtar \
3023
bzip2 \
3124
libcairo2-dev \
3225
libfontconfig1-dev \
@@ -35,6 +28,12 @@ RUN apt-get update \
3528
&& apt-get clean \
3629
&& rm -rf /var/lib/apt/lists/*
3730

31+
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
# get and install bcl2fastq
33+
RUN wget -qO- https://www.dropbox.com/s/idi0xfu0thurk7q/bcl2fastq2-v2-20-0-linux-x86-64.zip \
34+
| bsdtar -xOf - bcl2fastq2-v2.20.0.422-Linux-x86_64.rpm \
35+
| bsdtar -xf - -C / usr/local/bin/bcl2fastq
36+
3837
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3938
# R Deps
4039
RUN install2.r --error \

script_runner/version.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
__all__ = ('__version__',)
4+
__version__ = "latest"

script_runner/version.py.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
__all__ = ('__version__',)
4+
__version__ = "$SCRIPT_RUNNER_VERSION"

setup.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
import os
22
from distutils.core import setup
33

4+
def get_version():
5+
"""
6+
Gets the latest version number out of the package,
7+
saving us from maintaining it in multiple places.
8+
"""
9+
local_results = {}
10+
with open('script_runner/version.py') as version_file:
11+
exec(version_file.read(), {}, local_results)
12+
return local_results['__version__']
13+
414
setup(
515
name="script-runner-api",
616
packages=[
717
"script_runner",
818
"script_runner.api",
919
],
1020
scripts=["script_runner/main.py"],
11-
version=os.environ.get("SCRIPT_RUNNER_VERSION", "latest"),
21+
version=get_version(),
1222
license="MIT",
1323
description="Provides an API server + celery worker module for running arbitrary scripts.",
1424
author="Robert Chu",

0 commit comments

Comments
 (0)