include api test in workflow #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Built from: | |
# https://github.com/Sage-Bionetworks/schematic/blob/develop/.github/workflows/test.yml | |
name: Test schematic API | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['*'] | |
workflow_dispatch: # Allow manually triggering the workflow | |
concurrency: | |
# cancel the current running workflow from the same branch, PR when a new workflow is triggered | |
# when the trigger is not a PR but a push, it will use the commit sha to generate the concurrency group | |
# {{ github.workflow }}: the workflow name is used to generate the concurrency group. This allows you to have more than one workflows | |
# {{ github.ref_type }}: the type of Git ref object created in the repository. Can be either branch or tag | |
# {{ github.event.pull_request.number}}: get PR number | |
# {{ github.sha }}: full commit sha | |
# credit: https://github.com/Sage-Bionetworks-Workflows/sagetasks/blob/main/.github/workflows/ci.yml | |
group: >- | |
${{ github.workflow }}-${{ github.ref_type }}- | |
${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
api-test: | |
runs-on: ubuntu-latest | |
env: | |
POETRY_VERSION: 1.3.0 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10"] | |
steps: | |
#---------------------------------------------- | |
# check-out repo and set-up python | |
#---------------------------------------------- | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#---------------------------------------------- | |
# install & configure poetry | |
#---------------------------------------------- | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org \ | |
| python3 - --version ${{ env.POETRY_VERSION }}; | |
poetry config virtualenvs.create true; | |
poetry config virtualenvs.in-project true; | |
#---------------------------------------------- | |
# load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# install dependencies and root project | |
#---------------------------------------------- | |
- name: Install dependencies and root project | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --all-extras | |
#---------------------------------------------- | |
# run API test suite | |
#---------------------------------------------- | |
- name: Run all API tests, excluding submission and benchmarks | |
env: | |
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }} | |
SERVICE_ACCOUNT_CREDS: ${{ secrets.SERVICE_ACCOUNT_CREDS }} | |
run: > | |
source .venv/bin/activate; | |
pytest --durations=0 -m "schematic_api and not submission and not rule_benchmark" | |
- name: Run all submission tests | |
env: | |
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }} | |
SERVICE_ACCOUNT_CREDS: ${{ secrets.SERVICE_ACCOUNT_CREDS }} | |
run: > | |
source .venv/bin/activate; | |
pytest -m "submission" |