Skip to content
Closed
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
92 changes: 25 additions & 67 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,42 @@ name: Splice CI

on:
push:
branches: [ main ]
branches: [ main, Development, Test, Testing ]
pull_request:
branches: [ main ]

jobs:
build-test:
name: Build & Test (${{ matrix.os }} - ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
build-and-test:
strategy:
fail-fast: false
matrix:
include:
# macOS
- os: macos
arch: x64
runner: macos-15-intel
- 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
- os: windows
arch: x64
runner: windows-2022
- os: windows
arch: arm64
runner: windows-2022
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

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

- name: Make build script executable
run: chmod +x build.sh
shell: bash

- name: Run build script (CI mode)
run: CI=true ./build.sh
# -------------------------
# Linux / macOS
# -------------------------
- name: Build & Run Splice (Unix)
if: runner.os != 'Windows'
shell: bash

- name: Verify binaries exist
run: |
ls -lh ./Splice || true
ls -lh ./spbuild || true
shell: bash

- name: Run tests
set -e
chmod +x bin/spbuild bin/Splice
./bin/spbuild test/main.spl main.spc
./bin/Splice main.spc

# -------------------------
# Windows (PowerShell ONLY)
# -------------------------
- name: Build & Run Splice (Windows)
if: runner.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

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

- name: Upload finish artifact
uses: actions/upload-artifact@v4
with:
name: splice-finish-${{ matrix.os }}-${{ matrix.arch }}
path: finish.txt
$ErrorActionPreference = "Stop"
.\bin\spbuild.exe test\main.spl main.spc
.\bin\Splice.exe main.spc
Binary file modified bin/Splice
Binary file not shown.
Binary file modified 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
Loading