From b6ad86f0873444e6d70d0ade2f930cae75d4bed1 Mon Sep 17 00:00:00 2001 From: Selfhosting Dev Date: Wed, 17 Sep 2025 22:25:44 +0900 Subject: [PATCH] ci(llvm): add ny-llvmc object generation workflow (crate path) using hello_simple_llvm sample --- .github/workflows/llvm-ny-llvmc-obj.yml | 49 +++++++++++++++++++++++++ apps/tests/hello_simple_llvm.nyash | 7 ++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/llvm-ny-llvmc-obj.yml create mode 100644 apps/tests/hello_simple_llvm.nyash diff --git a/.github/workflows/llvm-ny-llvmc-obj.yml b/.github/workflows/llvm-ny-llvmc-obj.yml new file mode 100644 index 00000000..57a11d9f --- /dev/null +++ b/.github/workflows/llvm-ny-llvmc-obj.yml @@ -0,0 +1,49 @@ +name: llvm-ny-llvmc-obj + +on: + push: + branches: [ main, master, "**" ] + pull_request: + branches: [ "**" ] + +jobs: + ny-llvmc-obj: + runs-on: ubuntu-latest + timeout-minutes: 25 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Rust (stable) + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Install LLVM 18 and Python deps + run: | + sudo apt-get update + sudo apt-get install -y curl ca-certificates lsb-release wget gnupg python3-pip + curl -fsSL https://apt.llvm.org/llvm.sh -o llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 18 + llvm-config-18 --version + python3 -m pip install --upgrade pip + python3 -m pip install llvmlite + + - name: Build nyash (release) + run: cargo build --release -j 2 + + - name: Generate object via ny-llvmc (crate path) + env: + NYASH_LLVM_COMPILER: crate + NYASH_LLVM_ONLY_OBJ: "1" + run: | + bash tools/build_llvm.sh apps/tests/hello_simple_llvm.nyash -o app + ls -la target/aot_objects + test -f target/aot_objects/hello_simple_llvm.o + + - name: Print object file type + run: | + file target/aot_objects/hello_simple_llvm.o || true + diff --git a/apps/tests/hello_simple_llvm.nyash b/apps/tests/hello_simple_llvm.nyash new file mode 100644 index 00000000..6d0f072e --- /dev/null +++ b/apps/tests/hello_simple_llvm.nyash @@ -0,0 +1,7 @@ +static box Main { + main() { + print(42) + return 0 + } +} +