finally fix workflow i hope
This commit is contained in:
parent
95bc048ec1
commit
788c168f81
8 changed files with 113 additions and 126 deletions
134
.github/workflows/rust.yml
vendored
134
.github/workflows/rust.yml
vendored
|
@ -1,95 +1,60 @@
|
||||||
name: Build Zenyx ⚡
|
name: Build Zenyx ⚡
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main", "master" ]
|
tags: ["v*"]
|
||||||
pull_request:
|
|
||||||
branches: [ "main", "master" ]
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Credit to https://github.com/Far-Beyond-Dev/Horizon/blob/main/.github/workflows/main.yml
|
|
||||||
check-version:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
- name: Get binary name
|
|
||||||
id: binary
|
|
||||||
run: |
|
|
||||||
BINARY_NAME=$(cargo metadata --format-version 1 | jq -r '.packages[0].targets[] | select(.kind[] | contains("bin")) | .name')
|
|
||||||
echo "name=$BINARY_NAME" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Check version change
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
git fetch
|
|
||||||
OLD_VERSION=$(git show HEAD^:Cargo.toml | grep -m 1 '^version = ' | cut -d '"' -f 2)
|
|
||||||
NEW_VERSION=$(grep -m 1 '^version = ' Cargo.toml | cut -d '"' -f 2)
|
|
||||||
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
|
|
||||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
- name: Create Release
|
|
||||||
if: steps.version.outputs.changed == 'true'
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
tag_name: v${{ steps.version.outputs.version }}
|
|
||||||
name: Release v${{ steps.version.outputs.version }}
|
|
||||||
files: target/release/${{ steps.binary.outputs.name }}
|
|
||||||
generate_release_notes: true
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
arch: [x86_64, aarch64]
|
arch: [x86_64, aarch64]
|
||||||
include:
|
include:
|
||||||
- arch: x86_64
|
- arch: x86_64
|
||||||
target: x86_64-unknown-linux-gnu
|
target: x86_64-unknown-linux-gnu
|
||||||
- os: macos-latest
|
binary_name: zenyx-linux-x86_64.zip
|
||||||
arch: x86_64
|
file_extension: ""
|
||||||
target: x86_64-apple-darwin
|
|
||||||
- arch: aarch64
|
- arch: aarch64
|
||||||
target: aarch64-unknown-linux-gnu
|
target: aarch64-unknown-linux-gnu
|
||||||
- os: macos-latest
|
binary_name: zenyx-linux-aarch64.zip
|
||||||
arch: aarch64
|
file_extension: ""
|
||||||
target: aarch64-apple-darwin
|
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
arch: x86_64
|
arch: x86_64
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
- os: windows-latest
|
binary_name: zenyx-windows-x86_64.zip
|
||||||
|
file_extension: ".exe"
|
||||||
|
- os: macos-latest
|
||||||
|
arch: x86_64
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
binary_name: zenyx-macos-x86_64.zip
|
||||||
|
file_extension: ""
|
||||||
|
- os: macos-latest
|
||||||
arch: aarch64
|
arch: aarch64
|
||||||
target: aarch64-pc-windows-msvc
|
target: aarch64-apple-darwin
|
||||||
|
binary_name: zenyx-macos-aarch64.zip
|
||||||
|
file_extension: ""
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
- name: 🛠️ Install cross-compilation dependencies (Ubuntu AMD)
|
||||||
- name: 🛠️ Install cross-compilation dependencies (Ubuntu)
|
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user
|
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user
|
||||||
|
|
||||||
- name: 🛠️ Install cross-compilation dependencies (macOS🍎)
|
- name: 🛠️ Install cross-compilation dependencies (macOS🍎)
|
||||||
if: runner.os == 'macOS'
|
if: runner.os == 'macOS'
|
||||||
run: |
|
run: |
|
||||||
brew install FiloSottile/musl-cross/musl-cross
|
brew install FiloSottile/musl-cross/musl-cross
|
||||||
|
|
||||||
- name: 🔧 Install Rust
|
- name: 🔧 Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: stable
|
||||||
override: true
|
override: true
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
profile: minimal
|
profile: minimal
|
||||||
|
|
||||||
- name: 🏗️ Build
|
- name: 🏗️ Build
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
@ -97,19 +62,50 @@ jobs:
|
||||||
args: --release --target ${{ matrix.target }}
|
args: --release --target ${{ matrix.target }}
|
||||||
env:
|
env:
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||||
|
- name: 📦 Prepare binary and checksum
|
||||||
- name: 🧪 Run tests
|
run: |
|
||||||
if: matrix.target != 'aarch64-pc-windows-msvc'
|
# Create temp directory for zip contents
|
||||||
uses: actions-rs/cargo@v1
|
mkdir -p temp_release
|
||||||
|
# Copy binary to temp directory
|
||||||
|
cp target/${{ matrix.target }}/release/zenyx${{ matrix.file_extension }} temp_release/zenyx${{ matrix.file_extension }}
|
||||||
|
chmod +x temp_release/zenyx${{ matrix.file_extension }}
|
||||||
|
# Create SHA256 checksum
|
||||||
|
cd temp_release
|
||||||
|
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||||
|
certutil -hashfile zenyx${{ matrix.file_extension }} SHA256 > zenyx.sha256
|
||||||
|
# Remove certutil's extra output, keeping only the hash
|
||||||
|
sed -i '1d' zenyx.sha256
|
||||||
|
sed -i '2d' zenyx.sha256
|
||||||
|
else
|
||||||
|
shasum -a 256 zenyx${{ matrix.file_extension }} > zenyx.sha256
|
||||||
|
fi
|
||||||
|
# Create zip with both files at root level
|
||||||
|
mkdir -p ../release
|
||||||
|
zip ../release/${{ matrix.binary_name }} zenyx${{ matrix.file_extension }} zenyx.sha256
|
||||||
|
cd ..
|
||||||
|
rm -rf temp_release
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
command: test
|
name: ${{ matrix.binary_name }}
|
||||||
args: --target ${{ matrix.target }}
|
path: release/${{ matrix.binary_name }}
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: release
|
||||||
|
- name: Create Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: release/*/*.zip
|
||||||
|
name: Release ${{ github.ref_name }}
|
||||||
|
body: |
|
||||||
|
This is the release for version ${{ github.ref_name }}.
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
env:
|
env:
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
QEMU_LD_PREFIX: /usr/aarch64-linux-gnu
|
|
||||||
|
|
||||||
- name: 📦 Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: Zenyx-${{ runner.os }}-${{ matrix.arch }}-bin
|
|
||||||
path: target/${{ matrix.target }}/release/zenyx*
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "engine"
|
name = "zenyx"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
repository = "https://github.com/Zenyx-Engine/Zenyx"
|
repository = "https://github.com/Zenyx-Engine/Zenyx"
|
||||||
|
@ -8,7 +8,6 @@ anyhow = "1.0.94"
|
||||||
backtrace = "0.3.74"
|
backtrace = "0.3.74"
|
||||||
chrono = "0.4.39"
|
chrono = "0.4.39"
|
||||||
colored = "2.2.0"
|
colored = "2.2.0"
|
||||||
crashreport = "1.0.1"
|
|
||||||
dirs-next = "2.0.0"
|
dirs-next = "2.0.0"
|
||||||
|
|
||||||
lazy_static.workspace = true
|
lazy_static.workspace = true
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use std::{fs, path::PathBuf, str::FromStr};
|
use std::{fs, path::PathBuf, str::FromStr};
|
||||||
|
|
||||||
|
use anyhow::anyhow;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use mlua::prelude::*;
|
use mlua::prelude::*;
|
||||||
use anyhow::anyhow;
|
|
||||||
use mlua::{Lua, MultiValue};
|
use mlua::{Lua, MultiValue};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use rustyline::{error::ReadlineError, DefaultEditor};
|
use rustyline::{DefaultEditor, error::ReadlineError};
|
||||||
|
|
||||||
use super::{handler::Command, input::tokenize};
|
use super::{handler::Command, input::tokenize};
|
||||||
use crate::core::repl::handler::COMMAND_MANAGER;
|
use crate::core::repl::handler::COMMAND_MANAGER;
|
||||||
|
|
|
@ -140,7 +140,6 @@ impl CommandManager {
|
||||||
.insert(command.get_name().to_lowercase(), command);
|
.insert(command.get_name().to_lowercase(), command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn add_alias(&mut self, alias: &str, command: &str) {
|
pub fn add_alias(&mut self, alias: &str, command: &str) {
|
||||||
self.aliases.insert(
|
self.aliases.insert(
|
||||||
alias.to_string().to_lowercase(),
|
alias.to_string().to_lowercase(),
|
||||||
|
@ -149,7 +148,6 @@ impl CommandManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub trait Command: Send + Sync {
|
pub trait Command: Send + Sync {
|
||||||
fn execute(&self, args: Option<Vec<String>>) -> Result<(), anyhow::Error>;
|
fn execute(&self, args: Option<Vec<String>>) -> Result<(), anyhow::Error>;
|
||||||
fn undo(&self);
|
fn undo(&self);
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use commands::{
|
use commands::{ClearCommand, CounterCommand, ExecFile, ExitCommand, HelpCommand, PanicCommmand};
|
||||||
ClearCommand, CounterCommand, ExitCommand, HelpCommand, PanicCommmand,ExecFile
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::commands;
|
use crate::commands;
|
||||||
|
|
||||||
|
@ -13,7 +11,6 @@ pub fn setup() {
|
||||||
commands!(
|
commands!(
|
||||||
HelpCommand,
|
HelpCommand,
|
||||||
ExecFile,
|
ExecFile,
|
||||||
|
|
||||||
ClearCommand,
|
ClearCommand,
|
||||||
ExitCommand,
|
ExitCommand,
|
||||||
CounterCommand,
|
CounterCommand,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use mlua::{Function, Lua, LuaOptions, MultiValue, Number, Value::Nil};
|
use mlua::{Lua, LuaOptions, MultiValue};
|
||||||
use rustyline::{error::ReadlineError, DefaultEditor};
|
use rustyline::{DefaultEditor, error::ReadlineError};
|
||||||
|
|
||||||
use crate::core::repl::handler::Command;
|
use crate::core::repl::handler::Command;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
@ -9,13 +10,10 @@ impl Command for ZLua {
|
||||||
fn execute(&self, _args: Option<Vec<String>>) -> Result<(), anyhow::Error> {
|
fn execute(&self, _args: Option<Vec<String>>) -> Result<(), anyhow::Error> {
|
||||||
let time = chrono::Local::now().format("%H:%M:%S.%3f").to_string();
|
let time = chrono::Local::now().format("%H:%M:%S.%3f").to_string();
|
||||||
let prompt = format!("[{}/{}] {}", time, "ZLUA", ">>\t");
|
let prompt = format!("[{}/{}] {}", time, "ZLUA", ">>\t");
|
||||||
let lua = Lua::new_with(
|
let lua = Lua::new_with(mlua::StdLib::ALL_SAFE, LuaOptions::default())?;
|
||||||
mlua::StdLib::ALL_SAFE,
|
|
||||||
LuaOptions::default()
|
|
||||||
)?;
|
|
||||||
let globals = lua.globals();
|
let globals = lua.globals();
|
||||||
//This just adds 2 numbers together
|
//This just adds 2 numbers together
|
||||||
let add = lua.create_function(|_, (number1,number2):(i32,i32)|{
|
let add = lua.create_function(|_, (number1, number2): (i32, i32)| {
|
||||||
let result = number1 + number2;
|
let result = number1 + number2;
|
||||||
println!("{result}");
|
println!("{result}");
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -24,7 +22,9 @@ impl Command for ZLua {
|
||||||
|
|
||||||
let is_equal = lua.create_function(|_, (list1, list2): (i32, i32)| {
|
let is_equal = lua.create_function(|_, (list1, list2): (i32, i32)| {
|
||||||
if list1 == 0 || list2 == 0 {
|
if list1 == 0 || list2 == 0 {
|
||||||
return Err(mlua::Error::RuntimeError("Zero values not allowed".to_string()));
|
return Err(mlua::Error::RuntimeError(
|
||||||
|
"Zero values not allowed".to_string(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Ok(list1 == list2)
|
Ok(list1 == list2)
|
||||||
})?;
|
})?;
|
||||||
|
@ -36,11 +36,11 @@ impl Command for ZLua {
|
||||||
})?;
|
})?;
|
||||||
globals.set("log", log)?;
|
globals.set("log", log)?;
|
||||||
|
|
||||||
let fail_safe = lua.create_function(|_,()|{
|
let fail_safe = lua.create_function(|_, ()| {
|
||||||
println!("Failed");
|
println!("Failed");
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
globals.set("failSafe",fail_safe)?;
|
globals.set("failSafe", fail_safe)?;
|
||||||
let mut editor = DefaultEditor::new().expect("Failed to create editor");
|
let mut editor = DefaultEditor::new().expect("Failed to create editor");
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -65,7 +65,7 @@ impl Command for ZLua {
|
||||||
mlua::Value::Number(n) => println!("Got number: {}", n),
|
mlua::Value::Number(n) => println!("Got number: {}", n),
|
||||||
mlua::Value::String(s) => println!("Got string: {}", s.to_str()?),
|
mlua::Value::String(s) => println!("Got string: {}", s.to_str()?),
|
||||||
mlua::Value::Boolean(b) => println!("Got boolean: {}", b),
|
mlua::Value::Boolean(b) => println!("Got boolean: {}", b),
|
||||||
_ => eprintln!("Got unexpected type: {:#?}", value)
|
_ => eprintln!("Got unexpected type: {:#?}", value),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editor.add_history_entry(line).unwrap();
|
editor.add_history_entry(line).unwrap();
|
||||||
|
@ -92,7 +92,6 @@ impl Command for ZLua {
|
||||||
eprintln!("Input that caused error: {}", line);
|
eprintln!("Input that caused error: {}", line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
|
||||||
pub fn print_splash() {
|
pub fn print_splash() {
|
||||||
println!
|
println!(
|
||||||
("# #
|
"# #
|
||||||
# Welcome to the Zenyx terminal #
|
# Welcome to the Zenyx terminal #
|
||||||
# #");
|
# #"
|
||||||
|
);
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
format!(
|
format!(
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[derive(Debug,Error)]
|
#[derive(Debug, Error)]
|
||||||
enum ZError {
|
enum ZError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Unknown(#[from] anyhow::Error)
|
Unknown(#[from] anyhow::Error),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue