forked from yamcs/quickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from EmOne/master
Review and Merge Official Master from yamcs 5.10.1
- Loading branch information
Showing
7 changed files
with
164 additions
and
28 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,28 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * 0' # Runs every Sunday at midnight | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get update && sudo apt-get install -y build-essential | ||
|
||
- name: Run make all and wait for Sent | ||
run: make wait-for-sent | ||
working-directory: ./docker | ||
|
||
- name: Archive all.txt logs | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: /quickstart/docker/all.txt |
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 |
---|---|---|
|
@@ -8,4 +8,9 @@ | |
|
||
# VSCode | ||
.vscode/settings.json | ||
/.history/ | ||
|
||
# Docker logs for CI | ||
docker/all.log | ||
|
||
# Local un-stage files | ||
/.history/ |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM maven:3.8.5-openjdk-17 | ||
FROM maven:3.9.9-eclipse-temurin-17 | ||
|
||
WORKDIR /yamcs |
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 |
---|---|---|
@@ -1,33 +1,89 @@ | ||
ifeq ($(shell which python3),) | ||
PYTHON = python | ||
else | ||
PYTHON = python3 | ||
endif | ||
SHELL := /bin/bash | ||
.ONESHELL: | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DELETE_ON_ERROR: | ||
MAKEFLAGS += --warn-undefined-variables | ||
MAKEFLAGS += --no-builtin-rules | ||
|
||
PYTHON := $(shell command -v python3 2>/dev/null || echo python) | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
all: ## run all, yamcs-up (yamcs-down) and yamcs-simulator | ||
$(MAKE) yamcs-simulator | ||
|
||
# Define function to print messages in different colors | ||
# Usage: $(call print_message,ANSI_COLOR_CODE,Your message here) | ||
define print_message | ||
@printf "\033[$(1)m$(2)\033[0m\n" | ||
endef | ||
|
||
.PHONY: all all-10hz clean yamcs-up yamcs-down yamcs-simulator yamcs-simulator-10hz yamcs-shell help | ||
|
||
all: clean yamcs-up yamcs-simulator ## run all: clean, yamcs-up (yamcs-down) and yamcs-simulator | ||
|
||
all-10hz: clean yamcs-up yamcs-simulator-10hz ## run all: clean, yamcs-up (yamcs-down) and yamcs-simulator | ||
|
||
yamcs-up: | yamcs-down ## bring up yamcs system | ||
docker compose up -d | ||
|
||
yamcs-down: ## bring down yamcs system | ||
$(call print_message,33,Stopping any running docker-yamcs containers...) | ||
docker compose down -v --remove-orphans | ||
|
||
yamcs-simulator: yamcs-up ## run yamcs simulator | ||
@echo "connect via http://localhost:8090/ system make take about 50 seconds to startup" && \ | ||
yamcs-simulator: ## run yamcs simulator | ||
$(call print_message,36,Connect via http://localhost:8090/ system may take about 50 seconds to startup) | ||
cd .. && $(PYTHON) ./simulator.py | ||
|
||
yamcs-simulator-10hz: ## run yamcs simulator at 10hz | ||
$(call print_message,36,Connect via http://localhost:8090/ system may take about 50 seconds to startup) | ||
cd .. && $(PYTHON) ./simulator.py --rate=10 | ||
|
||
yamcs-simulator-down: ## stop the yamcs simulator | ||
$(call print_message,33,Stopping the yamcs simulator...) | ||
pkill -f simulator.py | ||
$(call print_message,32,Simulator stopped successfully) | ||
|
||
yamcs-simulator-restart: yamcs-simulator-down yamcs-simulator ## stop the yamcs simulator and start it again | ||
|
||
yamcs-shell: ## shell into yamcs container | ||
docker compose up -d && docker compose exec yamcs bash | ||
|
||
help: | ||
@printf "\033[37m%-30s\033[0m %s\n" "#----------------------------------------------------------------------------------" | ||
@printf "\033[37m%-30s\033[0m %s\n" "# Makefile " | ||
@printf "\033[37m%-30s\033[0m %s\n" "#----------------------------------------------------------------------------------" | ||
@printf "\033[37m%-30s\033[0m %s\n" "#-targets----------------------description-----------------------------------------" | ||
@grep -E '^[a-zA-Z_-].+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
clean: | yamcs-down ## remove yamcs build artifacts and docker resources created by this Makefile | ||
$(call print_message,33,Cleaning up docker-yamcs resources (containers, volumes, networks)...) | ||
docker compose rm -f -s -v | ||
$(call print_message,33,Removing docker-yamcs image...) | ||
docker image rm -f docker-yamcs 2>/dev/null || true | ||
$(call print_message,33,Cleaning up yamcs build artifacts...) | ||
rm -rf ../target | ||
$(call print_message,32,Done!) | ||
|
||
wait-for-sent: | yamcs-up ## run make all and wait up to 10 minutes for "Sent:" in the output | ||
@echo "Running make all and waiting for 'Sent:' in the output..." && \ | ||
nohup $(MAKE) all > all.log 2>&1 & \ | ||
pid=$$!; \ | ||
timeout=600; \ | ||
while ! grep -q "Sent:" all.log; do \ | ||
sleep 1; \ | ||
timeout=$$((timeout - 1)); \ | ||
if [ $$timeout -le 0 ]; then \ | ||
echo "Timeout waiting for 'Sent:' in the output"; \ | ||
kill $$pid; \ | ||
exit 1; \ | ||
fi; \ | ||
done; \ | ||
echo "Found 'Sent:' in the output"; \ | ||
kill $$pid | ||
|
||
TERM_WIDTH := $(shell tput cols 2>/dev/null || echo 80) | ||
|
||
define print_header | ||
@printf '%*s\n' "$(TERM_WIDTH)" '' | tr ' ' '-' | ||
@printf '%-*s\n' "$(TERM_WIDTH)" "$(1)" | ||
@printf '%*s\n' "$(TERM_WIDTH)" '' | tr ' ' '-' | ||
endef | ||
|
||
|
||
help: ## display this help message | ||
$(call print_header,"Makefile") | ||
@awk 'BEGIN {FS = ":.*##"; printf "\033[36m%-30s\033[0m %s\n", "Target", "Description"} /^[a-zA-Z_-]+:.*?##/ {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort | ||
|
||
print-%: | ||
print-%: ## Print any variable (e.g., make print-PYTHON) | ||
@echo $* = $($*) |
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
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
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