Skip to content

Commit 87a1699

Browse files
authored
Merge pull request #1236 from Sage-Bionetworks/develop
Schematic Release v23.6.1
2 parents c9b7ae7 + b27c45c commit 87a1699

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+9538
-2418
lines changed

.github/workflows/api_test.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Built from:
2+
# https://github.com/Sage-Bionetworks/schematic/blob/develop/.github/workflows/test.yml
3+
4+
name: Test schematic API
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
perform_benchmarking:
10+
required: true
11+
type: boolean
12+
description: perform benchmarking test (True) or skip (False)
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
env:
18+
POETRY_VERSION: 1.2.0
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.9", "3.10"]
23+
24+
steps:
25+
26+
#----------------------------------------------
27+
# check-out repo and set-up python
28+
#----------------------------------------------
29+
- name: Check out repository
30+
uses: actions/checkout@v2
31+
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v2
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
#----------------------------------------------
38+
# install & configure poetry
39+
#----------------------------------------------
40+
- name: Install Poetry
41+
run: |
42+
curl -sSL https://install.python-poetry.org \
43+
| python3 - --version ${{ env.POETRY_VERSION }};
44+
poetry config virtualenvs.create true;
45+
poetry config virtualenvs.in-project true;
46+
#----------------------------------------------
47+
# load cached venv if cache exists
48+
#----------------------------------------------
49+
- name: Load cached venv
50+
id: cached-poetry-dependencies
51+
uses: actions/cache@v2
52+
with:
53+
path: .venv
54+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
55+
56+
#----------------------------------------------
57+
# install dependencies if cache does not exist
58+
#----------------------------------------------
59+
- name: Install dependencies
60+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
61+
run: poetry install --no-interaction --no-root --all-extras
62+
63+
#----------------------------------------------
64+
# install your root project, if required
65+
#----------------------------------------------
66+
- name: Install library
67+
run: poetry install --no-interaction
68+
69+
#----------------------------------------------
70+
# run API test suite
71+
#----------------------------------------------
72+
- name: Run all API tests
73+
env:
74+
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }}
75+
SERVICE_ACCOUNT_CREDS: ${{ secrets.SERVICE_ACCOUNT_CREDS }}
76+
if: ${{ inputs.perform_benchmarking }}
77+
run: >
78+
source .venv/bin/activate;
79+
pytest -m "schematic_api"
80+
81+
- name: Run API tests + Exclude Benchmarks
82+
env:
83+
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }}
84+
SERVICE_ACCOUNT_CREDS: ${{ secrets.SERVICE_ACCOUNT_CREDS }}
85+
if: ${{ false == inputs.perform_benchmarking }}
86+
run: >
87+
source .venv/bin/activate;
88+
pytest -m "schematic_api and not rule_benchmark"

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Build and publish container to Docker Hub
55

66
on:
77
push:
8-
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
8+
tags: ['^v\d+\.\d+\.\d+$'] # Match tags that resemble a version, but exclude minior releases. For example, v0.1.1-beta would not get included
99
workflow_dispatch:
1010

1111
jobs:

.github/workflows/docker_build.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Taken from https://github.com/Sage-Bionetworks/data_curator/blob/schematic-rest-api/.github/workflows/docker_build.yml
2+
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
3+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
4+
5+
name: Create and publish a Docker image
6+
7+
on:
8+
push:
9+
tags:
10+
- '*beta*'
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_PATH: ghcr.io/${{ github.repository }}
15+
16+
jobs:
17+
build-and-push-image:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
37+
with:
38+
images: ${{ env.IMAGE_PATH }}
39+
tags: |
40+
type=ref,event=branch
41+
type=ref,event=pr
42+
type=semver,pattern={{raw}}
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
45+
with:
46+
file: schematic_api/Dockerfile
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/pdoc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
run: poetry install --no-interaction --no-root
7373

7474
# create documentation
75+
- run: poetry add pdoc@13.0.0
7576
- run: poetry show pdoc
7677
- run: poetry run pdoc --docformat google -o docs/schematic schematic/manifest schematic/models schematic/schemas schematic/store schematic/utils schematic/visualization
7778

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish to PyPI
22
on:
33
push:
44
tags:
5-
- '*'
5+
- 'v[1-9][0-9].[0-9]+.[0-9]+'
66
branches: [main]
77

88
jobs:

.github/workflows/test.yml

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ name: Test schematic
88
on:
99
push:
1010
branches: ['main']
11-
pull_request:
11+
pull_request:
1212
branches: ['*']
1313
workflow_dispatch: # Allow manually triggering the workflow
1414
concurrency:
15-
# cancel the current running workflow from the same branch, PR when a new workflow is triggered
15+
# cancel the current running workflow from the same branch, PR when a new workflow is triggered
1616
# when the trigger is not a PR but a push, it will use the commit sha to generate the concurrency group
1717
# {{ 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
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
2121
# credit: https://github.com/Sage-Bionetworks-Workflows/sagetasks/blob/main/.github/workflows/ci.yml
2222
group: >-
2323
${{ github.workflow }}-${{ github.ref_type }}-
@@ -27,16 +27,16 @@ jobs:
2727
test:
2828
runs-on: ubuntu-latest
2929
env:
30-
POETRY_VERSION: 1.2.0rc1
30+
POETRY_VERSION: 1.2.0
3131
strategy:
3232
fail-fast: false
3333
matrix:
34-
python-version: ["3.7", "3.8", "3.9", "3.10"]
34+
python-version: ["3.9", "3.10"]
3535

3636
steps:
3737

3838
#----------------------------------------------
39-
# check-out repo and set-up python
39+
# check-out repo and set-up python
4040
#----------------------------------------------
4141
- name: Check out repository
4242
uses: actions/checkout@v2
@@ -45,19 +45,18 @@ jobs:
4545
uses: actions/setup-python@v2
4646
with:
4747
python-version: ${{ matrix.python-version }}
48-
48+
4949
#----------------------------------------------
50-
# install & configure poetry
50+
# install & configure poetry
5151
#----------------------------------------------
5252
- name: Install Poetry
5353
run: |
5454
curl -sSL https://install.python-poetry.org \
5555
| python3 - --version ${{ env.POETRY_VERSION }};
56-
poetry config virtualenvs.create true;
57-
poetry config virtualenvs.in-project true;
58-
56+
poetry config virtualenvs.create true;
57+
poetry config virtualenvs.in-project true;
5958
#----------------------------------------------
60-
# load cached venv if cache exists
59+
# load cached venv if cache exists
6160
#----------------------------------------------
6261
- name: Load cached venv
6362
id: cached-poetry-dependencies
@@ -67,21 +66,21 @@ jobs:
6766
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
6867

6968
#----------------------------------------------
70-
# install dependencies if cache does not exist
69+
# install dependencies if cache does not exist
7170
#----------------------------------------------
7271
- name: Install dependencies
7372
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
74-
run: poetry install --no-interaction --no-root
75-
73+
run: poetry install --no-interaction --no-root --all-extras
74+
75+
#----------------------------------------------
76+
# install your root project, if required
7677
#----------------------------------------------
77-
# install your root project, if required
78-
#----------------------------------------------
7978
- name: Install library
8079
run: poetry install --no-interaction
81-
80+
8281
#----------------------------------------------
8382
# perform linting
84-
#----------------------------------------------
83+
#----------------------------------------------
8584
# Disabled until we agree to turn it on
8685
# - name: Lint with flake8
8786
# run: |
@@ -93,14 +92,34 @@ jobs:
9392
#----------------------------------------------
9493
# check formatting
9594
#----------------------------------------------
96-
# Disabled until we agree to turn it on
97-
# - name: Code formatting with black
98-
# run: |
99-
# # run black in check mode
100-
# # if files are not formatted correctly, the build will not go through
101-
# black . --check
95+
- name: Code formatting with black
96+
run: |
97+
# ran only on certain files for now
98+
# add here when checked
99+
poetry run black schematic/configuration.py schematic/exceptions.py schematic/help.py schematic/loader.py schematic/version.py --check
100+
102101
#----------------------------------------------
103-
# run test suite
102+
# type checking/enforcement
103+
#----------------------------------------------
104+
- name: Type checking with mypy
105+
run: |
106+
# ran only on certain files for now
107+
# add here when checked
108+
poetry run mypy --install-types --non-interactive schematic/configuration.py
109+
# add here when enforced
110+
poetry run mypy --disallow-untyped-defs --install-types --non-interactive schematic/exceptions.py schematic/help.py schematic/loader.py schematic/version.py
111+
112+
#----------------------------------------------
113+
# linting
114+
#----------------------------------------------
115+
- name: Lint with pylint
116+
run: |
117+
# ran only on certain files for now
118+
# add here when checked
119+
poetry run pylint schematic/exceptions.py schematic/help.py schematic/loader.py schematic/version.py
120+
121+
#----------------------------------------------
122+
# run test suite
104123
#----------------------------------------------
105124
- name: Run regular tests and rule combination tests
106125
env:
@@ -109,8 +128,8 @@ jobs:
109128
run: >
110129
source .venv/bin/activate;
111130
pytest --cov-report=term --cov-report=html:htmlcov --cov=schematic/
112-
-m "not (google_credentials_needed or table_operations)"
113-
131+
-m "not (google_credentials_needed or schematic_api or table_operations)"
132+
114133
- name: Run tests
115134
env:
116135
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }}
@@ -120,7 +139,7 @@ jobs:
120139
source .venv/bin/activate;
121140
pytest --cov-report=term --cov-report=html:htmlcov --cov=schematic/
122141
-m "not (google_credentials_needed or rule_combos or schematic_api or table_operations)"
123-
142+
124143
- name: Upload pytest test results
125144
uses: actions/upload-artifact@v2
126145
with:

.pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[MAIN]
2+
load-plugins=pylint.extensions.docparams

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build:
1212
python: "3.9"
1313
jobs:
1414
post_install:
15-
- pip install poetry==1.2.0b1
15+
- pip install poetry==1.2.0
1616
- poetry config virtualenvs.create false
1717
- poetry install --with doc
1818
#Poetry will install my dependencies into the virtualenv created by readthedocs if I set virtualenvs.create=false

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ENV PYTHONFAULTHANDLER=1 \
77
PIP_NO_CACHE_DIR=off \
88
PIP_DISABLE_PIP_VERSION_CHECK=on \
99
PIP_DEFAULT_TIMEOUT=200 \
10-
POETRY_VERSION=1.2.0rc1
10+
POETRY_VERSION=1.2.0
1111

1212
WORKDIR /usr/src/app
1313

@@ -29,4 +29,4 @@ RUN poetry install --no-interaction --no-ansi --no-root
2929

3030
COPY . ./
3131

32-
RUN poetry install --no-interaction --no-ansi --only-root
32+
RUN poetry install --only-root

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SCHEMATIC is an acronym for _Schema Engine for Manifest Ingress and Curation_. T
2020

2121
# Installation
2222
## Installation Requirements
23-
* Python 3.7.1 or higher
23+
* Python version 3.9.0≤x<3.11.0
2424

2525
Note: You need to be a registered and certified user on [`synapse.org`](https://www.synapse.org/), and also have the right permissions to download the Google credentials files from Synapse.
2626

0 commit comments

Comments
 (0)