Ticket/PSB-7 #2201
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
name: ci/github-actions | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
TEST_NWB_FILES: skip | |
TEST_OBSERVATORY_EXPERIMENT_PLOTS_DATA: skip | |
TEST_API_ENDPOINT: http://api.brain-map.org | |
TEST_COMPLETE: false | |
TEST_BAMBOO: false | |
LIMS_DBNAME: db | |
LIMS_PORT: 1234 | |
LIMS_PASSWORD: password | |
LIMS_HOST: host | |
LIMS_USER: user | |
MTRAIN_DBNAME: db | |
MTRAIN_USER: user | |
MTRAIN_HOST: host | |
MTRAIN_PORT: 1234 | |
MTRAIN_PASSWORD: password | |
jobs: | |
lint: | |
name: Lint | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: flake8 linting | |
run: | | |
pip install flake8 | |
export PATH="/home/runner/.local/bin:${PATH}" | |
git fetch origin master | |
# `|| true` to force exit code 0 even if no files found | |
CHANGED_PYFILES=$(git diff --name-only --diff-filter AM origin/master allensdk | grep -e ".*.py$" || true) | |
echo "List of changed files:" | |
echo ${CHANGED_PYFILES} | |
flake8 ${CHANGED_PYFILES} --count | |
allensdk: | |
name: ${{ matrix.python-version }}, ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["macos-latest", "windows-latest", "ubuntu-latest"] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
activate-environment: test-env | |
- name: Install | |
run: | | |
conda activate test-env | |
pip install codecov | |
pip install -r test_requirements.txt | |
pip install . | |
- name: Test | |
run: | | |
py.test --cov=allensdk -n 4 | |
onprem: | |
name: python ${{ matrix.image }} on-prem test | |
runs-on: ["self-hosted"] | |
strategy: | |
matrix: | |
image: ["allensdk_local_py38:latest"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: run test in docker | |
run: | | |
docker run \ | |
--env-file /home/github_worker/env.list \ | |
--mount type=bind,source=$PWD,target=/home/ghworker,bind-propagation=rshared \ | |
--mount type=bind,source=/data/informatics/module_test_data/,target=/data/informatics/module_test_data/,bind-propagation=rshared,ro \ | |
--mount type=bind,source=/allen/,target=/allen/,bind-propagation=rshared,ro \ | |
--mount type=tmpfs,destination=/tmp \ | |
--rm \ | |
${{ matrix.image }} \ | |
/bin/bash -c "pip install -r requirements.txt; \ | |
pip install -r test_requirements.txt; \ | |
python -m pytest \ | |
--log-level=INFO \ | |
--capture=no \ | |
--cov=allensdk \ | |
--cov-config coveragerc \ | |
--cov-report html \ | |
--junitxml=test-reports/test.xml \ | |
--boxed \ | |
--numprocesses auto \ | |
--durations=0" |