Skip to content

Commit

Permalink
Copy tooling changes from hello-world-startos
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpp committed Dec 24, 2024
1 parent 8539fed commit 166100e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 29 deletions.
1 change: 1 addition & 0 deletions .github/workflows/buildService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
make
PACKAGE_ID=$(yq -oy ".id" manifest.*)
echo "package_id=$PACKAGE_ID" >> $GITHUB_ENV
printf "\n SHA256SUM: $(sha256sum ${PACKAGE_ID}.s9pk) \n"
shell: bash

- name: Upload .s9pk
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/releaseService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- name: Generate sha256 checksum
run: |
PACKAGE_ID=${{ env.package_id }}
printf "\n SHA256SUM: $(sha256sum ${PACKAGE_ID}.s9pk) \n"
sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256
shell: bash

Expand Down
37 changes: 15 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,62 +1,55 @@
PKG_ID := $(shell yq e ".id" manifest.yaml)
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
PKG_ID := $(shell yq e ".id" < manifest.yaml)
PKG_VERSION := $(shell yq e ".version" < manifest.yaml)
TS_FILES := $(shell find ./ -name \*.ts)

# delete the target of a rule if it has changed and its recipe exits with a nonzero exit status
.DELETE_ON_ERROR:

all: submodule-update verify
all: verify

verify: $(PKG_ID).s9pk
@start-sdk verify s9pk $(PKG_ID).s9pk
@echo " Done!"
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"

install:
ifeq (,$(wildcard ~/.embassy/config.yaml))
@echo; echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first"; echo
else
start-cli package install $(PKG_ID).s9pk
endif
@if [ ! -f ~/.embassy/config.yaml ]; then echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first."; exit 1; fi
@echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n"
@[ -f $(PKG_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n" )
@start-cli package install $(PKG_ID).s9pk

clean:
rm -rf docker-images
rm -f $(PKG_ID).s9pk
rm -f scripts/*.js

submodule-update:
@if [ -z "$(shell git submodule status | egrep -v '^ '|awk '{print $$2}')" ]; then \
echo "Submodules are up to date."; \
else \
echo "\nUpdating submodules...\n"; \
git submodule update --init --progress; \
fi
clean-manifest:
@sed -i '' '/^[[:blank:]]*#/d' manifest.yaml
@echo; echo "Comments successfully removed from manifest.yaml file."; echo

scripts/embassy.js: $(TS_FILES)
deno bundle scripts/embassy.ts scripts/embassy.js
deno run --allow-read --allow-write --allow-env --allow-net scripts/bundle.ts

# for rebuilding just the arm image. will include docker-images/x86_64.tar into the s9pk if it exists
arm:
@rm -f docker-images/x86_64.tar
ARCH=aarch64 $(MAKE)

# for rebuilding just the x86 image. will include docker-images/aarch64.tar into the s9pk if it exists
x86:
@rm -f docker-images/aarch64.tar
ARCH=x86_64 $(MAKE)

docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh
docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/amd64 --build-arg PLATFORM=amd64 -o type=docker,dest=docker-images/x86_64.tar .
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=aarch64 --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
endif

docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh
docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/arm64 --build-arg PLATFORM=arm64 -o type=docker,dest=docker-images/aarch64.tar .
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=x86_64 --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
endif

$(PKG_ID).s9pk: manifest.yaml instructions.md LICENSE helipad.png scripts/embassy.js docker-images/aarch64.tar docker-images/x86_64.tar
Expand Down
4 changes: 2 additions & 2 deletions scripts/embassy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { getConfig } from "./procedures/getConfig.ts";
export { setConfig } from "./procedures/setConfig.ts";
export { getConfig } from "./procedures/getConfig.ts";
export { properties } from "./procedures/properties.ts";
export { health } from "./procedures/healthChecks.ts";
export { migration } from "./procedures/migrations.ts";
export { health } from "./procedures/healthChecks.ts";
6 changes: 4 additions & 2 deletions scripts/procedures/healthChecks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { types as T, healthUtil } from "../deps.ts";

export const health: T.ExpectedExports.health = {
"web-ui": healthUtil.checkWebUrl("http://helipad.embassy:2112")
}
async "web-ui"(effects, duration) {
return healthUtil.checkWebUrl("http://helipad.embassy:2112")(effects, duration).catch(healthUtil.catchError(effects))
},
};
5 changes: 2 additions & 3 deletions scripts/procedures/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { compat, types as T } from "../deps.ts";

export const migration: T.ExpectedExports.migration =
compat.migrations.fromMapping({}, "0.2.1");

export const migration: T.ExpectedExports.migration = compat.migrations
.fromMapping({}, "0.2.1" );
2 changes: 2 additions & 0 deletions scripts/procedures/setConfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This is where any configuration rules related to the configuration would go. These ensure that the user can only create a valid config.

import { compat, } from "../deps.ts";

export const setConfig = compat.setConfig;

0 comments on commit 166100e

Please sign in to comment.