Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub workflow to test with Micro-Manager #2

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1a32929
draft workflow to install micro-manager
ziw-liu Nov 18, 2022
c2592ae
test workflow level in pr
ziw-liu Nov 18, 2022
b073d7f
fix yaml syntax
ziw-liu Nov 18, 2022
f95007d
fix indentation
ziw-liu Nov 18, 2022
f2296c0
fix indentation
ziw-liu Nov 18, 2022
bfc227b
fix string formating
ziw-liu Nov 18, 2022
938aeef
debug wget
ziw-liu Nov 18, 2022
997f777
debug wget
ziw-liu Nov 18, 2022
c22a17b
use curl to download
ziw-liu Nov 18, 2022
4824781
debug cache path
ziw-liu Nov 18, 2022
c63c831
debug cache path
ziw-liu Nov 18, 2022
98e126c
fix string formating
ziw-liu Nov 18, 2022
41a8fa8
debug git bash
ziw-liu Nov 18, 2022
b0b5500
try default commandline for installing
ziw-liu Nov 19, 2022
f0625d5
use wget to download
ziw-liu Nov 23, 2022
7c74fc8
download with aria2
ziw-liu Nov 23, 2022
aff4e90
fix string
ziw-liu Nov 23, 2022
087d4a2
format uri string
ziw-liu Nov 23, 2022
f4e71be
wait until MM is installed
ziw-liu Nov 23, 2022
01c4706
pipe mm install log to file
ziw-liu Nov 23, 2022
bb3aaee
fix log file name
ziw-liu Nov 23, 2022
2cd16d5
fix log file name
ziw-liu Nov 23, 2022
cfcaa60
draft test case with MM
ziw-liu Nov 23, 2022
e174770
enable zmq before testing
ziw-liu Nov 23, 2022
f2fe896
fix file path
ziw-liu Nov 23, 2022
a9e6584
fix typo
ziw-liu Nov 23, 2022
a30f213
mark upstream issue with "ZQM" typo
ziw-liu Nov 23, 2022
ae773fd
fix file io call
ziw-liu Nov 23, 2022
a9505c2
debug appdata paths
ziw-liu Nov 23, 2022
8adcafa
fix typo
ziw-liu Nov 23, 2022
7b843e8
debug headless test
ziw-liu Nov 24, 2022
8b64770
debug start_headless
ziw-liu Nov 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/test_with_mm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow only works on a Windows instance
# Installs Micro-Manager and tests pycromanager against it
# Triggered when a PR is closed and merged into main

name: Test with MM

on: [pull_request]
# pull_request:
# branches: [ main ]
# types:
# - closed

env:
MM_NIGHTLY_BUILD: 2.0.1_20221121

jobs:
test_with_mm:
# if: github.event.pull_request.merged == true

runs-on: windows-latest

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']

steps:
- name: Cache MM
id: cache-mm
uses: actions/cache@v3
with:
path: mmsetup.exe
key: ${{ runner.os }}-mm-${MM_NIGHTLY_BUILD}

- name: Download MM
if: steps.cache-mm.outputs.cache-hit != 'true'
run: |
$mmuri = "https://download.micro-manager.org/nightly/2.0/Windows/MMSetup_64bit_$Env:MM_NIGHTLY_BUILD.exe"
aria2c -o mmsetup.exe $mmuri

- name: Install MM
run: |
ls .\mmsetup.exe
$innoSetupArgs = "/SP /VERYSILENT /SUPRESSMSGBOXES /CURRENTUSER /LOG=mmsetup.log"
Start-Process .\mmsetup.exe -ArgumentList $innoSetupArgs -Wait
cat .\mmsetup.log

- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install PM
run: |
pip install wheel
pip install ".[test]"

- name: Test
run: pytest
21 changes: 21 additions & 0 deletions pycromanager/test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pytest import fixture
import os
import glob
import json


# @fixture(scope="session")
# def enable_zmq():
# # FIXME: this enviroment variable only works on Windows
# profile_path = os.path.expandvars(r"%LOCALAPPDATA%\Micro-Manager\UserProfiles")
# print(os.listdir(profile_path))
# profile_file = glob.glob(os.path.join(profile_path, "Default_*.json"))[0]
# with open(profile_file, "r") as f:
# profile = json.load(f)
# profile["map"]["Preferences"]["scalar"]["org.micromanager.internal.MMStudio"][
# "scalar"
# ]["run ZQM server"][
# "scalar"
# ] = True # TODO: "ZQM" is an upstream typo https://github.com/micro-manager/micro-manager/issues/1574
# with open(profile_file, "w") as f:
# json.dump(profile, f)
10 changes: 10 additions & 0 deletions pycromanager/test/test_acq_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os

# tested code
from pycromanager import start_headless


def test_start_headless():
mm_app_path = r"C:\Program Files\Micro-Manager-2.0"
config_file = os.path.join(mm_app_path, "MMConfig_demo.cfg")
start_headless(mm_app_path, config_file, timeout=10000)