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
85 changes: 62 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,75 @@
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
name: CI

on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- '.vscode/*'
pull_request:
workflow_dispatch:
repository_dispatch:
schedule:
- cron: '0 4 * * *'
# workflow_dispatch:
# repository_dispatch:
# schedule:
# - cron: '0 4 * * *'

jobs:
build:
# strategy:
# matrix:
# haxe-version: ["4.3.6"]
# fail-fast: false
# runs-on: ubuntu-latest
runs-on: macos-13
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
haxe:
# - latest TODO: fix tests/bare/src/Main.hx:78: Too many arguments - gAssert(5 < 3);
- 4.3.7

steps:
# - run: sudo apt-get update

- uses: actions/checkout@v4

- uses: krdlab/setup-haxe@v1
- name: Show environment variables
shell: bash
run: env | sort

- name: Git Checkout
uses: actions/checkout@v2 #https://github.com/actions/checkout

# - name: "Cache Haxelib Repository"
# uses: actions/cache@v4
# with:
# path: $RUNNER_TOOL_CACHE/haxe/${{ matrix.haxe }}/x64/lib
# key: ${{ runner.os }}-haxelib-${{ hashFiles('**/haxelib.json') }}
# restore-keys: |
# ${{ runner.os }}-haxelib-

- name: Install Haxe ${{ matrix.haxe }}
uses: krdlab/setup-haxe@v2 # https://github.com/krdlab/setup-haxe
with:
# haxe-version: ${{matrix.haxe-version}}
haxe-version: "4.3.4"

- name: Set HAXEPATH
haxe-version: ${{ matrix.haxe }}

- name: Install haxe libs
shell: bash
id: prerequisites
run: |
echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV
haxelib git utest https://github.com/haxe-utest/utest.git


##################################################
# Tests
##################################################

- name: Build test
- name: Build bare test
run: |
echo "Building bare test"
cd tests/bare/
haxe test.hxml
cd ../../

- name: Build unit tests
run: |
echo "Building test"
haxe -cp test/src -cp lib -D analyzer-optimize -main Main --interp
echo "Building unit tests"
cd tests/unit/
haxe test.hxml
cd ../../
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.DS_Store
export/
export/
.unittest
dump/
2 changes: 1 addition & 1 deletion lib/debug/Assert.hx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class AssertRaw
if (args.length == 2)
return evalFinal(instance, args[0], args[1]);

throw "Invalid number of args";
throw 'Invalid number of args, expecting (condition:Bool, ?msg:String):Void, got ${args}';
}

static function evalFinal(instance:Expr, cond:ExprOf<Bool>, ?msg:ExprOf<String>):Expr
Expand Down
32 changes: 29 additions & 3 deletions lib/debug/Logger.hx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ private class LoggerRaw
verbose = new LoggerPriority(this, VERBOSE);
}

#if logger.unit_test
public function resetFromCompilerFlags()
{
logLevels.resetFromCompilerFlags(LOG, id);
throwLevels.resetFromCompilerFlags(THROW, id);
}
#end

public function destroy()
{
error.destroy();
Expand Down Expand Up @@ -272,7 +280,6 @@ abstract PriorityList(Array<Priority>) from Array<Priority>
return this.copy();
}


public function setPriority(priority:Priority)
{
this.resize(0);
Expand Down Expand Up @@ -314,6 +321,22 @@ abstract PriorityList(Array<Priority>) from Array<Priority>
return value;
}

function copyBase(arr:Array<Priority>)
{
this.splice(0, this.length);
for (i in 0...arr.length)
this.push(arr[i]);
}

#if logger.unit_test
public function resetFromCompilerFlags(type:LogType, id:String)
{
final newList = fromCompilerFlag(type, id, this);
if (newList != this)
copyBase(cast newList);
}
#end

static final arrReg = ~/^\[(.+)\]$/;

/**
Expand Down Expand Up @@ -493,12 +516,15 @@ enum abstract Priority(Int)
}
}

private class LoggerDefines
#if !logger.unit_test
private
#end
class LoggerDefines
{
/**
* Every single compiler flag, and its value
*/
#if (!display && !macro)
#if (!macro)
public static final all:Map<String, String> = getDefines();
#else
public static final all:Map<String, String> = [];
Expand Down
4 changes: 2 additions & 2 deletions lib/debug/LoggerPriority.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package debug;
import debug.Logger;
import haxe.PosInfos;

@:forward(enabled, throws, assert)
@:forward(enabled, throws, assert, level)
abstract LoggerPriority(LoggerPriorityRaw)
{
public function new(parent, level)
Expand All @@ -28,7 +28,7 @@ abstract LoggerPriority(LoggerPriorityRaw)
private class LoggerPriorityRaw
{
var parent:Logger;
final level:Priority;
public final level:Priority;

public var assert(default, null):Assert;

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion test/test.hxml → tests/bare/test.hxml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
--class-path src
--class-path ../lib/
--class-path ../../lib/
--main Main
-D main.log=warn
-D alt.log=info
-D main.sub.log=warn
-D dump-dependencies
--dce full
-D analyzer-optimize
-D logger.verboseMacroErrors
Expand Down
Loading
Loading