From 635a65ea10b159820c21eba5d7026f502a86b82d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Mon, 18 Nov 2024 11:57:47 +0100 Subject: [PATCH 01/12] ci: follow best practices for docker when using apt-get --- Dockerfile-ci | 3 ++- Dockerfile-docs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile-ci b/Dockerfile-ci index 90e6fd7520..ea040c03c3 100644 --- a/Dockerfile-ci +++ b/Dockerfile-ci @@ -41,7 +41,8 @@ RUN apt-get update && \ file \ dc \ libquadmath0 \ - libgomp1 + libgomp1 \ + && rm -rf /var/lib/apt/lists/* # Add xfms COPY --from=ghcr.io/juaml/human-template-xfms:main /opt/xfms /root/junifer/data/xfms diff --git a/Dockerfile-docs b/Dockerfile-docs index 116eee16e8..deb1030636 100644 --- a/Dockerfile-docs +++ b/Dockerfile-docs @@ -10,7 +10,8 @@ RUN apt-get update && \ apt-get install -y \ # ANTs runtime stuff libhdf5-dev \ - bc + bc \ + && rm -rf /var/lib/apt/lists/* # Add xfms COPY --from=ghcr.io/juaml/human-template-xfms:main /opt/xfms /root/junifer/data/xfms From ec5e6715c5aa59139d78d5b3873ccb6971da2d09 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Mon, 18 Nov 2024 12:08:54 +0100 Subject: [PATCH 02/12] ci: make xfms copying separate step in job --- .github/workflows/ci.yml | 4 ++-- .github/workflows/docs.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb2eac884b..16fa7f4291 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,8 +39,8 @@ jobs: git-annex \ make \ jq - # Copy xfms directory - mkdir -p $HOME/junifer/data/xfms && \ + - name: Copy xfms directory + mkdir -p $HOME/junifer/data/xfms cp -ar /root/junifer/data/xfms/. $HOME/junifer/data/xfms/ - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 026a71987f..089c078d92 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,8 +28,8 @@ jobs: git-annex \ make \ jq - # Copy xfms directory - mkdir -p $HOME/junifer/data/xfms && \ + - name: Copy xfms directory + mkdir -p $HOME/junifer/data/xfms cp -ar /root/junifer/data/xfms/. $HOME/junifer/data/xfms/ - name: Checkout source uses: actions/checkout@v4 From 8a122561406774a88cf71cbb9a10db196f48c038 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Mon, 18 Nov 2024 12:16:45 +0100 Subject: [PATCH 03/12] ci: cosmetic changes for consistency in ci.yml and docs.yml --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/docs.yml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16fa7f4291..e689be9929 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,10 @@ jobs: run: | echo "Using FSL : $(flirt -version)" - name: Install system dependencies + # actions/checkout fails to identify Git as it's not in the CI image run: | - # actions/checkout fails to identify Git as it's not in the CI image - apt-get -qq update && \ - apt-get -qq install -y \ + sudo apt-get update + sudo apt-get install -y \ git \ git-annex \ make \ @@ -59,8 +59,8 @@ jobs: git config --global user.email "junifer-runner@github.com" git config --global user.name "GitHub Runner" - name: Test with tox + # https://github.com/actions/checkout/issues/1169#issuecomment-2291682583 run: | - # https://github.com/actions/checkout/issues/1169#issuecomment-2291682583 git config --system --add safe.directory $(pwd) tox - name: Upload coverage to Codecov diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 089c078d92..2382648c95 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,10 +20,10 @@ jobs: run: | echo "Using ANTs : $(antsRegistration --version)" - name: Install system dependencies + # actions/checkout fails to identify Git as it's not in the CI image run: | - # actions/checkout fails to identify Git as it's not in the CI image - apt-get -qq update && \ - apt-get -qq install -y \ + sudo apt-get update + sudo apt-get install -y \ git \ git-annex \ make \ @@ -31,7 +31,7 @@ jobs: - name: Copy xfms directory mkdir -p $HOME/junifer/data/xfms cp -ar /root/junifer/data/xfms/. $HOME/junifer/data/xfms/ - - name: Checkout source + - name: Checkout repository uses: actions/checkout@v4 with: # require all of history to see all tagged versions' docs @@ -59,8 +59,8 @@ jobs: path: docs/_build - name: Build docs # Use the args we normally pass to sphinx-build, but run sphinx-multiversion + # https://github.com/actions/checkout/issues/1169#issuecomment-2291682583 run: | - # https://github.com/actions/checkout/issues/1169#issuecomment-2291682583 git config --system --add safe.directory $(pwd) make -C docs/ html touch docs/_build/.nojekyll From e1c52b98fcaf8b81d64abd2f38cc97c03eb9b9ba Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Mon, 18 Nov 2024 12:49:02 +0100 Subject: [PATCH 04/12] ci: use ubuntu-24.04 for building docker images --- .github/workflows/docker-ci-publish.yml | 2 +- .github/workflows/docker-docs-publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-ci-publish.yml b/.github/workflows/docker-ci-publish.yml index de2298f0bc..cf2c59bdd2 100644 --- a/.github/workflows/docker-ci-publish.yml +++ b/.github/workflows/docker-ci-publish.yml @@ -26,7 +26,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: read packages: write diff --git a/.github/workflows/docker-docs-publish.yml b/.github/workflows/docker-docs-publish.yml index c6fb368557..480d54018a 100644 --- a/.github/workflows/docker-docs-publish.yml +++ b/.github/workflows/docker-docs-publish.yml @@ -26,7 +26,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: read packages: write From acd5e684c047da46fd48d5131b5287cf9c8edc3d Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 14:25:50 +0100 Subject: [PATCH 05/12] ci: use ubuntu-22.04 for docs-preview.yml --- .github/workflows/docs-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 608177738d..c255faec4a 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -17,7 +17,7 @@ concurrency: preview-${{ github.ref }} jobs: build-docs: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Use custom docs CI image container: ghcr.io/juaml/junifer-docs:main steps: From f05ae6a371f1a8396a575ca772e6e6c8a35534a5 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 15:48:03 +0100 Subject: [PATCH 06/12] ci: use ubuntu-22.04 for docs.yml --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2382648c95..a8931f1eed 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,7 +12,7 @@ on: jobs: build-docs: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Use custom docs CI image container: ghcr.io/juaml/junifer-docs:main steps: From 7485cad52833e7b2e074d80c8174270cbf89c4e6 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 15:48:24 +0100 Subject: [PATCH 07/12] ci: use ubuntu-22.04 for ci.yml and ci-docs.yml --- .github/workflows/ci-docs.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index 000c8869ef..dff306f490 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -11,7 +11,7 @@ on: - '.github/workflows/**' jobs: run-tests: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e689be9929..14dda32006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: jobs: run-tests: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Use custom docs CI image container: ghcr.io/juaml/junifer-ci:main strategy: From b1ce20bf5738d1081b7f84e111668a4cfb899a64 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 15:53:22 +0100 Subject: [PATCH 08/12] chore: update .pre-commit-config.yaml --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27e551b7ad..bbfd35e247 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-ast - id: check-docstring-first @@ -17,24 +17,24 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.16 + rev: v0.23 hooks: - id: validate-pyproject - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.4.2 + rev: 24.10.0 hooks: - id: black exclude: ^(docs/|examples/|tools/) args: [--check] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.2 + rev: v0.9.3 hooks: - id: ruff types_or: [python, jupyter] exclude: ^(__init__.py) args: [--output-format, grouped, --show-fixes] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.0 hooks: - id: codespell exclude: ^(.github/|docs/) @@ -48,7 +48,7 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - repo: https://github.com/adamchainz/blacken-docs - rev: "1.16.0" + rev: "1.19.1" hooks: - id: blacken-docs additional_dependencies: From 6ce58cdd713414d59eaac3e6619c84a5825e019c Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 15:54:22 +0100 Subject: [PATCH 09/12] chore: lint --- .../markers/complexity/tests/test_complexity_base.py | 2 +- .../markers/complexity/tests/test_hurst_exponent.py | 10 +++++----- .../complexity/tests/test_multiscale_entropy_auc.py | 10 +++++----- junifer/markers/complexity/tests/test_perm_entropy.py | 10 +++++----- junifer/markers/complexity/tests/test_range_entropy.py | 10 +++++----- .../markers/complexity/tests/test_range_entropy_auc.py | 10 +++++----- .../markers/complexity/tests/test_sample_entropy.py | 10 +++++----- .../complexity/tests/test_weighted_perm_entropy.py | 10 +++++----- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/junifer/markers/complexity/tests/test_complexity_base.py b/junifer/markers/complexity/tests/test_complexity_base.py index 09caf987cb..47e4f9b6dd 100644 --- a/junifer/markers/complexity/tests/test_complexity_base.py +++ b/junifer/markers/complexity/tests/test_complexity_base.py @@ -8,7 +8,7 @@ pytest.importorskip("neurokit2") -from junifer.markers.complexity.complexity_base import ( # noqa: E402 +from junifer.markers.complexity.complexity_base import ( ComplexityBase, ) diff --git a/junifer/markers/complexity/tests/test_hurst_exponent.py b/junifer/markers/complexity/tests/test_hurst_exponent.py index b63c777957..771e28d353 100644 --- a/junifer/markers/complexity/tests/test_hurst_exponent.py +++ b/junifer/markers/complexity/tests/test_hurst_exponent.py @@ -12,11 +12,11 @@ pytest.importorskip("neurokit2") -from junifer.datareader import DefaultDataReader # noqa: E402 -from junifer.markers.complexity import HurstExponent # noqa: E402 -from junifer.pipeline.utils import _check_ants # noqa: E402 -from junifer.storage import SQLiteFeatureStorage # noqa: E402 -from junifer.testing.datagrabbers import ( # noqa: E402 +from junifer.datareader import DefaultDataReader +from junifer.markers.complexity import HurstExponent +from junifer.pipeline.utils import _check_ants +from junifer.storage import SQLiteFeatureStorage +from junifer.testing.datagrabbers import ( SPMAuditoryTestingDataGrabber, ) diff --git a/junifer/markers/complexity/tests/test_multiscale_entropy_auc.py b/junifer/markers/complexity/tests/test_multiscale_entropy_auc.py index 6ddc0447b6..fa5b3c0a96 100644 --- a/junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +++ b/junifer/markers/complexity/tests/test_multiscale_entropy_auc.py @@ -11,11 +11,11 @@ pytest.importorskip("neurokit2") -from junifer.datareader import DefaultDataReader # noqa: E402 -from junifer.markers.complexity import MultiscaleEntropyAUC # noqa: E402 -from junifer.pipeline.utils import _check_ants # noqa: E402 -from junifer.storage import SQLiteFeatureStorage # noqa: E402 -from junifer.testing.datagrabbers import ( # noqa: E402 +from junifer.datareader import DefaultDataReader +from junifer.markers.complexity import MultiscaleEntropyAUC +from junifer.pipeline.utils import _check_ants +from junifer.storage import SQLiteFeatureStorage +from junifer.testing.datagrabbers import ( SPMAuditoryTestingDataGrabber, ) diff --git a/junifer/markers/complexity/tests/test_perm_entropy.py b/junifer/markers/complexity/tests/test_perm_entropy.py index 3aef2c2b61..5804469957 100644 --- a/junifer/markers/complexity/tests/test_perm_entropy.py +++ b/junifer/markers/complexity/tests/test_perm_entropy.py @@ -11,11 +11,11 @@ pytest.importorskip("neurokit2") -from junifer.datareader import DefaultDataReader # noqa: E402 -from junifer.markers.complexity import PermEntropy # noqa: E402 -from junifer.pipeline.utils import _check_ants # noqa: E402 -from junifer.storage import SQLiteFeatureStorage # noqa: E402 -from junifer.testing.datagrabbers import ( # noqa: E402 +from junifer.datareader import DefaultDataReader +from junifer.markers.complexity import PermEntropy +from junifer.pipeline.utils import _check_ants +from junifer.storage import SQLiteFeatureStorage +from junifer.testing.datagrabbers import ( SPMAuditoryTestingDataGrabber, ) diff --git a/junifer/markers/complexity/tests/test_range_entropy.py b/junifer/markers/complexity/tests/test_range_entropy.py index f735c625d9..873a0d2b80 100644 --- a/junifer/markers/complexity/tests/test_range_entropy.py +++ b/junifer/markers/complexity/tests/test_range_entropy.py @@ -12,11 +12,11 @@ pytest.importorskip("neurokit2") -from junifer.datareader import DefaultDataReader # noqa: E402 -from junifer.markers.complexity import RangeEntropy # noqa: E402 -from junifer.pipeline.utils import _check_ants # noqa: E402 -from junifer.storage import SQLiteFeatureStorage # noqa: E402 -from junifer.testing.datagrabbers import ( # noqa: E402 +from junifer.datareader import DefaultDataReader +from junifer.markers.complexity import RangeEntropy +from junifer.pipeline.utils import _check_ants +from junifer.storage import SQLiteFeatureStorage +from junifer.testing.datagrabbers import ( SPMAuditoryTestingDataGrabber, ) diff --git a/junifer/markers/complexity/tests/test_range_entropy_auc.py b/junifer/markers/complexity/tests/test_range_entropy_auc.py index f3b6fa160d..5955e12ff2 100644 --- a/junifer/markers/complexity/tests/test_range_entropy_auc.py +++ b/junifer/markers/complexity/tests/test_range_entropy_auc.py @@ -12,11 +12,11 @@ pytest.importorskip("neurokit2") -from junifer.datareader import DefaultDataReader # noqa: E402 -from junifer.markers.complexity import RangeEntropyAUC # noqa: E402 -from junifer.pipeline.utils import _check_ants # noqa: E402 -from junifer.storage import SQLiteFeatureStorage # noqa: E402 -from junifer.testing.datagrabbers import ( # noqa: E402 +from junifer.datareader import DefaultDataReader +from junifer.markers.complexity import RangeEntropyAUC +from junifer.pipeline.utils import _check_ants +from junifer.storage import SQLiteFeatureStorage +from junifer.testing.datagrabbers import ( SPMAuditoryTestingDataGrabber, ) diff --git a/junifer/markers/complexity/tests/test_sample_entropy.py b/junifer/markers/complexity/tests/test_sample_entropy.py index 85b73e8f4e..73139343f2 100644 --- a/junifer/markers/complexity/tests/test_sample_entropy.py +++ b/junifer/markers/complexity/tests/test_sample_entropy.py @@ -11,11 +11,11 @@ pytest.importorskip("neurokit2") -from junifer.datareader import DefaultDataReader # noqa: E402 -from junifer.markers.complexity import SampleEntropy # noqa: E402 -from junifer.pipeline.utils import _check_ants # noqa: E402 -from junifer.storage import SQLiteFeatureStorage # noqa: E402 -from junifer.testing.datagrabbers import ( # noqa: E402 +from junifer.datareader import DefaultDataReader +from junifer.markers.complexity import SampleEntropy +from junifer.pipeline.utils import _check_ants +from junifer.storage import SQLiteFeatureStorage +from junifer.testing.datagrabbers import ( SPMAuditoryTestingDataGrabber, ) diff --git a/junifer/markers/complexity/tests/test_weighted_perm_entropy.py b/junifer/markers/complexity/tests/test_weighted_perm_entropy.py index aa34da5bbf..3ebe57894f 100644 --- a/junifer/markers/complexity/tests/test_weighted_perm_entropy.py +++ b/junifer/markers/complexity/tests/test_weighted_perm_entropy.py @@ -11,11 +11,11 @@ pytest.importorskip("neurokit2") -from junifer.datareader import DefaultDataReader # noqa: E402 -from junifer.markers.complexity import WeightedPermEntropy # noqa: E402 -from junifer.pipeline.utils import _check_ants # noqa: E402 -from junifer.storage import SQLiteFeatureStorage # noqa: E402 -from junifer.testing.datagrabbers import ( # noqa: E402 +from junifer.datareader import DefaultDataReader +from junifer.markers.complexity import WeightedPermEntropy +from junifer.pipeline.utils import _check_ants +from junifer.storage import SQLiteFeatureStorage +from junifer.testing.datagrabbers import ( SPMAuditoryTestingDataGrabber, ) From 80438c2a84dffe03d26c680176db8ebc1c312126 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 15:56:44 +0100 Subject: [PATCH 10/12] chore: update ignore_words.txt --- ignore_words.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ignore_words.txt b/ignore_words.txt index b708b7efe4..25d0dc0e27 100644 --- a/ignore_words.txt +++ b/ignore_words.txt @@ -6,3 +6,5 @@ arange sinc whit amin +lets +lIns From 834b2fe1c07ca4b40a40ee8588a3a937d44bbcb6 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 16:13:33 +0100 Subject: [PATCH 11/12] chore: update and replace pypi.yml with publish.yml --- .github/workflows/publish.yml | 46 +++++++++++++++++++++++++++++++++++ .github/workflows/pypi.yml | 31 ----------------------- 2 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..cfcd213111 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,46 @@ +name: Build and publish + +on: + push: + branches: + - main + tags: + - 'v*' + +jobs: + build-and-publish: + name: Build and publish + runs-on: ubuntu-latest + permissions: + # Needed for PyPI publishing + id-token: write + # Needed for GitHub releases + contents: write + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install build + run: + python -m pip install --upgrade pip + python -m pip install build + - name: Build package + run: + python -m build + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + - name: Make release on GitHub + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + dist/*.tar.gz + dist/*.whl + generate_release_notes: true + make_latest: true diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml deleted file mode 100644 index 4f3af63435..0000000000 --- a/.github/workflows/pypi.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Build and publish to PyPI -on: - push: - branches: - - main - tags: - - 'v*' -jobs: - build-n-publish: - name: Build and publish to PyPI - runs-on: ubuntu-latest - steps: - - name: Checkout source - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: Install build - run: - pip install build - - name: Build a binary wheel and a source tarball - run: - python -m build --sdist --wheel --outdir dist/ . - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.pypi_token }} From 9074d01d78d33527fcc41dfb56b3ea67d04788d4 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 16:18:15 +0100 Subject: [PATCH 12/12] chore: add changelog 396.misc --- docs/changes/newsfragments/396.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/newsfragments/396.misc diff --git a/docs/changes/newsfragments/396.misc b/docs/changes/newsfragments/396.misc new file mode 100644 index 0000000000..8cf567ee61 --- /dev/null +++ b/docs/changes/newsfragments/396.misc @@ -0,0 +1 @@ +Update Docker image recipes and GitHub Actions workflows by `Synchon Mandal`_