Skip to content

Commit 8572f2d

Browse files
authored
Merge pull request #934 from Sage-Bionetworks/develop
Release 22.9.1
2 parents 3d5a4ef + d14edc4 commit 8572f2d

28 files changed

+44549
-33516
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ignore .git and .cache folders
2+
.git
3+
.cache
4+
.synapseConfig
5+
.env

.github/workflows/docker.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This workflow builds and pushes the docker image using docker's v2 action
2+
# which requires explicitly setting up buildx and logging in
3+
4+
name: Build and publish container to Docker Hub
5+
6+
on:
7+
push:
8+
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
env:
15+
DOCKER_ORG: sagebionetworks
16+
DOCKER_REPO: schematic
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v3
21+
-
22+
name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
-
25+
name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
-
28+
name: Login to DockerHub
29+
uses: docker/login-action@v2
30+
with:
31+
username: schematicbot
32+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
33+
-
34+
name: Compute short commit SHA ID
35+
id: vars
36+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
37+
-
38+
name: Build and push (tagged release)
39+
uses: docker/build-push-action@v3
40+
if: ${{ github.event_name == 'push' }}
41+
with:
42+
platforms: linux/amd64,linux/arm64
43+
context: .
44+
push: true
45+
tags: |
46+
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:latest
47+
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ github.ref_name }}
48+
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:commit-${{ steps.vars.outputs.sha_short }}
49+
-
50+
name: Build and push (manual release)
51+
uses: docker/build-push-action@v3
52+
if: ${{ github.event_name == 'workflow_dispatch' }}
53+
with:
54+
platforms: linux/amd64,linux/arm64
55+
context: .
56+
push: true
57+
tags: |
58+
${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:commit-${{ steps.vars.outputs.sha_short }}

.github/workflows/test.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,33 @@
55

66
name: Test schematic
77

8-
on: [push, pull_request]
9-
8+
on:
9+
push:
10+
branches: ['main']
11+
pull_request:
12+
branches: ['*']
13+
workflow_dispatch: # Allow manually triggering the workflow
14+
concurrency:
15+
# cancel the current running workflow from the same branch, PR when a new workflow is triggered
16+
# when the trigger is not a PR but a push, it will use the commit sha to generate the concurrency group
17+
# {{ github.workflow }}: the workflow name is used to generate the concurrency group. This allows you to have more than one workflows
18+
# {{ github.ref_type }}: the type of Git ref object created in the repository. Can be either branch or tag
19+
# {{ github.event.pull_request.number}}: get PR number
20+
# {{ github.sha }}: full commit sha
21+
# credit: https://github.com/Sage-Bionetworks-Workflows/sagetasks/blob/main/.github/workflows/ci.yml
22+
group: >-
23+
${{ github.workflow }}-${{ github.ref_type }}-
24+
${{ github.event.pull_request.number || github.sha }}
25+
cancel-in-progress: true
1026
jobs:
1127
test:
1228

1329
runs-on: ubuntu-latest
30+
env:
31+
POETRY_VERSION: 1.2.0rc1
1432
strategy:
1533
matrix:
16-
python-version: [3.7, 3.8, 3.9]
34+
python-version: ["3.7", "3.8", "3.9", "3.10"]
1735

1836
steps:
1937

@@ -32,10 +50,11 @@ jobs:
3250
# install & configure poetry
3351
#----------------------------------------------
3452
- name: Install Poetry
35-
uses: snok/install-poetry@v1.1.1
36-
with:
37-
virtualenvs-create: true
38-
virtualenvs-in-project: true
53+
run: |
54+
curl -sSL https://install.python-poetry.org \
55+
| python3 - --version ${{ env.POETRY_VERSION }};
56+
poetry config virtualenvs.create true;
57+
poetry config virtualenvs.in-project true;
3958
4059
#----------------------------------------------
4160
# load cached venv if cache exists

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,6 @@ tests/data/example.MockComponent.schema.json
170170
tests/data/mock_manifests/Invalid_Test_Manifest_censored.csv
171171
tests/data/mock_manifests/valid_test_manifest_censored.csv
172172
tests/data/mock_manifests/Rule_Combo_Manifest_censored.csv
173+
174+
# Pickle file
175+
tests/data/schema.gpickle

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM python:3.10.6
2+
3+
ENV PYTHONFAULTHANDLER=1 \
4+
PYTHONUNBUFFERED=1 \
5+
PYTHONHASHSEED=random \
6+
PIP_NO_CACHE_DIR=off \
7+
PIP_DISABLE_PIP_VERSION_CHECK=on \
8+
PIP_DEFAULT_TIMEOUT=200 \
9+
POETRY_VERSION=1.2.0rc1
10+
11+
WORKDIR /usr/src/app
12+
13+
RUN apt-get update -qqy \
14+
&& apt-get install -qqy \
15+
libopenblas-dev \
16+
gfortran
17+
18+
RUN pip install --no-cache-dir "poetry==$POETRY_VERSION"
19+
20+
COPY pyproject.toml poetry.lock ./
21+
22+
RUN poetry config virtualenvs.create false
23+
24+
RUN poetry install --no-interaction --no-ansi --no-root
25+
26+
COPY . ./
27+
28+
RUN poetry install --no-interaction --no-ansi --only-root

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in
5959
```
6060
git clone https://github.com/Sage-Bionetworks/schematic.git
6161
```
62-
2. Follow the [instructions](https://python-poetry.org/docs/) here to install `poetry`
62+
2. Install `poetry` (version 1.2 or later) using either the [official installer](https://python-poetry.org/docs/#installing-with-the-official-installer) or [pipx](https://python-poetry.org/docs/#installing-with-pipx). If you have an older installation of Poetry, we recommend uninstalling it first.
63+
6364
3. Start the virtual environment by doing:
6465
```
6566
poetry shell
@@ -68,7 +69,7 @@ poetry shell
6869
```
6970
poetry install
7071
```
71-
This command will install the dependencies based on what we specify in poetry.lock
72+
This command will install the dependencies based on what we specify in poetry.lock. If this step is taking a long time, try to go back to step 2 and check your version of poetry. Alternatively, you could also try deleting the lock file and regenerate it by doing `poetry install` (Please note this method should be used as a last resort because this would force other developers to change their development environment)
7273

7374
5. Fill in credential files:
7475
*Note*: If you won't interact with Synapse, please ignore this section.

api/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def create_app():
1313
app = connexionapp.app
1414

1515
# path to config.yml file saved as a Flask config variable
16-
app.config["SCHEMATIC_CONFIG"] = os.path.abspath(
17-
os.path.join(__file__, "../../config.yml")
18-
)
16+
default_config = os.path.abspath(os.path.join(__file__, "../../config.yml"))
17+
schematic_config = os.environ.get("SCHEMATIC_CONFIG", default_config)
18+
app.config["SCHEMATIC_CONFIG"] = schematic_config
1919

2020
# Configure flask app
2121
# app.config[] = schematic[]

0 commit comments

Comments
 (0)