Skip to content
Merged
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
61 changes: 61 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on:
push:
branches:
main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@master
- name: Install Lua
uses: leafo/gh-actions-lua@master
with:
luaVersion: 5.1
- name: Run test case
run: lua ./tests.lua --Linux --CI

build:
runs-on: windows-latest # gh-actions-lua doesn't work on windows
steps:
- name: Checkout repo
uses: actions/checkout@master
- name: Download srlua-mingw
run: curl -o srlua.zip "https://raw.githubusercontent.com/joedf/LuaBuilds/gh-pages/hdata/srlua-5.1.5_Win32_bin.zip"
- name: Unzip srlua-mingw
run: |
tar -xf srlua.zip
Rename-Item -Path srglue.exe -NewName glue.exe
- name: Download Lua53
run: curl -o Lua53.zip "https://raw.githubusercontent.com/joedf/LuaBuilds/gh-pages/hdata/lua-5.3.5_Win64_bin.zip"
- name: Unzip Lua53
run: |
tar -xf Lua53.zip
- run: dir
- name: Build the project
run: |
./build.bat
shell: bash
- name: Zip the build
uses: papeloto/action-zip@v1
with:
files: build/
dest: build.zip
- name: Load version and name
run: | # I have no idea why but 5.1 just won't work for some reason
echo "prometheus_full_version=$(./lua.exe ./src/config.lua --FullVersion)" >> $GITHUB_ENV
echo "prometheus_version=$(./lua.exe ./src/config.lua --Version)" >> $GITHUB_ENV
shell: bash
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build.zip
asset_name: ${{ env.prometheus_full_version }}.zip
tag: release-${{ github.ref }}-${{ env.prometheus_version }}
release_name: ${{ env.prometheus_version }}
overwrite: true
body: ${{ env.prometheus_full_version }} ${{ github.event.commits[0].message }}
13 changes: 13 additions & 0 deletions src/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ local REVISION = "Alpha";
local VERSION = "v0.2";
local BY = "levno-710";

for _, currArg in pairs(arg) do
if currArg == "--CI" then
local releaseName = string.gsub(string.format("%s %s %s", NAME, REVISION, VERSION), "%s", "-")
print(releaseName)
return
end

if currArg == "--FullVersion" then
print(VERSION)
return
end
end

-- Config Starts here
return {
Name = NAME,
Expand Down
7 changes: 7 additions & 0 deletions tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local Prometheus = require("src.prometheus")
local noColors = false; -- Wether Colors in the Console output should be enabled
local noHighlight = false; -- Disable Syntax Highlighting of Outputed Code
local isWindows = true; -- Wether the Test are Performed on a Windows or Linux System
local ciMode = false; -- Wether the Test error are ignored or not

-- The Code to Obfuscate
local code = [=[
Expand All @@ -23,6 +24,9 @@ for _, currArg in pairs(arg) do
if currArg == "--Linux" then
isWindows = false
end
if currArg == "--CI" then
ciMode = true
end
end

-- Enable/Disable Console Colors - this may be needed because cmd.exe and powershell.exe do not support ANSI Color Escape Sequences. The Windows Terminal Application is needed
Expand Down Expand Up @@ -122,6 +126,9 @@ for i, filename in ipairs(scandir(testdir)) do
print(Prometheus.colors("[FAILED] ", "red") .. "(" .. filename .. ") " .. step.Name);
print("[OUTA] ", outa);
print("[OUTB] ", outb);
if ciMode then
error("Test Failed!")
end
fc = fc + 1;
end
end
Expand Down