diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..b6978346 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,41 @@ +name: Documentation Checks + +on: [push] + +jobs: + spell_check: + strategy: + max-parallel: 4 + matrix: + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Spell check install + run: curl -L https://git.io/misspell | bash + - name: Spell check docs + run: bin/misspell -error docs/* + + code_docs: + strategy: + max-parallel: 4 + matrix: + os: [ubuntu-latest] + python-version: [3.7] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Run docs tests + run: tox -e docs + \ No newline at end of file diff --git a/.github/workflows/int.yml b/.github/workflows/int.yml new file mode 100644 index 00000000..a3b70517 --- /dev/null +++ b/.github/workflows/int.yml @@ -0,0 +1,58 @@ +name: Integration Tests + +on: [pull_request] + +jobs: + build: + strategy: + max-parallel: 4 + matrix: + os: [ubuntu-latest] + python-version: [3.7] + + runs-on: ${{ matrix.os }} + + name: Integration Tests + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install requirements + run: | + wget https://github.com/openshift/source-to-image/releases/download/v1.2.0/source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz + tar -xvf source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz + sudo cp s2i /usr/local/bin + pip install aiohttp + pip install requests + - name: Build image + run: | + s2i build . centos/python-36-centos7 cscfi/beacon-python + + - name: Start Services + run: | + pushd deploy/test + docker-compose up -d + sleep 10 + docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz data/example_metadata.json + docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_registered.json + docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_controlled.json + docker exec test_beacon_1 beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_controlled1.json + + - name: Run Integration test + run: | + pushd deploy/test + python run_tests.py + + - name: Collect logs from docker + if: ${{ failure() }} + run: cd deploy && docker-compose logs --no-color -t > ../tests/dockerlogs || true + + - name: Persist log files + if: ${{ failure() }} + uses: actions/upload-artifact@v1 + with: + name: test_debugging_help + path: tests diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..e254d484 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,49 @@ +name: Publish Docker image + +on: + release: + types: [published] + push: + branches: [master] + +jobs: + push_to_registry: + name: Push Beacon Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Login to DockerHub Registry + run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + - name: Get the version + id: vars + run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) + - name: Build the tagged Docker image + run: docker build . --file Dockerfile --tag cscfi/beacon-python:${{steps.vars.outputs.tag}} + - name: Push the tagged Docker image + run: docker push cscfi/beacon-python:${{steps.vars.outputs.tag}} + - name: Build the latest Docker image + run: docker build . --file Dockerfile --tag cscfi/beacon-python:latest + - name: Push the latest Docker image + run: docker push cscfi/beacon-python:latest + push_data_to_registry: + name: Push Dataloader Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Login to DockerHub Registry + run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + - name: Get the version + id: vars + run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) + - name: Build the tagged Docker image + run: | + pushd deploy/test + docker build . --file Dockerfile --tag cscfi/beacon-dataloader:${{steps.vars.outputs.tag}} + - name: Push the tagged Docker image + run: docker push cscfi/beacon-dataloader:${{steps.vars.outputs.tag}} + - name: Build the latest Docker image + run: | + pushd deploy/test + docker build . --file Dockerfile --tag cscfi/beacon-dataloader:latest + - name: Push the latest Docker image + run: docker push cscfi/beacon-dataloader:latest \ No newline at end of file diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 00000000..8eb6b902 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,28 @@ +name: Python style check + +on: [push] + +jobs: + style_check: + strategy: + max-parallel: 4 + matrix: + os: [ubuntu-latest] + python-version: [3.6, 3.7] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test flake8 syntax with tox + run: tox -e flake8 + - name: Do bandit static check with tox + run: tox -e bandit \ No newline at end of file diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml new file mode 100644 index 00000000..c42cab9e --- /dev/null +++ b/.github/workflows/unit.yml @@ -0,0 +1,30 @@ +name: Python Unit Tests + +on: [push] + +jobs: + unit_test: + strategy: + max-parallel: 4 + matrix: + os: [ubuntu-latest] + python-version: [3.6, 3.7] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install libcurl-devel + run: sudo apt-get install libcurl4-openssl-dev + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Run unit tests + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: tox -e unit_tests \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4723f86c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,103 +0,0 @@ -sudo: required -dist: xenial -language: python - -install: true - -git: - depth: false - quiet: true - -services: docker - -stages: - - name: tests - if: type IN (push, pull_request) - - name: integtests - if: type IN (pull_request) - - name: image - if: branch = master AND type = push - - name: image tag - if: tag =~ /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ - - -jobs: - include: - - stage: tests - name: "Code Style Check" - python: 3.6 - before_script: - - pip install tox-travis - script: tox -e flake8 - - stage: tests - name: "Unit Tests Python 3.6" - python: 3.6 - before_script: - - sudo apt-get update - - sudo apt-get install libcurl4-openssl-dev - - pip install tox-travis - script: tox -e py36 - - stage: tests - name: "Unit Tests Python 3.7" - python: 3.7 - before_script: - - sudo apt-get update - - sudo apt-get install libcurl4-openssl-dev - - pip install tox-travis - script: tox -e py37 - - stage: tests - name: "Documentation Tests" - python: 3.6 - before_script: - - pip install tox-travis - script: tox -e docs - - stage: tests - name: "Check Spelling Errors" - before_script: - - curl -L https://git.io/misspell | bash - script: bin/misspell -error docs/* - - stage: tests - name: "Python Code Security Tests" - python: 3.6 - before_script: - - pip install tox-travis - script: tox -e bandit - - stage: integtests - name: "Integration Tests" - python: 3.6 - before_script: - - wget https://github.com/openshift/source-to-image/releases/download/v1.2.0/source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz - - tar -xvf source-to-image-v1.2.0-2a579ecd-linux-amd64.tar.gz - - sudo cp s2i /usr/local/bin - - s2i build . centos/python-36-centos7 cscfi/beacon-python - - cd deploy/test - - docker-compose up -d - - sleep 10 - - docker-compose exec beacon beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz data/example_metadata.json - - docker-compose exec beacon beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_registered.json - - docker-compose exec beacon beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_controlled.json - - docker-compose exec beacon beacon_init data/ALL.chrMT.phase3_callmom-v0_4.20130502.genotypes.vcf.gz /exdata/example_metadata_controlled1.json - - pip install aiohttp - - pip install requests - script: - - python run_tests.py - - stage: image - name: "Image Publish" - before_script: - - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - script: - - docker build -t cscfi/beacon-python . - - docker push cscfi/beacon-python:latest - - cd deploy/dataloader - - docker build -t cscfi/beacon-dataloader . - - docker push cscfi/beacon-dataloader:latest - - stage: image tag - name: "Image Tag Publish" - before_script: - - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - script: - - docker build -t cscfi/beacon-python:$TRAVIS_TAG . - - docker push cscfi/beacon-python:$TRAVIS_TAG - -notifications: - email: false diff --git a/README.md b/README.md index fbf4e103..48377215 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ## beacon-python - Python-based Beacon API Web Server -[![Build Status](https://travis-ci.org/CSCfi/beacon-python.svg?branch=master)](https://travis-ci.org/CSCfi/beacon-python) -[![Coverage Status](https://coveralls.io/repos/github/CSCfi/beacon-python/badge.svg?branch=master)](https://coveralls.io/github/CSCfi/beacon-python?branch=master) +![Integration Tests](https://github.com/CSCfi/beacon-python/workflows/Integration%20Tests/badge.svg) +![Python Unit Tests](https://github.com/CSCfi/beacon-python/workflows/Python%20Unit%20Tests/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/CSCfi/beacon-python/badge.svg?branch=HEAD)](https://coveralls.io/github/CSCfi/beacon-python?branch=HEAD) [![Documentation Status](https://readthedocs.org/projects/beacon-python/badge/?version=latest)](https://beacon-python.readthedocs.io/en/latest/?badge=latest) -[![Docker Image](https://images.microbadger.com/badges/image/cscfi/beacon-python.svg)](https://microbadger.com/images/cscfi/beacon-python) Documentation: https://beacon-python.readthedocs.io diff --git a/beacon_api/schemas/info.json b/beacon_api/schemas/info.json index dfb20f2a..a8e5abfe 100644 --- a/beacon_api/schemas/info.json +++ b/beacon_api/schemas/info.json @@ -1,7 +1,459 @@ { - "definitions": {}, "type": "object", "additionalProperties": false, + "definitions": { + "string": { + "$id": "$/definitions/string", + "type": "string", + "pattern": "^(.*)$" + }, + "orgType": { + "$id": "$/definitions/orgType", + "type": "string", + "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] + }, + "orgPurpose": { + "type": "array", + "items": { + "type": "object", + "properties": { + "description": { + "$ref": "#/definitions/string" + }, + "obligatory": { + "type": "boolean" + } + } + } + }, + "consentDataUse": { + "$id": "$/definitions/consentDataUse", + "type": "object", + "required": [ + "primaryCategory", + "version" + ], + "properties": { + "primaryCategory": { + "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "$ref": "#/definitions/string" + }, + "description": { + "$ref": "#/definitions/string" + } + } + }, + "secondaryCategories": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "$ref": "#/definitions/string" + }, + "description": { + "$ref": "#/definitions/string" + } + } + } + }, + "requirements": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "$ref": "#/definitions/string" + }, + "description": { + "$ref": "#/definitions/string" + } + } + } + }, + "version": { + "type": "string" + } + } + }, + "adamDataUse": { + "$id":"$/definitions/adamDataUse", + "type": "object", + "required": [ + "header", + "profile", + "terms", + "metaConditions" + ], + "properties": { + "header": { + "type": "object", + "properties": { + "matrixName": { + "$ref": "#/definitions/string" + }, + "matrixVersion": { + "$ref": "#/definitions/string" + }, + "matrixReferences": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "matrixProfileCreateDate": { + "$ref": "#/definitions/string" + }, + "matrixProfileUpdates": { + "type": "array", + "items": { + "type": "object", + "properties": { + "date": { + "$ref": "#/definitions/string" + }, + "description": { + "$ref": "#/definitions/string" + } + } + } + }, + "resourceName": { + "$ref": "#/definitions/string" + }, + "resourceReferences": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "resourceDescription": { + "$ref": "#/definitions/string" + }, + "resourceDataLevel": { + "type": "string", + "enum": ["UNKNOWN", "DATABASE", "METADATA", + "SUMMARISED", "DATASET", "RECORDSET", "RECORD", "RECORDFIELD"] + }, + "resourceContactNames": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "$ref": "#/definitions/string" + }, + "email": { + "$ref": "#/definitions/string" + } + } + } + }, + "resourceContactOrganisations": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + } + } + }, + "profile": { + "type": "object", + "properties": { + "country": { + "type": "string", + "enum": ["UNRESTRICTED", "LIMITED"] + }, + "allowedCountries": { + "$ref": "#/definitions/orgPurpose" + }, + "organisation": { + "type": "string", + "enum": ["UNRESTRICTED", "LIMITED"] + }, + "allowedOrganisations": { + "$ref": "#/definitions/orgPurpose" + }, + "nonProfitOrganisation": { + "$ref": "#/definitions/orgType" + }, + "allowedNonProfitOrganisations": { + "$ref": "#/definitions/orgPurpose" + }, + "profitOrganisation": { + "$ref": "#/definitions/orgType" + }, + "allowedProfitOrganisations": { + "$ref": "#/definitions/orgPurpose" + }, + "person": { + "type": "string", + "enum": ["UNRESTRICTED", "LIMITED"] + }, + "allowedPersons": { + "$ref": "#/definitions/orgPurpose" + }, + "academicProfessional": { + "$ref": "#/definitions/orgType" + }, + "allowedAcademicProfessionals": { + "$ref": "#/definitions/orgPurpose" + }, + "clinicalProfessional": { + "$ref": "#/definitions/orgType" + }, + "allowedClinicalProfessionals": { + "$ref": "#/definitions/orgPurpose" + }, + "profitProfessional": { + "$ref": "#/definitions/orgType" + }, + "allowedProfitProfessionals": { + "$ref": "#/definitions/orgPurpose" + }, + "nonProfessional": { + "$ref": "#/definitions/orgType" + }, + "allowedNonProfessionals": { + "$ref": "#/definitions/orgPurpose" + }, + "nonProfitPurpose": { + "$ref": "#/definitions/orgType" + }, + "allowedNonProfitPurposes": { + "$ref": "#/definitions/orgPurpose" + }, + "profitPurpose": { + "$ref": "#/definitions/orgType" + }, + "allowedProfitPurposes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "description": { + "$ref": "#/definitions/string" + }, + "obligatory": { + "type": "boolean" + } + } + } + }, + "researchPurpose": { + "$ref": "#/definitions/orgType" + }, + "allowedResearchPurposes": { + "$ref": "#/definitions/orgPurpose" + }, + "allowedResearchProfiles": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum" : [ "OTHER", "METHODS", "CONTROL", "POPULATION", "ANCESTRY", "BIOMEDICAL", "FUNDAMENTAL", "GENETIC", "DRUG", "DISEASE", "GENDER", "AGE" ] + }, + "description": { + "$ref": "#/definitions/string" + }, + "restriction": { + "$ref": "#/definitions/orgType" + } + } + } + }, + "clinicalPurpose": { + "$ref": "#/definitions/string" + }, + "allowedClinicalPurpose": { + "type": "array", + "items": { + "type": "object", + "properties": { + "description": { + "$ref": "#/definitions/string" + }, + "obligatory": { + "type": "boolean" + } + } + } + }, + "allowedClinicalProfiles": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum" : [ "OTHER", "DECISION_SUPPORT", "DISEASE" ] + }, + "description": { + "$ref": "#/definitions/string" + }, + "restriction": { + "type": "string", + "enum" : [ "OTHER", "DECISION_SUPPORT", "DISEASE" ] + } + } + } + } + } + }, + "terms": { + "type": "object", + "properties": { + "noAuthorizationTerms": { + "type": "boolean" + }, + "whichAuthorizationTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noPublicationTerms": { + "type": "boolean" + }, + "whichPublicationTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noTimelineTerms": { + "type": "boolean" + }, + "whichTimelineTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noSecurityTerms": { + "type": "boolean" + }, + "whichSecurityTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noExpungingTerms": { + "type": "boolean" + }, + "whichExpungingTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noLinkingTerms": { + "type": "boolean" + }, + "whichLinkingTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noRecontactTerms": { + "type": "boolean" + }, + "allowedRecontactTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "compulsoryRecontactTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noIPClaimTerms": { + "type": "boolean" + }, + "whichIPClaimTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noReportingTerms": { + "type": "boolean" + }, + "whichReportingTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noCollaborationTerms": { + "type": "boolean" + }, + "whichCollaborationTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "noPaymentTerms": { + "type": "boolean" + }, + "whichPaymentTerms": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + } + } + }, + "metaConditions": { + "type": "object", + "properties": { + "sharingMode": { + "type": "string", + "enum" : [ "UNKNOWN", "DISCOVERY", "ACCESS", "DISCOVERY_AND_ACCESS" ] + }, + "multipleObligationsRule": { + "type": "string", + "enum" : [ "MEET_ALL_OBLIGATIONS", "MEET_AT_LEAST_ONE_OBLIGATION" ] + }, + "noOtherConditions": { + "type": "boolean" + }, + "whichOtherConditions": { + "type": "array", + "items": { + "$ref": "#/definitions/string" + } + }, + "sensitivePopulations": { + "type": "boolean" + }, + "uniformConsent": { + "type": "boolean" + } + } + } + } + } + }, "required": [ "id", "name", @@ -11,16 +463,13 @@ ], "properties": { "id": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "name": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "apiVersion": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "organization": { "type": "object", @@ -30,32 +479,25 @@ ], "properties": { "id": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "name": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "description": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "address": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "welcomeUrl": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "contactUrl": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "logoUrl": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "info": { "type": "object" @@ -63,28 +505,22 @@ } }, "description": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "version": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "welcomeUrl": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "alternativeUrl": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "createDateTime": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "updateDateTime": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "datasets": { "type": "array", @@ -99,32 +535,26 @@ ], "properties": { "id": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "name": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "description": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "assemblyId": { "type": "string", "pattern": "^((GRCh|hg)[0-9]+([.]?p[0-9]+)?)$" }, "createDateTime": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "updateDateTime": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "version": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "variantCount": { "type": "integer", @@ -153,607 +583,10 @@ ], "properties": { "consentCodeDataUse": { - "type": "object", - "required": [ - "primaryCategory", - "version" - ], - "properties": { - "primaryCategory": { - "type": "object", - "required": [ - "code" - ], - "properties": { - "code": { - "type": "string", - "pattern": "^(.*)$" - }, - "description": { - "type": "string", - "pattern": "^(.*)$" - } - } - }, - "secondaryCategories": { - "type": "array", - "items": { - "type": "object", - "required": [ - "code" - ], - "properties": { - "code": { - "type": "string", - "pattern": "^(.*)$" - }, - "description": { - "type": "string", - "pattern": "^(.*)$" - } - } - } - }, - "requirements": { - "type": "array", - "items": { - "type": "object", - "required": [ - "code" - ], - "properties": { - "code": { - "type": "string", - "pattern": "^(.*)$" - }, - "description": { - "type": "string", - "pattern": "^(.*)$" - } - } - } - }, - "version": { - "type": "string" - } - } + "$ref": "#/definitions/consentDataUse" }, "adamDataUse": { - "type": "object", - "required": [ - "header", - "profile", - "terms", - "metaConditions" - ], - "properties": { - "header": { - "type": "object", - "properties": { - "matrixName": { - "type": "string", - "pattern": "^(.*)$" - }, - "matrixVersion": { - "type": "string", - "pattern": "^(.*)$" - }, - "matrixReferences": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "matrixProfileCreateDate": { - "type": "string", - "pattern": "^(.*)$" - }, - "matrixProfileUpdates": { - "type": "array", - "items": { - "type": "object", - "properties": { - "date": { - "type": "string", - "pattern": "^(.*)$" - }, - "description": { - "type": "string", - "pattern": "^(.*)$" - } - } - } - }, - "resourceName": { - "type": "string", - "pattern": "^(.*)$" - }, - "resourceReferences": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "resourceDescription": { - "type": "string", - "pattern": "^(.*)$" - }, - "resourceDataLevel": { - "type": "string", - "enum": ["UNKNOWN", "DATABASE", "METADATA", - "SUMMARISED", "DATASET", "RECORDSET", "RECORD", "RECORDFIELD"] - }, - "resourceContactNames": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "pattern": "^(.*)$" - }, - "email": { - "type": "string", - "pattern": "^(.*)$" - } - } - } - }, - "resourceContactOrganisations": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - } - } - }, - "profile": { - "type": "object", - "properties": { - "country": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED"] - }, - "allowedCountries": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "organisation": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED"] - }, - "allowedOrganisations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "nonProfitOrganisation": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedNonProfitOrganisations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "profitOrganisation": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedProfitOrganisations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "person": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED"] - }, - "allowedPersons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "academicProfessional": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedAcademicProfessionals": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "clinicalProfessional": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedClinicalProfessionals": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "profitProfessional": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedProfitProfessionals": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "nonProfessional": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedNonProfessionals": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "nonProfitPurpose": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedNonProfitPurposes": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "profitPurpose": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedProfitPurposes": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "researchPurpose": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - }, - "allowedResearchPurposes": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "allowedResearchProfiles": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum" : [ "OTHER", "METHODS", "CONTROL", "POPULATION", "ANCESTRY", "BIOMEDICAL", "FUNDAMENTAL", "GENETIC", "DRUG", "DISEASE", "GENDER", "AGE" ] - }, - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "restriction": { - "type": "string", - "enum": ["UNRESTRICTED", "LIMITED", "UNRESTRICTED_OBLIGATORY", "LIMITED_OBLIGATORY", "FORBIDDEN"] - } - } - } - }, - "clinicalPurpose": { - "type": "string", - "pattern": "^(.*)$" - }, - "allowedClinicalPurpose": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "obligatory": { - "type": "boolean" - } - } - } - }, - "allowedClinicalProfiles": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum" : [ "OTHER", "DECISION_SUPPORT", "DISEASE" ] - }, - "description": { - "type": "string", - "pattern": "^(.*)$" - }, - "restriction": { - "type": "string", - "enum" : [ "OTHER", "DECISION_SUPPORT", "DISEASE" ] - } - } - } - } - } - }, - "terms": { - "type": "object", - "properties": { - "noAuthorizationTerms": { - "type": "boolean" - }, - "whichAuthorizationTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noPublicationTerms": { - "type": "boolean" - }, - "whichPublicationTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noTimelineTerms": { - "type": "boolean" - }, - "whichTimelineTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noSecurityTerms": { - "type": "boolean" - }, - "whichSecurityTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noExpungingTerms": { - "type": "boolean" - }, - "whichExpungingTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noLinkingTerms": { - "type": "boolean" - }, - "whichLinkingTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noRecontactTerms": { - "type": "boolean" - }, - "allowedRecontactTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "compulsoryRecontactTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noIPClaimTerms": { - "type": "boolean" - }, - "whichIPClaimTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noReportingTerms": { - "type": "boolean" - }, - "whichReportingTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noCollaborationTerms": { - "type": "boolean" - }, - "whichCollaborationTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "noPaymentTerms": { - "type": "boolean" - }, - "whichPaymentTerms": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - } - } - }, - "metaConditions": { - "type": "object", - "properties": { - "sharingMode": { - "type": "string", - "enum" : [ "UNKNOWN", "DISCOVERY", "ACCESS", "DISCOVERY_AND_ACCESS" ] - }, - "multipleObligationsRule": { - "type": "string", - "enum" : [ "MEET_ALL_OBLIGATIONS", "MEET_AT_LEAST_ONE_OBLIGATION" ] - }, - "noOtherConditions": { - "type": "boolean" - }, - "whichOtherConditions": { - "type": "array", - "items": { - "type": "string", - "pattern": "^(.*)$" - } - }, - "sensitivePopulations": { - "type": "boolean" - }, - "uniformConsent": { - "type": "boolean" - } - } - } - } + "$ref": "#/definitions/adamDataUse" } } } diff --git a/beacon_api/schemas/query.json b/beacon_api/schemas/query.json index ebf1270c..dd475b1c 100644 --- a/beacon_api/schemas/query.json +++ b/beacon_api/schemas/query.json @@ -1,7 +1,25 @@ { - "definitions": {}, "type": "object", "additionalProperties": false, + "definitions": { + "chromosome": { + "$id": "$/definitions/chromosome", + "type": "string", + "enum": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", + "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y", "MT" + ] + }, + "integer": { + "$id": "$/definitions/integer", + "type": "integer", + "minimum": 0 + }, + "variantType": { + "$id": "$/definitions/variantType", + "type": "string", + "enum": ["DEL", "INS", "DUP", "INV", "CNV", "SNP", "MNP", "DUP:TANDEM", "DEL:ME", "INS:ME", "BND"] + } + }, "required": [ "referenceName", "referenceBases", @@ -9,40 +27,28 @@ ], "properties": { "referenceName": { - "type": "string", - "enum": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y", "MT" - ] + "$ref": "#/definitions/chromosome" }, "mateName": { - "type": "string", - "enum": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y", "MT" - ] + "$ref": "#/definitions/chromosome" }, "start": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "end": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "startMin": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "startMax": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "endMin": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "endMax": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "referenceBases": { "type": "string", @@ -53,8 +59,7 @@ "pattern": "^([ACGTN]+)$" }, "variantType": { - "type": "string", - "enum": ["DEL", "INS", "DUP", "INV", "CNV", "SNP", "MNP", "DUP:TANDEM", "DEL:ME", "INS:ME", "BND"] + "$ref": "#/definitions/variantType" }, "assemblyId": { "type": "string", diff --git a/beacon_api/schemas/response.json b/beacon_api/schemas/response.json index c02b05fb..d0d8d035 100644 --- a/beacon_api/schemas/response.json +++ b/beacon_api/schemas/response.json @@ -1,120 +1,26 @@ { - "definitions": {}, "type": "object", "additionalProperties": false, - "required": [ - "beaconId" - ], - "properties": { - "beaconId": { - "type": "string", - "pattern": "^(.*)$" - }, - "apiVersion": { + "definitions": { + "chromosome": { + "$id": "$/definitions/chromosome", "type": "string", - "pattern": "^(.*)$" - }, - "exists": { - "oneOf": [{ - "type": "boolean" - }, - { - "type": "null" - } + "enum": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", + "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y", "MT" ] }, - "alleleRequest": { - "type": "object", - "required": [ - "referenceName", - "referenceBases", - "assemblyId" - ], - "properties": { - "referenceName": { - "oneOf": [{ - "type": "null" - }, - { - "type": "string", - "enum": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y", "MT" - ] - } - ] - }, - "mateName": { - "type": "string", - "enum": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y", "MT" - ] - }, - "start": { - "type": "integer", - "minimum": 0 - }, - "end": { - "type": "integer", - "minimum": 0 - }, - "startMin": { - "type": "integer", - "minimum": 0 - }, - "startMax": { - "type": "integer", - "minimum": 0 - }, - "endMin": { - "type": "integer", - "minimum": 0 - }, - "endMax": { - "type": "integer", - "minimum": 0 - }, - "referenceBases": { - "oneOf": [{ - "type": "null" - }, - { - "type": "string", - "pattern": "^([ACGTN]+)$" - } - ] - }, - "alternateBases": { - "type": "string", - "pattern": "^([ACGTN]+)$" - }, - "variantType": { - "type": "string", - "enum": ["DEL", "INS", "DUP", "INV", "CNV", "SNP", "MNP", "DUP:TANDEM", "DEL:ME", "INS:ME", "BND"] - }, - "assemblyId": { - "oneOf": [{ - "type": "null" - }, - { - "type": "string", - "pattern": "^((GRCh|hg)[0-9]+([.]?p[0-9]+)?)$" - } - ] - }, - "datasetIds": { - "type": "array", - "items": { - "type": "string", - "pattern": "^[^<>'\"/;`%{}+=]*$" - } - }, - "includeDatasetResponses": { - "type": "string", - "enum": ["ALL", "HIT", "MISS", "NONE"] - } - } + "integer": { + "$id": "$/definitions/integer", + "type": "integer", + "minimum": 0 }, - "beaconHandover": { + "variantType": { + "$id": "$/definitions/variantType", + "type": "string", + "enum": ["DEL", "INS", "DUP", "INV", "CNV", "SNP", "MNP", "DUP:TANDEM", "DEL:ME", "INS:ME", "BND"] + }, + "handover": { + "$id": "$/definitions/handover", "type": "array", "required": [ "handoverType", @@ -136,14 +42,14 @@ } }, "description": { - "type": "string" + "type": "string" }, "url": { - "type": "string" + "type": "string" } } }, - "datasetAlleleResponses": { + "datasetAlleleResponse": { "type": "array", "items": { "type": "object", @@ -156,7 +62,8 @@ "pattern": "^(.*)$" }, "exists": { - "oneOf": [{ + "oneOf": [ + { "type": "boolean" }, { @@ -165,33 +72,7 @@ ] }, "datasetHandover": { - "type": "array", - "required": [ - "handoverType", - "url" - ], - "properties": { - "handoverType": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string" - }, - "label": { - "type": "string" - } - } - }, - "description": { - "type": "string" - }, - "url": { - "type": "string" - } - } + "$ref": "#/definitions/handover" }, "referenceBases": { "type": "string", @@ -208,8 +89,7 @@ "type": "integer" }, "variantType": { - "type": "string", - "enum": ["DEL", "INS", "DUP", "INV", "CNV", "SNP", "MNP", "DUP:TANDEM", "DEL:ME", "INS:ME", "BND"] + "$ref": "#/definitions/variantType" }, "error": { "type": "object", @@ -232,16 +112,13 @@ "maximum": 1 }, "variantCount": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "callCount": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "sampleCount": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/integer" }, "note": { "type": "string", @@ -256,16 +133,141 @@ } }, "if": { - "properties": { "exists": { "type": "null" } } + "properties": { + "exists": { + "type": "null" + } + } }, "then": { - "required": ["error"] + "required": [ + "error" + ] }, "else": { - "not": {"required": ["error"]} + "not": { + "required": [ + "error" + ] + } + } + } + } + }, + "required": [ + "beaconId" + ], + "properties": { + "beaconId": { + "type": "string", + "pattern": "^(.*)$" + }, + "apiVersion": { + "type": "string", + "pattern": "^(.*)$" + }, + "exists": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "alleleRequest": { + "type": "object", + "required": [ + "referenceName", + "referenceBases", + "assemblyId" + ], + "properties": { + "referenceName": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/definitions/chromosome" + } + ] + }, + "mateName": { + "$ref": "#/definitions/chromosome" + }, + "start": { + "$ref": "#/definitions/integer" + }, + "end": { + "$ref": "#/definitions/integer" + }, + "startMin": { + "$ref": "#/definitions/integer" + }, + "startMax": { + "$ref": "#/definitions/integer" + }, + "endMin": { + "$ref": "#/definitions/integer" + }, + "endMax": { + "$ref": "#/definitions/integer" + }, + "referenceBases": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "string", + "pattern": "^([ACGTN]+)$" + } + ] + }, + "alternateBases": { + "type": "string", + "pattern": "^([ACGTN]+)$" + }, + "variantType": { + "$ref": "#/definitions/variantType" + }, + "assemblyId": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "string", + "pattern": "^((GRCh|hg)[0-9]+([.]?p[0-9]+)?)$" + } + ] + }, + "datasetIds": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[^<>'\"/;`%{}+=]*$" + } + }, + "includeDatasetResponses": { + "type": "string", + "enum": [ + "ALL", + "HIT", + "MISS", + "NONE" + ] } } }, + "beaconHandover": { + "$ref": "#/definitions/handover" + }, + "datasetAlleleResponses": { + "$ref": "#/definitions/datasetAlleleResponse" + }, "error": { "type": "object", "required": [ @@ -283,12 +285,22 @@ } }, "if": { - "properties": { "exists": { "type": "null" } } + "properties": { + "exists": { + "type": "null" + } + } }, "then": { - "required": ["error"] + "required": [ + "error" + ] }, "else": { - "not": {"required": ["error"]} + "not": { + "required": [ + "error" + ] + } } -} +} \ No newline at end of file diff --git a/beacon_api/schemas/service-info.json b/beacon_api/schemas/service-info.json index fec430ce..4b221229 100644 --- a/beacon_api/schemas/service-info.json +++ b/beacon_api/schemas/service-info.json @@ -1,7 +1,13 @@ { - "definitions": {}, "type": "object", "additionalProperties": false, + "definitions": { + "string": { + "$id": "$/definitions/string", + "type": "string", + "pattern": "^(.*)$" + } + }, "required": [ "id", "name", @@ -12,12 +18,10 @@ ], "properties": { "id": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "name": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "type": { "type": "object", @@ -28,22 +32,18 @@ ], "properties": { "group": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "artifact": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "version": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" } } }, "description": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "organization": { "type": "object", @@ -53,38 +53,30 @@ ], "properties": { "name": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "url": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" } } }, "contactUrl": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "documentationUrl": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "createdAt": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "updatedAt": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "environment": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" }, "version": { - "type": "string", - "pattern": "^(.*)$" + "$ref": "#/definitions/string" } } } diff --git a/tests/coveralls.py b/tests/coveralls.py index 4de55bb1..cd0978ed 100644 --- a/tests/coveralls.py +++ b/tests/coveralls.py @@ -8,7 +8,7 @@ # Solution provided by https://stackoverflow.com/questions/32757765/conditional-commands-in-tox-tox-travis-ci-and-coveralls if __name__ == '__main__': - if 'TRAVIS' in os.environ: + if 'COVERALLS_REPO_TOKEN' in os.environ: rc = call('coveralls') sys.stdout.write("Coveralls report from TRAVIS CI.\n") # raise SystemExit(rc) diff --git a/tox.ini b/tox.ini index 52010085..7b2ad05a 100644 --- a/tox.ini +++ b/tox.ini @@ -30,10 +30,12 @@ deps = flake8-docstrings commands = flake8 . -[testenv] +[testenv:unit_tests] setenv = CONFIG_FILE = {toxinidir}/tests/test.ini -passenv = TRAVIS TRAVIS_* +passenv = + TRAVIS TRAVIS_* + COVERALLS_REPO_TOKEN deps = .[test] -rrequirements.txt @@ -41,8 +43,7 @@ deps = commands = py.test -x --cov=beacon_api tests/ --cov-fail-under=80 python {toxinidir}/tests/coveralls.py -[travis] -unignore_outcomes = True +[gh-actions] python = - 3.6: py36 - 3.7: py37 \ No newline at end of file + 3.6: flake8, unit_tests, docs, bandit + 3.7: flake8, unit_tests, docs, bandit \ No newline at end of file