From 54f13a3773ff9610e04efd581f732f0304b0fc38 Mon Sep 17 00:00:00 2001 From: Darvis Date: Sun, 8 Mar 2026 23:46:22 +0530 Subject: [PATCH 1/5] Update main.yml and Makefile * Update main.yml Updated existing outdated workflow with a robust workflow that needs no separate manual upload package steps for each package * Update Makefile Updated Makefile to now have parallel builds rather than sequential builds --- .github/workflows/main.yml | 247 ++++++------------------------------- Makefile | 25 ++-- 2 files changed, 48 insertions(+), 224 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85f8c1e..43a0880 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,23 +7,19 @@ on: branches: [ main ] jobs: - update-packages: runs-on: macos-latest - strategy: - fail-fast: true steps: - - uses: actions/checkout@v3 - - - name: prepare - run: | - brew install ruby + - &checkout + uses: actions/checkout@v4 + + - name: Prepare + run: brew install ruby - - name: package - run: | - ruby package.rb + - name: Package + run: ruby package.rb - - name: upload artifacts + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: packages @@ -33,218 +29,47 @@ jobs: runs-on: ubuntu-latest needs: [update-packages] if: github.ref == 'refs/heads/main' + steps: - - uses: actions/checkout@v3 - - name: delete tag + - *checkout + + - name: Download packages + uses: actions/download-artifact@v4 + with: + name: packages + path: packages + + - name: Delete previous tag continue-on-error: true - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | - github.rest.git.deleteRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'tags/latest', - sha: context.sha - }) - - name: create tag - uses: actions/github-script@v6 + try { + await github.rest.git.deleteRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'tags/latest' + }) + } catch (e) { + core.info("Tag not available") + } + + - name: Create latest tag + uses: actions/github-script@v7 with: script: | - github.rest.git.createRef({ + await github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'refs/tags/latest', sha: context.sha }) - - uses: actions/download-artifact@v4 - - - id: create_release - uses: actions/create-release@v1 + - name: Create release and upload packages + uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: latest - release_name: Latest - draft: false - prerelease: false - - - name: upload raylib - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/raylib.c3l - asset_name: raylib.c3l - asset_content_type: application/zip - - - name: upload raylib5 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/raylib5.c3l - asset_name: raylib5.c3l - asset_content_type: application/zip - - - name: upload raylib5.5 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/raylib55.c3l - asset_name: raylib55.c3l - asset_content_type: application/zip - - - name: upload raygui - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/raygui.c3l - asset_name: raygui.c3l - asset_content_type: application/zip - - - name: upload box2d - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/box2d.c3l - asset_name: box2d.c3l - asset_content_type: application/zip - - - name: upload sdl2 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/sdl2.c3l - asset_name: sdl2.c3l - asset_content_type: application/zip - - - name: upload tigr - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/tigr.c3l - asset_name: tigr.c3l - asset_content_type: application/zip - - - name: upload opengl - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/opengl.c3l - asset_name: opengl.c3l - asset_content_type: application/zip - - - name: upload vulkan - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/vulkan.c3l - asset_name: vulkan.c3l - asset_content_type: application/zip - - - name: upload tree_sitter - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/tree_sitter.c3l - asset_name: tree_sitter.c3l - asset_content_type: application/zip - - - name: upload curl - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/curl.c3l - asset_name: curl.c3l - asset_content_type: application/zip - - - name: upload clang - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/clang.c3l - asset_name: clang.c3l - asset_content_type: application/zip - - - name: upload glfw - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/glfw.c3l - asset_name: glfw.c3l - asset_content_type: application/zip - - - name: upload glfw3.4 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/glfw34.c3l - asset_name: glfw34.c3l - asset_content_type: application/zip - - - name: upload pq - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/pq.c3l - asset_name: pq.c3l - asset_content_type: application/zip - - - name: upload mysql8 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/mysql8.c3l - asset_name: mysql8.c3l - asset_content_type: application/zip - - - name: upload sqlite3 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/sqlite3.c3l - asset_name: sqlite3.c3l - asset_content_type: application/zip - - - name: upload ktx - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: packages/ktx.c3l - asset_name: ktx.c3l - asset_content_type: application/zip + name: Latest + files: packages/*.c3l diff --git a/Makefile b/Makefile index 281be92..db32aa8 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,23 @@ LIBDIR := ./libraries C3C := c3c TARGET ?= +TARGET_ARG := $(if $(TARGET),--target $(TARGET),) + LIB_FOLDERS := $(wildcard $(LIBDIR)/*.c3l) LIBS := $(patsubst %.c3l,%,$(notdir $(LIB_FOLDERS))) -TARGET_ARG := $(if $(TARGET),--target $(TARGET),) -.PHONY: all list compile +.PHONY: all list $(LIBS) -all: compile +all: $(LIBS) list: @printf '%s\n' $(LIBS) -compile: - @for libname in $(LIBS); do \ - files=$$(find "$(LIBDIR)/$$libname.c3l" -maxdepth 2 -type f \( -name '*.c3' -o -name '*.c3i' \)); \ - if [ -z "$$files" ]; then \ - echo "Skipping $$libname (no .c3/.c3i files found)"; \ - continue; \ - fi; \ - echo "Compiling $$libname"; \ - $(C3C) -C compile $(TARGET_ARG) --libdir "$(LIBDIR)" --lib "$$libname" $$files; \ - done +$(LIBS): + @files=$$(find "$(LIBDIR)/$@.c3l" -type f \( -name '*.c3' -o -name '*.c3i' \) | sort); \ + if [ -z "$$files" ]; then \ + echo "Skipping $@ (no .c3/.c3i files found)"; \ + exit 0; \ + fi; \ + echo "Compiling $@"; \ + $(C3C) -C compile $(TARGET_ARG) --libdir "$(LIBDIR)" --lib "$@" $$files || exit 1 From ce307cf39180e34a6a22e5dd2fa5dcbdf3878c16 Mon Sep 17 00:00:00 2001 From: Darvis Date: Mon, 9 Mar 2026 13:52:56 +0530 Subject: [PATCH 2/5] Add overwrite_files Added overwrite_files which will overwrite old content within file with new content added in it. --- .github/workflows/main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43a0880..ae7d733 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,8 +10,7 @@ jobs: update-packages: runs-on: macos-latest steps: - - &checkout - uses: actions/checkout@v4 + - uses: &checkout actions/checkout@v4 - name: Prepare run: brew install ruby @@ -24,6 +23,7 @@ jobs: with: name: packages path: temp/*.c3l + if-no-files-found: error release: runs-on: ubuntu-latest @@ -31,7 +31,7 @@ jobs: if: github.ref == 'refs/heads/main' steps: - - *checkout + - uses: *checkout - name: Download packages uses: actions/download-artifact@v4 @@ -73,3 +73,4 @@ jobs: tag_name: latest name: Latest files: packages/*.c3l + overwrite_files: true From dd37e27b637e59d87f2ea11ffb7cf774bcd4dc0c Mon Sep 17 00:00:00 2001 From: Darvis Date: Mon, 9 Mar 2026 17:31:00 +0530 Subject: [PATCH 3/5] Update Makefile Updated Makefile to now support compiling one or more libraries if the user wishes to only compile select libraries from the given list of libraries. --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index db32aa8..3a87ba0 100644 --- a/Makefile +++ b/Makefile @@ -6,18 +6,22 @@ TARGET_ARG := $(if $(TARGET),--target $(TARGET),) LIB_FOLDERS := $(wildcard $(LIBDIR)/*.c3l) LIBS := $(patsubst %.c3l,%,$(notdir $(LIB_FOLDERS))) -.PHONY: all list $(LIBS) +.PHONY: all list all: $(LIBS) list: @printf '%s\n' $(LIBS) -$(LIBS): - @files=$$(find "$(LIBDIR)/$@.c3l" -type f \( -name '*.c3' -o -name '*.c3i' \) | sort); \ +%: + @if [ ! -d "$(LIBDIR)/$@.c3l" ]; then \ + echo "Unknown library: $@"; \ + exit 1; \ + fi; \ + files=$$(find "$(LIBDIR)/$@.c3l" -type f \( -name '*.c3' -o -name '*.c3i' \) | sort); \ if [ -z "$$files" ]; then \ echo "Skipping $@ (no .c3/.c3i files found)"; \ exit 0; \ fi; \ echo "Compiling $@"; \ - $(C3C) -C compile $(TARGET_ARG) --libdir "$(LIBDIR)" --lib "$@" $$files || exit 1 + $(C3C) -C compile $(TARGET_ARG) --libdir "$(LIBDIR)" --lib "$@" $$files From 583aca54132e021086aa0ac2e505681d63617844 Mon Sep 17 00:00:00 2001 From: Darvis Date: Mon, 9 Mar 2026 17:53:51 +0530 Subject: [PATCH 4/5] Minor change to Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3a87ba0..4e13546 100644 --- a/Makefile +++ b/Makefile @@ -24,4 +24,4 @@ list: exit 0; \ fi; \ echo "Compiling $@"; \ - $(C3C) -C compile $(TARGET_ARG) --libdir "$(LIBDIR)" --lib "$@" $$files + $(C3C) -C compile $(TARGET_ARG) --libdir "$(LIBDIR)" --lib "$@" $$files || exit 1 From 8ef3de4131bc949bb40fbcefe75f0278bf116f78 Mon Sep 17 00:00:00 2001 From: Darvis Date: Mon, 9 Mar 2026 18:43:00 +0530 Subject: [PATCH 5/5] Add clean In case a user wants to cleanup files that were built with make, they can do so with `make clean` --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4e13546..067bb3e 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,23 @@ LIBDIR := ./libraries C3C := c3c TARGET ?= -TARGET_ARG := $(if $(TARGET),--target $(TARGET),) +TARGET_ARG := $(if $(TARGET),--target $(TARGET)) LIB_FOLDERS := $(wildcard $(LIBDIR)/*.c3l) LIBS := $(patsubst %.c3l,%,$(notdir $(LIB_FOLDERS))) -.PHONY: all list +.PHONY: all list clean all: $(LIBS) list: @printf '%s\n' $(LIBS) +clean: + @echo "Cleaning built libraries" + @rm -f $(addsuffix .c3l,$(LIBS)) + %: - @if [ ! -d "$(LIBDIR)/$@.c3l" ]; then \ - echo "Unknown library: $@"; \ - exit 1; \ - fi; \ files=$$(find "$(LIBDIR)/$@.c3l" -type f \( -name '*.c3' -o -name '*.c3i' \) | sort); \ if [ -z "$$files" ]; then \ echo "Skipping $@ (no .c3/.c3i files found)"; \