From 0d7fb4a685805d16504cbe17271529616ca76db6 Mon Sep 17 00:00:00 2001 From: Anwai Archit Date: Sun, 22 Jun 2025 20:30:44 +0200 Subject: [PATCH 1/4] Minor update for installer release --- .github/workflows/build_installers.yaml | 2 +- deployment/env.yaml | 4 ++-- deployment/post_install.bat | 1 - deployment/version_getter.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_installers.yaml b/.github/workflows/build_installers.yaml index 699c3c489..202cee89f 100644 --- a/.github/workflows/build_installers.yaml +++ b/.github/workflows/build_installers.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: jobs: - build_intaller: + build_installer: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/deployment/env.yaml b/deployment/env.yaml index dc5d317a1..a3d12c73f 100644 --- a/deployment/env.yaml +++ b/deployment/env.yaml @@ -4,6 +4,6 @@ channels: dependencies: - napari - pyqt - - pytorch::pytorch - - pytorch::torchvision + - pytorch + - torchvision - micro_sam diff --git a/deployment/post_install.bat b/deployment/post_install.bat index 2d2fa2c69..0439e0182 100644 --- a/deployment/post_install.bat +++ b/deployment/post_install.bat @@ -4,7 +4,6 @@ rem This script searches for the 'freetype.dll' file within a specific directory rem and attempts to move it to the target directory during post-installation on Windows. rem If not found locally, it downloads the DLL from a defined URL. - rem Define download URL (replace with the actual URL for your desired version) set DOWNLOAD_URL=https://raw.githubusercontent.com/ubawurinna/freetype-windows-binaries/master/release%20dll/win64/freetype.dll diff --git a/deployment/version_getter.py b/deployment/version_getter.py index 829e05422..997a65f4c 100644 --- a/deployment/version_getter.py +++ b/deployment/version_getter.py @@ -27,4 +27,4 @@ ctor_conf["version"] = runpy.run_path(os.path.join("..", "micro_sam", "__version__.py"))["__version__"] with open(construct_file, "w") as outfile: - yaml.dump(ctor_conf, outfile) \ No newline at end of file + yaml.dump(ctor_conf, outfile) From acd07de13e24147a15dc634ca03e5b926dd9ec4b Mon Sep 17 00:00:00 2001 From: Anwai Archit Date: Sun, 22 Jun 2025 20:36:57 +0200 Subject: [PATCH 2/4] Update installer build CI file --- .github/workflows/build_installers.yaml | 86 +++++++------------------ 1 file changed, 23 insertions(+), 63 deletions(-) diff --git a/.github/workflows/build_installers.yaml b/.github/workflows/build_installers.yaml index 202cee89f..d65d7f8c2 100644 --- a/.github/workflows/build_installers.yaml +++ b/.github/workflows/build_installers.yaml @@ -7,88 +7,48 @@ jobs: build_installer: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: fail-fast: false matrix: os: [windows-latest, ubuntu-latest] # macos-latest - env: - PREPARE_SCRIPT: | - cd deployment - mamba install -y -c conda-forge constructor - mamba install -y -c conda-forge ruamel.yaml - mamba create -y -c conda-forge -n __MICROSAM_BUILD_ENV__ micro_sam natsort - conda activate base - - RUN_SCRIPT: | - python version_getter.py - mkdir ./${{ matrix.os }}_x86_64 - constructor --output-dir ./${{ matrix.os }}_x86_64 --config-filename construct_${{ matrix.os }}.yaml . - steps: - name: checkout uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - # - name: lint check - # if: matrix.os == 'ubuntu-latest' - # shell: bash -el {0} - # run: | - # bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) - # ./actionlint - - name: setup conda - if: matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' - uses: conda-incubator/setup-miniconda@v2 + - name: setup micromamba + uses: mamba-org/setup-micromamba@v1 with: - miniconda-version: "latest" - auto-activate-base: true - activate-environment: "" - channels: conda-forge - mamba-version: "*" - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - - name: build ${{ matrix.os }}_x86_64 - if: matrix.os == 'windows-latest' - shell: pwsh - run: | - ${{ env.PREPARE_SCRIPT }} - mamba activate sam - mamba install -c anaconda menuinst - python windows_menu_setup.py - conda activate base - ${{ env.RUN_SCRIPT }} + init-shell: bash + environment-name: base + create-args: >- + python=3.11 - - name: build ${{ matrix.os }}_x86_64 - if: matrix.os == 'ubuntu-latest' - shell: bash -el {0} + - name: prepare environment + shell: bash -l {0} run: | - ${{ env.PREPARE_SCRIPT }} - ${{ env.RUN_SCRIPT }} + cd deployment + micromamba install -y -c conda-forge constructor ruamel.yaml + micromamba create -y -c conda-forge -n __MICROSAM_BUILD_ENV__ micro_sam natsort + micromamba activate base - - name: build ${{ matrix.os }}_x86_64_step1 - if: matrix.os == 'macos-latest' - shell: bash -el {0} + - name: windows-specific setup + if: matrix.os == 'windows-latest' + shell: bash -l {0} run: | - brew install micromamba - /usr/local/opt/micromamba/bin/micromamba shell init -s bash -p ~/micromamba + cd deployment + micromamba install -y -c anaconda menuinst + python windows_menu_setup.py - - name: build ${{ matrix.os }}_x86_64_step2 - if: matrix.os == 'macos-latest' - shell: bash -el {0} + - name: Build installer + shell: bash -l {0} run: | cd deployment - micromamba activate base - micromamba install -y -c conda-forge python=3.10 - micromamba install -y -c conda-forge constructor - micromamba install -y -c conda-forge ruamel.yaml - micromamba install -y -c conda-forge mamba - mamba env create --file=env.yaml python version_getter.py - mkdir ./${{ matrix.os }}_x86_64 - constructor --conda-exe=$(which mamba) --output-dir ./${{ matrix.os }}_x86_64 . + mkdir -p ./${{ matrix.os }}_x86_64 + constructor --output-dir ./${{ matrix.os }}_x86_64 --config-filename construct_${{ matrix.os }}.yaml . - name: upload installer uses: actions/upload-artifact@v3 From 7aee509b5a85d5cda02e649d54bf209528c4d396 Mon Sep 17 00:00:00 2001 From: Anwai Archit Date: Sun, 22 Jun 2025 20:39:13 +0200 Subject: [PATCH 3/4] Bump upload artifact --- .github/workflows/build_installers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_installers.yaml b/.github/workflows/build_installers.yaml index d65d7f8c2..3cf731baa 100644 --- a/.github/workflows/build_installers.yaml +++ b/.github/workflows/build_installers.yaml @@ -51,7 +51,7 @@ jobs: constructor --output-dir ./${{ matrix.os }}_x86_64 --config-filename construct_${{ matrix.os }}.yaml . - name: upload installer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}_x86_64 path: ./deployment/${{ matrix.os }}_x86_64 From ac7b7dee317c618617d57d1c991cf4fa8e516ad6 Mon Sep 17 00:00:00 2001 From: Anwai Archit Date: Sun, 22 Jun 2025 20:41:44 +0200 Subject: [PATCH 4/4] Revert to old setup for working shell integration --- .github/workflows/build_installers.yaml | 86 ++++++++++++++++++------- 1 file changed, 63 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build_installers.yaml b/.github/workflows/build_installers.yaml index 3cf731baa..f2feef351 100644 --- a/.github/workflows/build_installers.yaml +++ b/.github/workflows/build_installers.yaml @@ -7,48 +7,88 @@ jobs: build_installer: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} - timeout-minutes: 60 strategy: fail-fast: false matrix: os: [windows-latest, ubuntu-latest] # macos-latest + env: + PREPARE_SCRIPT: | + cd deployment + mamba install -y -c conda-forge constructor + mamba install -y -c conda-forge ruamel.yaml + mamba create -y -c conda-forge -n __MICROSAM_BUILD_ENV__ micro_sam natsort + conda activate base + + RUN_SCRIPT: | + python version_getter.py + mkdir ./${{ matrix.os }}_x86_64 + constructor --output-dir ./${{ matrix.os }}_x86_64 --config-filename construct_${{ matrix.os }}.yaml . + steps: - name: checkout uses: actions/checkout@v4 - - - name: setup micromamba - uses: mamba-org/setup-micromamba@v1 with: - init-shell: bash - environment-name: base - create-args: >- - python=3.11 + ref: ${{ github.ref }} + # - name: lint check + # if: matrix.os == 'ubuntu-latest' + # shell: bash -el {0} + # run: | + # bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + # ./actionlint - - name: prepare environment - shell: bash -l {0} - run: | - cd deployment - micromamba install -y -c conda-forge constructor ruamel.yaml - micromamba create -y -c conda-forge -n __MICROSAM_BUILD_ENV__ micro_sam natsort - micromamba activate base + - name: setup conda + if: matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' + uses: conda-incubator/setup-miniconda@v2 + with: + miniconda-version: "latest" + auto-activate-base: true + activate-environment: "" + channels: conda-forge + mamba-version: "*" + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: windows-specific setup + - name: build ${{ matrix.os }}_x86_64 if: matrix.os == 'windows-latest' - shell: bash -l {0} + shell: pwsh run: | - cd deployment - micromamba install -y -c anaconda menuinst + ${{ env.PREPARE_SCRIPT }} + mamba activate sam + mamba install -c anaconda menuinst python windows_menu_setup.py + conda activate base + ${{ env.RUN_SCRIPT }} + + - name: build ${{ matrix.os }}_x86_64 + if: matrix.os == 'ubuntu-latest' + shell: bash -el {0} + run: | + ${{ env.PREPARE_SCRIPT }} + ${{ env.RUN_SCRIPT }} - - name: Build installer - shell: bash -l {0} + - name: build ${{ matrix.os }}_x86_64_step1 + if: matrix.os == 'macos-latest' + shell: bash -el {0} + run: | + brew install micromamba + /usr/local/opt/micromamba/bin/micromamba shell init -s bash -p ~/micromamba + + - name: build ${{ matrix.os }}_x86_64_step2 + if: matrix.os == 'macos-latest' + shell: bash -el {0} run: | cd deployment + micromamba activate base + micromamba install -y -c conda-forge python=3.10 + micromamba install -y -c conda-forge constructor + micromamba install -y -c conda-forge ruamel.yaml + micromamba install -y -c conda-forge mamba + mamba env create --file=env.yaml python version_getter.py - mkdir -p ./${{ matrix.os }}_x86_64 - constructor --output-dir ./${{ matrix.os }}_x86_64 --config-filename construct_${{ matrix.os }}.yaml . + mkdir ./${{ matrix.os }}_x86_64 + constructor --conda-exe=$(which mamba) --output-dir ./${{ matrix.os }}_x86_64 . - name: upload installer uses: actions/upload-artifact@v4