Skip to content
Merged

Test #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 29 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
build-test:
name: Build & Test (${{ matrix.os }} - ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}

strategy:
fail-fast: false
matrix:
Expand All @@ -21,14 +22,16 @@ jobs:
- os: macos
arch: arm64
runner: macos-14

# Linux
- os: linux
arch: x64
runner: ubuntu-22.04
- os: linux
arch: arm64
runner: ubuntu-22.04
# Windows

# Windows (CI only, no runtime)
- os: windows
arch: x64
runner: windows-2022
Expand All @@ -37,46 +40,41 @@ jobs:
runner: windows-2022

steps:
- name: Checkout source
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Make build script executable
run: chmod +x build.sh
# ========================
# UNIX: build + run
# ========================
- name: Build Splice (Unix)
if: matrix.os != 'windows'
shell: bash
run: |
set -e
chmod +x build.sh
CI=true ./build.sh

- name: Run build script (CI mode)
run: CI=true ./build.sh
- name: Run Splice (Unix)
if: matrix.os != 'windows'
shell: bash

- name: Verify binaries exist
run: |
ls -lh ./Splice || true
ls -lh ./spbuild || true
shell: bash
./bin/spbuild test/main.spl main.spc
./bin/Splice main.spc

- name: Run tests
# ========================
# WINDOWS: intentionally skipped
# ========================
- name: Skip Splice runtime (Windows)
if: matrix.os == 'windows'
shell: pwsh
run: |
if [ -d build ]; then
cd build
ctest --output-on-failure || true
else
echo "No build dir found, skipping tests"
fi
shell: bash
- name: Testing Splice Code
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows" ]]; then
./bin/spbuild.exe test/main.spl main.spc
./bin/Splice.exe main.spc
else
./bin/spbuild test/main.spl main.spc
./bin/Splice main.spc
fi
Write-Host "No prebuilt Windows binaries. Runtime tests skipped."

# ========================
# Finish
# ========================
- name: Mark as finished
run: echo "Build completed on ${{ matrix.os }}-${{ matrix.arch }}" > finish.txt
shell: bash
run: echo "Build completed on ${{ matrix.os }}-${{ matrix.arch }}" > finish.txt

- name: Upload finish artifact
uses: actions/upload-artifact@v4
Expand Down
Binary file removed bin/Splice
Binary file not shown.
Binary file removed bin/spbuild
Binary file not shown.
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ echo "Proceeding with build on $OS/$ARCH..."
echo "Building Splice runtime and native module..."

# Compile Splice runtime (with SDK globals)
gcc -DSDK_IMPLEMENTATION -Isrc -Wall -Wextra -c -DNDEBUG -O3 -flto src/splice.c -o "$BIN_DIR/Splice.o"
gcc -DSDK_IMPLEMENTATION -Isrc -Wall -Wextra -c -Ofast -march=native -mtune=native -flto -fomit-frame-pointer -funroll-loops -fno-semantic-interposition -fno-math-errno -fno-trapping-math -fstrict-aliasing -DNDEBUG src/splice.c -o "$BIN_DIR/Splice.o"

# Compile native module without SDK_IMPLEMENTATION
gcc -Isrc -Wall -Wextra -c -DNDEBUG -O3 -flto src/module_stubs.c -o "$BIN_DIR/module_stubs.o"
gcc -Isrc -Wall -Wextra -c -Ofast -march=native -mtune=native -flto -fomit-frame-pointer -funroll-loops -fno-semantic-interposition -fno-math-errno -fno-trapping-math -fstrict-aliasing -DNDEBUG src/module_stubs.c -o "$BIN_DIR/module_stubs.o"

# Link executable (local binary: Splice)
gcc "$BIN_DIR/Splice.o" "$BIN_DIR/module_stubs.o" -o "$BIN_DIR/Splice"

echo "Building spbuild (bytecode compiler)..."
gcc -Isrc -Wall -Wextra -DNDEBUG -O3 -flto src/build.c -o "$BIN_DIR/spbuild"
gcc -Isrc -Wall -Wextra -Ofast -march=native -mtune=native -flto -fomit-frame-pointer -funroll-loops -fno-semantic-interposition -fno-math-errno -fno-trapping-math -fstrict-aliasing -DNDEBUG src/build.c -o "$BIN_DIR/spbuild"

# --- Install section ---
INSTALL_DIR=""
Expand Down
Binary file added recurse
Binary file not shown.
13 changes: 13 additions & 0 deletions recurse.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "ctype.h"

void recurse(int a) {
printf("%d\n", a);
recurse(a + 1);
}
int main() {
recurse(1);
return 0;
}
Binary file added recurse.spc
Binary file not shown.
5 changes: 5 additions & 0 deletions recurse.spl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
func hi(a) {
print(a);
hi(a + 1);
}
hi(1);
Loading