Skip to content

Commit

Permalink
Add makefile and build currentbranch npm scripting (#482)
Browse files Browse the repository at this point in the history
* Add makefile and build currentbranch

* address comments

* address comments
  • Loading branch information
unlikelyzero authored Sep 25, 2024
1 parent 92b0ee5 commit c300270
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ test-results
# Misc
.DS_Store
.vscode/settings.json

quickstart/
62 changes: 62 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.PHONY: all clone-quickstart install-quickstart start-quickstart install-openmct-yamcs sanity-test build-example test-getopensource test-e2e clean

test-all: clone-quickstart install-quickstart install-openmct-yamcs sanity-test build-example test-e2e

start-all: clone-quickstart install-quickstart install-openmct-yamcs sanity-test build-example start-openmct

clone-quickstart:
@echo "Running target: clone-quickstart"
@echo "Current working directory: $(shell pwd)"
if [ ! -d "quickstart" ]; then \
git clone https://github.com/yamcs/quickstart; \
else \
echo "Directory 'quickstart' already exists."; \
fi

install-quickstart:
@echo "Running target: install-quickstart"
@cd quickstart/docker && $(MAKE) wait-for-sent

start-quickstart:
@echo "Running target: start-quickstart"
@cd quickstart/docker && $(MAKE) all

reset-quickstart:
@echo "Running target: reset-quickstart"
@cd quickstart/docker && $(MAKE) yamcs-simulator-restart

install-openmct-yamcs:
@echo "Running target: install-openmct-yamcs"
npm install

sanity-test:
@echo "Running target: sanity-test"
npm run wait-for-yamcs

build-example: #This will run buid example based on the current branch of openmct-yamcs and fallback to master
@echo "Running target: build-example"
@current_branch=$(shell git rev-parse --abbrev-ref HEAD)
@echo "Current branch of openmct-yamcs: $$current_branch checking if it exists in openmct repository"
@if git ls-remote --exit-code --heads https://github.com/nasa/openmct.git refs/heads/$$current_branch; then \
echo "Branch $$current_branch exists in openmct repository. Running build:example:currentbranch"; \
npm run build:example:currentbranch || { echo "Failed to run build:example:currentbranch"; exit 1; }; \
else \
echo "Branch $$current_branch does not exist in openmct repository. Running build:example:master"; \
npm run build:example:master || { echo "Failed to run build:example:master"; exit 1; }; \
fi

start-openmct:
@echo "Running target: start-openmct"
npm start

test-e2e:
@echo "Running target: test-e2e"
npm run test:getopensource
npm run test:e2e:quickstart:local

clean:
@echo "Running target: clean"
npm run clean
echo "Ran npm run clean."
rm -rf quickstart
echo "Removed 'quickstart' directory."
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"build:dist": "webpack --config ./.webpack/webpack.prod.mjs",
"build:example": "npm install openmct@unstable --no-save",
"build:example:master": "npm install nasa/openmct --no-save",
"build:example:currentbranch": "npm install nasa/openmct#$(git rev-parse --abbrev-ref HEAD) --no-save --verbose",
"postbuild:example": "node check-optional-dependencies.mjs",
"start": "npx webpack serve --config ./.webpack/webpack.dev.mjs",
"start:coverage": "npx webpack serve --config ./.webpack/webpack.coverage.mjs",
Expand Down

0 comments on commit c300270

Please sign in to comment.