Skip to content

Commit

Permalink
MAINT: Fix docker (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored Apr 2, 2024
1 parent 27dd2fe commit 191ca41
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 45 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
18 changes: 3 additions & 15 deletions .github/workflows/Docker_Release_Tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,21 @@ on:

jobs:
version:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build docker image
run: docker-compose build --build-arg mne_python_v=${{ github.event.inputs.mne_python }} --build-arg mne_nirs_v=${{ github.event.inputs.mne_nirs }} --build-arg nilearn_v=${{ github.event.inputs.nilearn }} base

- name: List docker images
run: docker images

- run: docker images
- name: Rename base image tag for release
run: docker tag mne-tools/mne-nirs ghcr.io/mne-tools/mne-nirs:${{ github.event.inputs.mne_nirs }}

- name: Push image to github
run: docker push ghcr.io/mne-tools/mne-nirs:${{ github.event.inputs.mne_nirs }}

- name: System info
run: docker run ghcr.io/mne-tools/mne-nirs:${{ github.event.inputs.mne_nirs }} python -c "import mne_nirs; print(mne_nirs.__version__)"
21 changes: 7 additions & 14 deletions .github/workflows/Docker_Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,21 @@ concurrency:

jobs:
latest:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -el {0}
steps:

- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build docker image
run: docker-compose build worker

- run: docker-compose build worker
- name: System info
run: docker run mne-tools/mne-nirs python -c "import mne; mne.sys_info()"

- name: MNE-NIRS info
run: docker run mne-tools/mne-nirs python -c "import mne_nirs; print(mne_nirs.__version__)"

- name: Run visualisation test
run: docker run -v `pwd`:/opt/app/examples mne-tools/mne-nirs ipython /opt/app/examples/.github/workflows/docker_tests.py
35 changes: 20 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,19 @@ concurrency:
jobs:
# PIP + non-default stim channel + log level info
job:
name: '${{ matrix.os }} / ${{ matrix.kind }} / ${{ matrix.mne}}'
runs-on: ubuntu-20.04
name: '${{ matrix.os }} / ${{ matrix.kind }} / ${{ matrix.mne }}'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
env:
DISPLAY: ':99.0'
MNE_LOGGING_LEVEL: 'info'
MNE_STIM_CHANNEL: 'STI101'
OPENBLAS_NUM_THREADS: '1'
PYTHONUNBUFFERED: '1'
PYTHON_VERSION: '3.10'
MNEPYTHON: ${{ matrix.mne }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
mne: stable
kind: pip
python: "3.8" # oldest
python: "3.9" # oldest
- os: ubuntu-latest
mne: dev
kind: pip
Expand All @@ -45,12 +37,12 @@ jobs:
- os: windows-latest
mne: dev
kind: conda
python: "3.9"
python: "3.10"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ matrix.python }}
if: matrix.kind == 'pip'
- uses: pyvista/setup-headless-display-action@main
with:
Expand All @@ -61,12 +53,25 @@ jobs:
environment-file: environment.yml
environment-name: mne-nirs
create-args: >-
python=${{ env.PYTHON_VERSION }}
python=${{ matrix.python }}
if: matrix.kind == 'conda'
- run: pip install -r requirements_testing.txt
- run: git clone https://github.com/mne-tools/mne-python
- run: pip install --upgrade --pre -e ./mne-python git+https://github.com/nilearn/nilearn
if: matrix.mne == 'dev'
name: Install MNE and nilearn dev
# - run: pip install --upgrade --pre --force --only-binary=":all:" --index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0rc1" scipy h5py matplotlib pandas scikit-learn statsmodels "tables>=3.9.3.dev0"
# if: matrix.mne == 'dev' && startsWith(matrix.os, 'ubuntu')
# name: Install numpy, scipy, nilearn pre
- run: pip install -ve .
- run: mne sys_info
- run: ./tools/get_testing_version.sh
working-directory: mne-python
- uses: actions/cache@v4
with:
key: ${{ env.TESTING_VERSION }}
path: ~/mne_data
- run: ./tools/github_actions_download.sh
- run: pytest --cov=mne_nirs --cov-report xml -vv -m "not examples" "mne_nirs/"
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v4
if: success()
4 changes: 4 additions & 0 deletions mne_nirs/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def pytest_configure(config):
ignore:Mesa version 10\.2\.4 is too old.*:RuntimeWarning
# Pandas
ignore:np\.find_common_type is deprecated.*:DeprecationWarning
# statsmodels
ignore:The numpy\.linalg\.linalg has been made private.*:DeprecationWarning
# sklearn
ignore:KMeans is known to have a memory leak on Windows with MKL.*:UserWarning
""" # noqa: E501
for warning_line in warning_lines.split("\n"):
warning_line = warning_line.strip()
Expand Down
2 changes: 1 addition & 1 deletion mne_nirs/io/fold/_fold.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def _source_detector_fold_table(raw, cidx, reference, fold_tbl, interpolate):
if len(tbl) == 0 and interpolate:
# Try something hopefully not too terrible: pick the one with the
# smallest net distance
good = np.in1d(fold_tbl["Source"], reference["label"]) & np.in1d(
good = np.isin(fold_tbl["Source"], reference["label"]) & np.isin(
fold_tbl["Detector"], reference["label"]
)
assert good.any()
Expand Down
1 change: 1 addition & 0 deletions tools/github_actions_download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ fi
python -c 'from mne_nirs.datasets import fnirs_motor_group; fnirs_motor_group.data_path(force_update=True)'
python -c 'from mne_nirs.datasets import block_speech_noise; block_speech_noise.data_path(force_update=True)'
python -c 'from mne_nirs.datasets import audio_or_visual_speech; audio_or_visual_speech.data_path(force_update=True)'
python -c "from mne.datasets import fnirs_motor; fnirs_motor.data_path(force_update=True)"

0 comments on commit 191ca41

Please sign in to comment.