-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from computational-cell-analytics/68_installer…
…_skripts Add installer script
- Loading branch information
Showing
7 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: build_installers | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
build_intaller: | ||
name: ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
|
||
env: | ||
PREPARE_SCRIPT: | | ||
cd deployment | ||
conda install -y -c conda-forge constructor | ||
conda install -y -c conda-forge ruamel.yaml | ||
conda install -y -c conda-forge mamba | ||
mamba env create --file=env.yaml | ||
RUN_SCRIPT: | | ||
python version_getter.py | ||
mkdir ./${{ matrix.os }}_x86_64 | ||
constructor --output-dir ./${{ matrix.os }}_x86_64 . | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- 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: "" | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
|
||
- name: build ${{ matrix.os }}_x86_64 | ||
if: matrix.os == 'windows-latest' | ||
shell: pwsh | ||
run: | | ||
${{ env.PREPARE_SCRIPT }} | ||
conda activate __MICROSAM_BUILD_ENV__ | ||
conda 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 ${{ 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 ./${{ matrix.os }}_x86_64 | ||
constructor --conda-exe=$(which mamba) --output-dir ./${{ matrix.os }}_x86_64 . | ||
- name: upload installer | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.os }}_x86_64 | ||
path: ./deployment/${{ matrix.os }}_x86_64 | ||
retention-days: 5 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: micro_sam | ||
version: 0.1.0 | ||
license_file: ../LICENSE | ||
installer_type: pkg #[osx] # This will trigger pkg build on Mac Os. On windows and linux, native build will be done and this has no effect. | ||
environment: __MICROSAM_BUILD_ENV__ | ||
welcome_image: ../doc/images/micro-sam-logo.png | ||
header_image: ../doc/images/micro-sam-logo.png | ||
icon_image: ../doc/images/micro-sam-logo.png | ||
channels: | ||
- conda-forge | ||
welcome_text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. | ||
conclusion_text: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris | ||
nisi ut aliquip ex ea commodo consequat. | ||
initialize_by_default: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: __MICROSAM_BUILD_ENV__ | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- napari | ||
- pyqt | ||
- pytorch::pytorch | ||
- pytorch::torchvision | ||
- micro_sam |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import runpy | ||
import ruamel.yaml | ||
import os | ||
|
||
yaml = ruamel.yaml.YAML() | ||
yaml.preserve_quotes = True | ||
ctor_fname = os.path.join("construct.yaml") | ||
|
||
with open(ctor_fname, 'r') as stream: | ||
ctor_conf = yaml.load(stream) | ||
|
||
ctor_conf["version"] = runpy.run_path(os.path.join("..", "micro_sam", "__version__.py"))["__version__"] | ||
|
||
with open(ctor_fname, 'w') as outfile: | ||
yaml.dump(ctor_conf, outfile) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"menu_name": "micro_sam", | ||
"menu_items": | ||
[ | ||
{ | ||
"script": "${PREFIX}/Scripts/micro_sam.annotator.exe", | ||
"name": "micro_sam", | ||
"icon": "${PREFIX}/Menu/micro-sam-logo.ico", | ||
"workdir": "${PREFIX}", | ||
"desktop": true, | ||
"quicklaunch": true | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import menuinst | ||
import shutil | ||
import os | ||
|
||
conda_dir = os.environ["CONDA_PREFIX"] | ||
menu_dir = os.path.join(conda_dir, "Menu") | ||
os.makedirs(menu_dir, exist_ok = True) | ||
shutil.copy("../doc/images/micro-sam-logo.ico", menu_dir) | ||
shutil.copy("./windows_menu.json", menu_dir) | ||
menuinst.install(os.path.join(menu_dir, 'windows_menu.json'), prefix=conda_dir) |
Binary file not shown.