Skip to content

Commit

Permalink
Merge branch 'main' into fix_boundingbox_transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmetNSimsek authored Oct 13, 2024
2 parents ebc8508 + 19b6e64 commit da6a802
Show file tree
Hide file tree
Showing 46 changed files with 1,063 additions and 176 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
python-version:
required: true
type: string
use-cfg:
required: false
type: string
default: ''

jobs:
e2e:
Expand All @@ -18,7 +22,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}


- if: ${{ inputs.use-cfg != '' }}
uses: './.github/workflows/setup-custom-cfg'
with:
siibra-cfg-ref: ${{ inputs.use-cfg }}

- name: Install dependencies
shell: bash
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/_importable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
python-version:
required: true
type: string
use-cfg:
required: false
type: string
default: ''

jobs:
check-importable:
Expand All @@ -18,6 +22,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- if: ${{ inputs.use-cfg != '' }}
uses: './.github/workflows/setup-custom-cfg'
with:
siibra-cfg-ref: ${{ inputs.use-cfg }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/_unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
python-version:
required: true
type: string
use-cfg:
required: false
type: string
default: ''

jobs:
unit-tests:
Expand All @@ -18,6 +22,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '${{ inputs.python-version }}'

- if: ${{ inputs.use-cfg != '' }}
uses: './.github/workflows/setup-custom-cfg'
with:
siibra-cfg-ref: ${{ inputs.use-cfg }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/cron-siibra-tutorials.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: '[cron] test siibra-tutorials'

on:
workflow_dispatch:
schedule:
- cron: '30 6 1,11,21 * *' # every 1st, 11th, and 21th of every month at 6:30

Expand All @@ -19,6 +20,9 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -U .
pip install -r requirements.txt
pip install siibra_jugex
pip install matplotlib
pip install pytest nbmake
- name: checkout siibra-tutorials
Expand All @@ -31,4 +35,4 @@ jobs:
ref: 'main'

- name: Test tutorial notebooks with nbmake
run: pytest --nbmake ./siibra-tutorials-${{ github.run_id }}-${{ github.run_number }}
run: pytest --nbmake --nbmake-timeout=1200 ./siibra-tutorials-${{ github.run_id }}-${{ github.run_number }}
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: '[Docs and examples] Create docs and run examples'
on:
pull_request:
branches: [ 'main' ]
name: '[Docs] Build docs and upload artifacts'
on:
push:
branches: [ 'main', 'doc_*' ]
release:
types: [ 'published' ]

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push-to-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: '[mirror] push to mirror'

on:
push:
branches: ["master"]
branches: ["main"]
tags: ["**"]

env:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: mirror to remote
run: |
git fetch --tags -f
git fetch origin master
git fetch origin main
if ! git ls-remote ebrains > /dev/null; then git remote add ebrains https://jugitpusher:${{ secrets.EBRAINS_GITLAB_PUSH_TOKEN }}@${{ vars.EBRAINS_GITLAB_HOST }}/${{ env.EBRAINS_GITLAB_REPO }}; fi
git push ebrains --tags -f
git push ebrains HEAD:master -f
git push ebrains HEAD:main -f
19 changes: 19 additions & 0 deletions .github/workflows/setup-custom-cfg/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: '[siibra-cfg] setup custom config'
author: 'Xiao Gui <xgui3783@gmail.com>'
description: 'Setup siibra custom config for tests'
inputs:
siibra-cfg-ref:
description: 'git ref of siibra configuration to use'
required: true
runs:
using: composite
steps:
- uses: 'actions/checkout@v4'
with:
repository: 'fzj-inm1-bda/siibra-configurations'
ref: ${{ inputs.siibra-cfg-ref }}
path: ${{ github.workspace }}/siibra-configurations
- id: 'set-env'
run: |
echo "SIIBRA_USE_CONFIGURATION=${{ github.workspace }}/siibra-configurations" >> $GITHUB_ENV
shell: bash
51 changes: 50 additions & 1 deletion .github/workflows/siibra-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,107 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
USE_CONFIG_COMMIT_KW: "[ci:usecfg]"

jobs:

use-custom-cfg:
runs-on: ubuntu-latest
outputs:
USE_REF: ${{ steps.use-ref.outputs.USE_REF }}
env:
# see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
COMMIT_MSG: ${{ github.event.head_commit.message }}
steps:
- uses: actions/checkout@v4
- id: 'use-ref'
run: |
SED_S_PATTERN=$(echo '${{ env.USE_CONFIG_COMMIT_KW }}' | sed 's/\[/\\[/' | sed 's/]/\\]/')
echo "$COMMIT_MSG" | while IFS= read -r line
do
if [[ "$line" == "${{ env.USE_CONFIG_COMMIT_KW }}"* ]]
then
echo "Found usecfg line in commit message: $line"
USE_REF=$(echo $line | sed "s/$SED_S_PATTERN *//")
echo "Use Ref: $USE_REF"
echo USE_REF=$USE_REF >> $GITHUB_OUTPUT
fi
done
lint:
uses: ./.github/workflows/_lint.yaml
with:
os: ubuntu-latest
python-version: '3.8'

check-importable:
needs: 'use-custom-cfg'
uses: ./.github/workflows/_importable.yaml
with:
os: ubuntu-20.04
python-version: ${{ matrix.python-version }}
use-cfg: ${{ needs.use-custom-cfg.outputs.USE_REF }}
strategy:
fail-fast: false
matrix:
python-version: [ '3.12', '3.11', '3.10', '3.9', '3.8' ]

check-importable-python-3_7:
needs: 'use-custom-cfg'
uses: ./.github/workflows/_importable.yaml
with:
os: ubuntu-latest
python-version: ${{ matrix.python-version }}
use-cfg: ${{ needs.use-custom-cfg.outputs.USE_REF }}
strategy:
fail-fast: false
matrix:
python-version: [ '3.12', '3.11', '3.10', '3.9', '3.8', '3.7' ]
python-version: [ '3.7' ]

unit-tests-full:
if: ${{ github.event_name == 'pull_request' }}
needs: 'use-custom-cfg'
uses: ./.github/workflows/_unittest.yaml
with:
os: ubuntu-latest
python-version: ${{ matrix.python-version }}
use-cfg: ${{ needs.use-custom-cfg.outputs.USE_REF }}
strategy:
fail-fast: false
matrix:
python-version: [ '3.12', '3.11', '3.10', '3.9', '3.8', '3.7' ]

unit-tests-fast:
if: ${{ github.event_name != 'pull_request' }}
needs: 'use-custom-cfg'
uses: ./.github/workflows/_unittest.yaml
with:
os: ubuntu-latest
python-version: '3.8'
use-cfg: ${{ needs.use-custom-cfg.outputs.USE_REF }}


e2e-tests-full:
if: ${{ github.event_name == 'pull_request' }}
needs: 'use-custom-cfg'
uses: ./.github/workflows/_e2e.yaml
with:
os: ubuntu-latest
python-version: ${{ matrix.python-version }}
use-cfg: ${{ needs.use-custom-cfg.outputs.USE_REF }}
strategy:
fail-fast: false
matrix:
python-version: [ '3.12', '3.11', '3.10', '3.9', '3.8', '3.7' ]

e2e-tests-fast:
if: ${{ github.event_name != 'pull_request' }}
needs: 'use-custom-cfg'
uses: ./.github/workflows/_e2e.yaml
with:
os: ubuntu-latest
python-version: '3.8'
use-cfg: ${{ needs.use-custom-cfg.outputs.USE_REF }}


4 changes: 2 additions & 2 deletions .github/workflows/validate-citation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install cffconvert
Expand All @@ -31,7 +31,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install cffconvert
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ license: Apache-2.0

repository-code: https://github.com/FZJ-INM1-BDA/siibra-python

version: v1.0a09
version: v1.0a14

date-released: 2024-03-14
date-released: 2024-07-03

doi: 10.5281/zenodo.7885728

Expand Down
3 changes: 3 additions & 0 deletions config_schema/has_ebrainsrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
},
"openminds/BrainAtlasVersion": {
"$ref": "#/definitions/ebrainsdef"
},
"openminds/AtlasAnnotation": {
"$ref": "#/definitions/ebrainsdef"
}
},
"additionalProperties": false
Expand Down
19 changes: 0 additions & 19 deletions e2e/features/activity_timeseries/test_activity_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,11 @@
import sys
from siibra.features.tabular.regional_timeseries_activity import RegionalBOLD
from siibra.features.feature import CompoundFeature
from e2e.util import check_duplicate

skip_on_windows = pytest.mark.skipif(sys.platform == "win32", reason="Fails due to memory limitation issues on Windows on Github actions. (Passes on local machines.)")

jba_29 = siibra.parcellations["julich 2.9"]


all_bold_instances = [
f
for Cls in siibra.features.feature.Feature._SUBCLASSES[RegionalBOLD]
for f in Cls._get_instances()
]


def test_id_unique():
duplicates = check_duplicate([f.id for f in all_bold_instances])
assert len(duplicates) == 0


def test_feature_unique():
duplicates = check_duplicate([f for f in all_bold_instances])
assert len(duplicates) == 0


bold_cfs = [
*siibra.features.get(jba_29, "bold"),
*siibra.features.get(siibra.parcellations["julich 3"], "bold")
Expand Down
15 changes: 2 additions & 13 deletions e2e/features/connectivity/test_connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import List
from siibra.features.feature import CompoundFeature
from siibra.features.connectivity.regional_connectivity import RegionalConnectivity
from e2e.util import check_duplicate
from zipfile import ZipFile
import os

Expand All @@ -13,17 +12,7 @@
for f in Cls._get_instances()
]

compound_conns = siibra.features.get(siibra.parcellations['julich 3'], RegionalConnectivity)


def test_id_unique():
duplicates = check_duplicate([f.id for f in all_conn_instances])
assert len(duplicates) == 0


def test_feature_unique():
duplicates = check_duplicate([f for f in all_conn_instances])
assert len(duplicates) == 0
compound_conns = siibra.features.get(siibra.parcellations['julich 3.0.3'], RegionalConnectivity)


@pytest.mark.parametrize("cf", compound_conns)
Expand All @@ -38,7 +27,7 @@ def test_connectivity_get_data(cf: CompoundFeature):


jba_29 = siibra.parcellations["julich 2.9"]
jba_3 = siibra.parcellations["julich 3"]
jba_3 = siibra.parcellations["julich 3.0.3"]

args = [
(jba_29, "StreamlineCounts"),
Expand Down
Loading

0 comments on commit da6a802

Please sign in to comment.