Skip to content

Commit

Permalink
feat(app-shell-odd): create node layer for ODD (#11852)
Browse files Browse the repository at this point in the history
  • Loading branch information
shlokamin authored Jan 3, 2023
1 parent 9401c52 commit 9422935
Show file tree
Hide file tree
Showing 61 changed files with 4,097 additions and 84 deletions.
20 changes: 2 additions & 18 deletions .github/workflows/app-test-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
# to run cross-platform just like builds, might as well do them in the same job
strategy:
matrix:
os: ['windows-2022', 'ubuntu-22.04', 'macos-11']
os: ['windows-2019', 'ubuntu-22.04', 'macos-11']
name: 'opentrons app backend unit tests and build'
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -124,17 +124,8 @@ jobs:
script: |
const { buildComplexEnvVars } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- name: 'cache yarn cache'
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.npm-cache/_prebuild
${{ github.workspace }}/.yarn-cache
key: js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: setup-js
run: |
npm config set cache ${{ github.workspace }}/.npm-cache
yarn config set cache-folder ${{ github.workspace }}/.yarn-cache
make setup-js
- name: 'test native(er) packages'
run: |
Expand Down Expand Up @@ -177,7 +168,7 @@ jobs:
build-app-ot3:
strategy:
matrix:
os: ['windows-2022', 'ubuntu-22.04', 'macos-latest']
os: ['windows-2019', 'ubuntu-22.04', 'macos-latest']
name: 'opentrons app backend unit tests and build for OT3'
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -204,13 +195,6 @@ jobs:
script: |
const { buildComplexEnvVars } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- name: 'cache yarn cache'
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.npm-cache/_prebuild
${{ github.workspace }}/.yarn-cache
key: js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: setup-js
run: |
npm config set cache ${{ github.workspace }}/.npm-cache
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include ./scripts/python.mk

API_DIR := api
APP_SHELL_DIR := app-shell
APP_SHELL_ODD_DIR := app-shell-odd
COMPONENTS_DIR := components
DISCOVERY_CLIENT_DIR := discovery-client
G_CODE_TESTING_DIR := g-code-testing
Expand Down Expand Up @@ -52,6 +53,7 @@ setup-js:
yarn config set network-timeout 60000
yarn
$(MAKE) -C $(APP_SHELL_DIR) setup
$(MAKE) -C $(APP_SHELL_ODD_DIR) setup
$(MAKE) -C $(SHARED_DATA_DIR) setup-js

PYTHON_SETUP_TARGETS := $(addsuffix -py-setup, $(PYTHON_DIRS))
Expand Down Expand Up @@ -148,6 +150,7 @@ push-ot3:
$(MAKE) -C $(NOTIFY_SERVER_DIR) push-no-restart-ot3
$(MAKE) -C $(ROBOT_SERVER_DIR) push-ot3
$(MAKE) -C $(UPDATE_SERVER_DIR) push-ot3
$(MAKE) -C $(APP_SHELL_ODD_DIR) push-ot3


.PHONY: term
Expand Down
2 changes: 2 additions & 0 deletions app-shell-odd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# lib is compiled by babel
lib
83 changes: 83 additions & 0 deletions app-shell-odd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# opentrons app desktop shell makefile

include ../scripts/push.mk

# using bash instead of /bin/bash in SHELL prevents macOS optimizing away our PATH update
SHELL := bash

# add node_modules/.bin to PATH
PATH := $(shell cd .. && yarn bin):$(PATH)

# dev server port
PORT ?= 8090

# dep directories for production build
# TODO(mc, 2018-08-07): figure out a better way to do this
ui_dir := ../app

# cross-platform noop command
noop := cd .

# Other SSH args for robots
ssh_opts ?= $(default_ssh_opts)

builder := yarn electron-builder \
--config electron-builder.config.js \
--publish never

electron := yarn electron . \
--devtools \
--log.level.console="debug" \
--disable_ui.webPreferences.webSecurity \
--ui.url.protocol="http:" \
--ui.url.path="localhost:$(PORT)" \

# standard targets
#####################################################################

.PHONY: all
all: package

.PHONY: setup
# must be wrapped in yarn run otherwise `prebuild-install` will fail silently
# due to how `electron-rebuild` calls `prebuild-install`
setup:
yarn rebuild

.PHONY: clean
clean:
shx rm -rf lib dist

# artifacts
#####################################################################

.PHONY: lib
lib: export NODE_ENV := production
lib:
OPENTRONS_PROJECT=ot3 webpack --profile

.PHONY: deps
deps:
$(MAKE) -C $(ui_dir) OPENTRONS_PROJECT=ot3

.PHONY: package-deps
package-deps: clean lib deps

.PHONY: dist-ot3
dist-ot3: package-deps
NO_USB_DETECTION=true OT_APP_DEPLOY_BUCKET=opentrons-app OT_APP_DEPLOY_FOLDER=builds OPENTRONS_PROJECT=ot3 $(builder) --linux --arm64

.PHONY: push-ot3
push-ot3: dist-ot3
ssh $(ssh_opts) root@$(host) "mount -o remount,rw / && systemctl stop opentrons-robot-app && rm -rf /opt/opentrons-app && mkdir -p /opt/opentrons-app"
scp -r $(ssh_opts) ./dist/linux-arm64-unpacked/* root@$(host):/opt/opentrons-app
ssh $(ssh_opts) root@$(host) "systemctl start opentrons-robot-app && mount -o remount,ro /"

# development
#####################################################################

.PHONY: dev
dev: export NODE_ENV := development
dev:
webpack
$(electron)
Loading

0 comments on commit 9422935

Please sign in to comment.