From d0736c5568a72f0f157b7c43806a277ba16efd19 Mon Sep 17 00:00:00 2001 From: aswin Date: Wed, 25 Dec 2024 18:04:29 +0530 Subject: [PATCH] github workflow to auto update bootstrap files on push to main --- .github/workflows/ci.yml | 2 ++ .github/workflows/update_bootstrap.yml | 35 ++++++++++++++++++++++++++ Makefile | 2 +- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update_bootstrap.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8624c48..8821e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,3 +23,5 @@ jobs: make self make self time make self + update_bootstrap: + uses: ./.github/workflows/update_bootstrap.yml diff --git a/.github/workflows/update_bootstrap.yml b/.github/workflows/update_bootstrap.yml new file mode 100644 index 0000000..f500b08 --- /dev/null +++ b/.github/workflows/update_bootstrap.yml @@ -0,0 +1,35 @@ +name: Update Bootstrap Files + +on: + workflow_call: + +jobs: + update-files: + strategy: + matrix: + os: ["ubuntu-latest"] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Regenerate bootstrap files + run: make update_bootstrap + + - name: Commit and push changes + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Pushing changes." + git add . + git commit -m "Auto-update bootstrap files" + git push + else + echo "No changes detected." + exit 0 + fi diff --git a/Makefile b/Makefile index 2b2444c..c2260eb 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ self: ld -o ibuc src/tokenizer.o src/parser.o src/codegen.o src/preprocessor.o src/ibu.o lib/std.o lib/runtime.o lib/linux-syscall.o .PHONY: update_bootstrap -update_bootstrap: +update_bootstrap: init ./ibuc src/ibu.ibu > bootstrap/ibu.s ./ibuc src/tokenizer/tokenizer.ibu > bootstrap/tokenizer.s ./ibuc src/parser/parser.ibu > bootstrap/parser.s