diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8579f46..5f893449 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,35 @@ jobs: with: name: prosperon-artifacts-linux path: build/prosperon + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Registry + uses: docker/login-action@v3 + with: + registry: gitea.pockle.world + username: ${{ secrets.USER_GITEA }} + password: ${{ secrets.TOKEN_GITEA }} + + - name: Determine Docker Tag + id: docker_tag + run: | + if [[ "${{ github.ref }}" =~ ^refs/tags/v.* ]]; then + TAG=$(echo "${{ github.ref }}" | sed 's#refs/tags/##') + echo "tag=$TAG" >> $GITHUB_OUTPUT + else + echo "tag=latest" >> $GITHUB_OUTPUT + fi + + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: gitea.pockle.world/john/prosperon:${{ steps.docker_tag.outputs.tag }} + platforms: linux/amd64 # ────────────────────────────────────────────────────────────── # WINDOWS BUILD (MSYS2 / CLANG64) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..80b1d8de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +# Builder stage +FROM ubuntu:plucky AS builder + +RUN apt-get update && apt-get install -y --no-install-recommends \ + python3 python3-pip \ + libasound2-dev \ + libpulse-dev \ + libudev-dev \ + libwayland-dev \ + wayland-protocols \ + libxkbcommon-dev \ + libx11-dev \ + libxext-dev \ + libxrandr-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxss-dev \ + libegl1-mesa-dev \ + libgl1-mesa-dev \ + cmake \ + ninja-build \ + git \ + build-essential \ + binutils \ + pkg-config \ + meson \ + zip && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /app +RUN git clone https://gitea.pockle.world/john/prosperon.git +WORKDIR /app/prosperon +RUN git checkout jsffi_refactor +RUN meson setup build -Dbuildtype=release -Db_lto=true -Db_lto_mode=thin -Db_ndebug=true +RUN meson compile -C build + +# Runtime stage +FROM ubuntu:latest + +# Install minimal runtime dependencies (e.g., for dynamically linked libraries) +RUN apt-get update && apt-get install -y libstdc++6 && rm -rf /var/lib/apt/lists/* + +# Copy the compiled prosperon binary from the build stage +COPY --from=builder /app/prosperon/build/prosperon /usr/local/bin/prosperon + +# Create an entrypoint script +RUN echo '#!/bin/bash' > /entrypoint.sh && \ + echo '/usr/local/bin/prosperon "$@" &' >> /entrypoint.sh && \ + echo 'tail -f /dev/null' >> /entrypoint.sh && \ + chmod +x /entrypoint.sh + +WORKDIR /workdir +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/source/prosperon.c b/source/prosperon.c index 22ec5a71..8e25bd38 100644 --- a/source/prosperon.c +++ b/source/prosperon.c @@ -506,6 +506,7 @@ void actor_free(prosperon_rt *actor) /* Timer callback adds an event to the queue under evt_mutex. */ Uint32 actor_timer_cb(prosperon_rt *actor, SDL_TimerID id, Uint32 interval) { + printf("firing timer %u\n", id); SDL_LockMutex(actor->msg_mutex); int idx = hmgeti(actor->timers, id); if (idx == -1) goto END; @@ -539,6 +540,8 @@ JSValue js_actor_delay(JSContext *js, JSValue self, int argc, JSValue *argv) Uint64 ns = seconds * SDL_NS_PER_SECOND; Uint32 id = SDL_AddTimerNS(ns, actor_timer_cb, actor); + + printf("started timer %u for %g secs\n", id, seconds); SDL_LockMutex(actor->msg_mutex); JSValue cb = JS_DupValue(js, argv[0]); @@ -1340,7 +1343,7 @@ int main(int argc, char **argv) } } - SDL_Init(SDL_INIT_EVENTS | SDL_INIT_VIDEO | SDL_INIT_AUDIO); + SDL_Init(SDL_INIT_EVENTS);// | SDL_INIT_VIDEO | SDL_INIT_AUDIO); queue_event = SDL_RegisterEvents(1); int cores = SDL_GetNumLogicalCPUCores();