Compare commits
21 Commits
357c8745a4
...
v1.0.0-jen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8561f6d762 | ||
|
|
1e21a7f11c | ||
|
|
01c89f082c | ||
|
|
b7bfbf5596 | ||
|
|
725413ed83 | ||
|
|
5c3e25d97c | ||
|
|
d7f5e4744b | ||
|
|
12cef9103c | ||
|
|
21bfc71250 | ||
|
|
06da01c119 | ||
|
|
5741fb4185 | ||
|
|
7d272a2f4d | ||
|
|
34a083a2a2 | ||
|
|
eb38da212d | ||
|
|
72eca4a15f | ||
|
|
66c0db52e8 | ||
|
|
c94e8a227d | ||
|
|
4bba257728 | ||
|
|
f5ccb2368c | ||
|
|
2d988a5120 | ||
|
|
3d92071d0a |
238
.github/workflows/release.yml
vendored
238
.github/workflows/release.yml
vendored
@@ -1,238 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2025 William Bell
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*' # Any tag
|
||||
|
||||
jobs:
|
||||
build-linux-x86_64:
|
||||
runs-on: ubuntu-latest # build both architectures
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install build tools
|
||||
run: sudo apt-get update && sudo apt-get install -y flex bison
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Conan
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install conan
|
||||
conan profile detect
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
conan install . --build=missing
|
||||
conan build .
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${GITHUB_REF##refs/tags/}
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(uname -m)
|
||||
FOLDER="chloride-$TAG-$OS-$ARCH"
|
||||
TAR="$FOLDER.tar.gz"
|
||||
mv build/bin "$FOLDER"
|
||||
cp LICENSE.txt "$FOLDER"
|
||||
tar -czf "$TAR" "$FOLDER"
|
||||
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-x86_64-artifact
|
||||
path: ${{ env.TAR_NAME }}
|
||||
build-linux-arm64:
|
||||
runs-on: ubuntu-22.04-arm # build both architectures
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install build tools
|
||||
run: sudo apt-get update && sudo apt-get install -y flex bison
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Conan
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install conan
|
||||
conan profile detect
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
conan install . --build=missing
|
||||
conan build .
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${GITHUB_REF##refs/tags/}
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(uname -m)
|
||||
FOLDER="chloride-$TAG-$OS-$ARCH"
|
||||
TAR="$FOLDER.tar.gz"
|
||||
mv build/bin "$FOLDER"
|
||||
cp LICENSE.txt "$FOLDER"
|
||||
tar -czf "$TAR" "$FOLDER"
|
||||
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-arm64-artifact
|
||||
path: ${{ env.TAR_NAME }}
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64, arm64] # build both architectures
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install build tools
|
||||
run: brew install flex bison
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Conan
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install conan
|
||||
if [ "${{ matrix.arch }}" = "x86_64" ] && [ "$(uname -m)" = "arm64" ]; then
|
||||
arch -x86_64 conan profile detect
|
||||
else
|
||||
conan profile detect
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
BUILD_DIR="build_${{ matrix.arch }}"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
cd "$BUILD_DIR"
|
||||
|
||||
# Use Rosetta for x86_64 builds on Apple Silicon
|
||||
if [ "${{ matrix.arch }}" = "x86_64" ] && [ "$(uname -m)" = "arm64" ]; then
|
||||
arch -x86_64 bash -c "
|
||||
export CMAKE_OSX_ARCHITECTURES=x86_64
|
||||
conan install .. --build=missing
|
||||
conan build ..
|
||||
"
|
||||
else
|
||||
export CMAKE_OSX_ARCHITECTURES="${{ matrix.arch }}"
|
||||
conan install .. --build=missing
|
||||
conan build ..
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${GITHUB_REF##refs/tags/}
|
||||
OS="macos"
|
||||
ARCH="${{ matrix.arch }}"
|
||||
FOLDER="chloride-$TAG-$OS-$ARCH"
|
||||
TAR="$FOLDER.tar.gz"
|
||||
mv build/bin "$FOLDER"
|
||||
cp LICENSE.txt "$FOLDER"
|
||||
tar -czf "$TAR" "$FOLDER"
|
||||
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-${{ matrix.arch }}-artifact
|
||||
path: ${{ env.TAR_NAME }}
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: >
|
||||
base-devel
|
||||
mingw-w64-x86_64-gcc
|
||||
mingw-w64-x86_64-make
|
||||
mingw-w64-x86_64-cmake
|
||||
mingw-w64-x86_64-python
|
||||
mingw-w64-x86_64-python-pip
|
||||
msys/flex
|
||||
|
||||
- name: Install Conan
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install conan
|
||||
conan profile detect
|
||||
|
||||
- name: Build Project
|
||||
run: |
|
||||
conan install . --profile windows-profile.txt --build=missing
|
||||
conan build . --profile windows-profile.txt
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${GITHUB_REF##refs/tags/}
|
||||
OS="windows"
|
||||
ARCH=$(uname -m)
|
||||
FOLDER="chloride-$TAG-$OS-$ARCH"
|
||||
TAR="$FOLDER.tar.gz"
|
||||
mv build/bin "$FOLDER"
|
||||
cp LICENSE.txt "$FOLDER"
|
||||
tar -czf "$TAR" "$FOLDER"
|
||||
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-artifact
|
||||
path: ${{ env.TAR_NAME }}
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-linux-x86_64, build-linux-arm64, build-macos, build-windows]
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ./artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ github.ref_name }}
|
||||
name: Release ${{ github.ref_name }}
|
||||
body: Automated release based on tag ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: ${{ startsWith(github.ref_name, 'prerelease-') }}
|
||||
artifacts: "./artifacts/*"
|
||||
190
Jenkinsfile
vendored
190
Jenkinsfile
vendored
@@ -1,68 +1,142 @@
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
GITEA_URL = 'https://git.wbell.dev'
|
||||
GITEA_REPO = 'Open-Argon/Chloride'
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
script {
|
||||
// Detect if this is a tag build via Jenkins-supplied vars
|
||||
if (env.GIT_TAG) {
|
||||
echo "Checking out tag: ${env.GIT_TAG}"
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: [[name: "refs/tags/${env.GIT_TAG}"]],
|
||||
userRemoteConfigs: [[url: scm.userRemoteConfigs[0].url]],
|
||||
doGenerateSubmoduleConfigurations: false,
|
||||
extensions: [
|
||||
[$class: 'SubmoduleUpdate', recursiveSubmodules: true]
|
||||
]
|
||||
])
|
||||
} else {
|
||||
echo "Checking out normal branch"
|
||||
checkout scm
|
||||
}
|
||||
|
||||
// update submodules
|
||||
sh 'git submodule update --init --recursive'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Setup Conan') {
|
||||
steps {
|
||||
sh '''
|
||||
python3 -m venv /tmp/venv
|
||||
. /tmp/venv/bin/activate
|
||||
apt update
|
||||
apt upgrade
|
||||
apt install -y cmake flex python3 python3-pip python3-venv
|
||||
pip install --upgrade pip
|
||||
pip install conan
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Setup Conan Profile') {
|
||||
steps {
|
||||
sh '''
|
||||
. /tmp/venv/bin/activate
|
||||
if [ ! -f ~/.conan2/profiles/default ]; then
|
||||
conan profile detect
|
||||
fi
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Dependencies') {
|
||||
steps {
|
||||
sh '''
|
||||
. /tmp/venv/bin/activate
|
||||
conan install . --build=missing
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Project') {
|
||||
steps {
|
||||
sh '''
|
||||
. /tmp/venv/bin/activate
|
||||
conan build .
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive Build Artifacts') {
|
||||
steps {
|
||||
sh '''
|
||||
# Copy LICENSE.txt into build/bin
|
||||
cp LICENSE.txt build/bin/
|
||||
|
||||
# Create tarball with the contents of build/bin at the root
|
||||
tar -czf chloride.tar.gz -C build/bin .
|
||||
'''
|
||||
// Archive the tarball
|
||||
archiveArtifacts artifacts: 'chloride.tar.gz', allowEmptyArchive: false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stage('Detect Tag') {
|
||||
steps {
|
||||
script {
|
||||
|
||||
def tag = sh(script: "git describe --tags --exact-match", returnStdout: true).trim()
|
||||
echo "Tag detected: ${tag}"
|
||||
|
||||
if (tag.toLowerCase().contains('unsable')) {
|
||||
echo "Tag contains 'unsable' → marking build UNSTABLE"
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
|
||||
// Expose for other stages
|
||||
env.TAG_NAME = tag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Setup Conan') {
|
||||
steps {
|
||||
sh '''
|
||||
apt update
|
||||
apt install -y cmake flex python3 python3-pip python3-venv
|
||||
python3 -m venv /tmp/venv
|
||||
. /tmp/venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install conan
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Setup Conan Profile') {
|
||||
steps {
|
||||
sh '''
|
||||
. /tmp/venv/bin/activate
|
||||
rm -rf ~/.conan2
|
||||
conan profile detect
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Dependencies') {
|
||||
steps {
|
||||
sh '''
|
||||
. /tmp/venv/bin/activate
|
||||
conan install . --build=missing
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Project') {
|
||||
steps {
|
||||
sh '''
|
||||
. /tmp/venv/bin/activate
|
||||
conan build .
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stage('Archive Build Artifacts') {
|
||||
steps {
|
||||
script {
|
||||
// Determine platform
|
||||
def os = sh(returnStdout: true, script: 'uname -s').trim().toLowerCase()
|
||||
def arch = sh(returnStdout: true, script: 'uname -m').trim().toLowerCase()
|
||||
|
||||
// Determine version (tag or "dev")
|
||||
def version = env.TAG_NAME ?: "dev"
|
||||
|
||||
// Construct file name
|
||||
env.OUTPUT_FILE = "chloride-${version}-${os}-${arch}.tar.gz"
|
||||
|
||||
echo "Packaging as: ${env.OUTPUT_FILE}"
|
||||
}
|
||||
|
||||
sh '''
|
||||
# Ensure LICENSE.txt is in the output directory
|
||||
cp LICENSE.txt build/bin/
|
||||
|
||||
# Create tarball with auto-generated name
|
||||
tar -czf "$OUTPUT_FILE" -C build/bin .
|
||||
'''
|
||||
|
||||
archiveArtifacts artifacts: "${env.OUTPUT_FILE}", allowEmptyArchive: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
// Automatically detects full ref name
|
||||
def tag = sh(script: "git describe --tags --exact-match", returnStdout: true).trim()
|
||||
echo "Detected tag: ${tag}"
|
||||
|
||||
if (tag.toLowerCase().contains("unstable")) {
|
||||
echo "Unstable tag detected"
|
||||
currentBuild.result = "UNSTABLE"
|
||||
} else {
|
||||
echo "Stable tagged build"
|
||||
currentBuild.description = "Stable"
|
||||
currentBuild.result = "SUCCESS"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,12 +100,13 @@ ArgonObject *ARGON_ADDITION_FUNCTION(size_t argc, ArgonObject **argv,
|
||||
}
|
||||
ArgonObject *output = argv[0];
|
||||
for (size_t i = 1; i < argc; i++) {
|
||||
ArgonObject *object_class = get_builtin_field(output, __class__);
|
||||
ArgonObject *object__add__ = get_builtin_field_for_class(
|
||||
get_builtin_field(output, __class__), __add__, output);
|
||||
object_class, __add__, output);
|
||||
if (!object__add__) {
|
||||
ArgonObject *cls___name__ = get_builtin_field(output, __name__);
|
||||
ArgonObject *cls___name__ = get_builtin_field(object_class, __name__);
|
||||
*err = create_err(0, 0, 0, "", "Runtime Error",
|
||||
"Object '%.*s' is missing __add__ method",
|
||||
"Object of type '%.*s' is missing __add__ method",
|
||||
(int)cls___name__->value.as_str->length,
|
||||
cls___name__->value.as_str->data);
|
||||
return ARGON_NULL;
|
||||
@@ -126,12 +127,13 @@ ArgonObject *ARGON_SUBTRACTION_FUNCTION(size_t argc, ArgonObject **argv,
|
||||
}
|
||||
ArgonObject *output = argv[0];
|
||||
for (size_t i = 1; i < argc; i++) {
|
||||
ArgonObject *object_class = get_builtin_field(output, __class__);
|
||||
ArgonObject *function__subtract__ = get_builtin_field_for_class(
|
||||
get_builtin_field(output, __class__), __subtract__, output);
|
||||
object_class, __subtract__, output);
|
||||
if (!function__subtract__) {
|
||||
ArgonObject *cls___name__ = get_builtin_field(output, __name__);
|
||||
ArgonObject *cls___name__ = get_builtin_field(object_class, __name__);
|
||||
*err = create_err(0, 0, 0, "", "Runtime Error",
|
||||
"Object '%.*s' is missing __subtract__ method",
|
||||
"Object of type '%.*s' is missing __subtract__ method",
|
||||
(int)cls___name__->value.as_str->length,
|
||||
cls___name__->value.as_str->data);
|
||||
return ARGON_NULL;
|
||||
@@ -152,12 +154,13 @@ ArgonObject *ARGON_MULTIPLY_FUNCTION(size_t argc, ArgonObject **argv,
|
||||
}
|
||||
ArgonObject *output = argv[0];
|
||||
for (size_t i = 1; i < argc; i++) {
|
||||
ArgonObject *object_class = get_builtin_field(output, __class__);
|
||||
ArgonObject *function__multiply__ = get_builtin_field_for_class(
|
||||
get_builtin_field(output, __class__), __multiply__, output);
|
||||
object_class, __multiply__, output);
|
||||
if (!function__multiply__) {
|
||||
ArgonObject *cls___name__ = get_builtin_field(output, __name__);
|
||||
ArgonObject *cls___name__ = get_builtin_field(object_class, __name__);
|
||||
*err = create_err(0, 0, 0, "", "Runtime Error",
|
||||
"Object '%.*s' is missing __multiply__ method",
|
||||
"Object of type '%.*s' is missing __multiply__ method",
|
||||
(int)cls___name__->value.as_str->length,
|
||||
cls___name__->value.as_str->data);
|
||||
return ARGON_NULL;
|
||||
@@ -177,12 +180,13 @@ ArgonObject *ARGON_DIVIDE_FUNCTION(size_t argc, ArgonObject **argv, ArErr *err,
|
||||
}
|
||||
ArgonObject *output = argv[0];
|
||||
for (size_t i = 1; i < argc; i++) {
|
||||
ArgonObject *object_class = get_builtin_field(output, __class__);
|
||||
ArgonObject *function___divide__ = get_builtin_field_for_class(
|
||||
get_builtin_field(output, __class__), __divide__, output);
|
||||
object_class, __divide__, output);
|
||||
if (!function___divide__) {
|
||||
ArgonObject *cls___name__ = get_builtin_field(output, __name__);
|
||||
ArgonObject *cls___name__ = get_builtin_field(object_class, __name__);
|
||||
*err = create_err(0, 0, 0, "", "Runtime Error",
|
||||
"Object '%.*s' is missing __divide__ method",
|
||||
"Object of type '%.*s' is missing __divide__ method",
|
||||
(int)cls___name__->value.as_str->length,
|
||||
cls___name__->value.as_str->data);
|
||||
return ARGON_NULL;
|
||||
|
||||
@@ -230,8 +230,9 @@ int shell() {
|
||||
|
||||
signal(SIGINT, handle_sigint);
|
||||
|
||||
printf("Argon (Chloride %s)\nType \"license\" for more information.\n",
|
||||
version_string);
|
||||
printf("Chloride %s Copyright (C) 2025 William Bell\n"
|
||||
"This program comes with ABSOLUTELY NO WARRANTY; for details type `license'.\n"
|
||||
"This is free software, and you are welcome to redistribute it under certain conditions; type `license' for details.\n", version_string);
|
||||
|
||||
ArgonObject *output_object = create_argon_native_function("log", term_log);
|
||||
char *totranslate = NULL;
|
||||
|
||||
1
tests/null_plus_one.ar
Normal file
1
tests/null_plus_one.ar
Normal file
@@ -0,0 +1 @@
|
||||
null+1
|
||||
Reference in New Issue
Block a user