From 7acf6aeb8b915e9026368fea4202a1d70718ddc6 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 14:37:20 -0500 Subject: [PATCH 01/30] run pre-commit --- .github/ISSUE_TEMPLATE/bug-report.md | 8 +-- .pre-commit-config.yaml | 4 +- CHANGELOG.md | 80 ++++++++++++------------- README.md | 90 ++++++++++++++-------------- src/toml.cpp | 10 ++-- 5 files changed, 97 insertions(+), 95 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 7b19b46..b458581 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -12,10 +12,10 @@ A clear and concise description of what the bug is. ## Version and Installation Info -- toml.lua version: -- Operating system: -- Installation method: (Manual compilation or `luarocks install toml`) -- Compilation log, or Luarocks installation log: +- toml.lua version: +- Operating system: +- Installation method: (Manual compilation or `luarocks install toml`) +- Compilation log, or Luarocks installation log: ```shell # Paste installation or compilation log here diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3dbeba5..f718c99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - - repo: "https://github.com/pre-commit/mirrors-prettier.git" - rev: "v4.0.0-alpha.8" + - repo: "https://github.com/rbubley/mirrors-prettier.git" + rev: "v3.7.4" hooks: - id: "prettier" name: "Format YAML & Markdown" diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a705d..fe19daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,22 +9,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- The formatting options that were passed as a parameter to `toml.encode`, `toml.encodeToFile`, `toml.toJSON`, and `toml.toYAML` previously had no effect when overriding values. -- Resolved CMake `FetchContent_Populate` warning. +- The formatting options that were passed as a parameter to `toml.encode`, `toml.encodeToFile`, `toml.toJSON`, and `toml.toYAML` previously had no effect when overriding values. +- Resolved CMake `FetchContent_Populate` warning. ### Changed -- Updated to magic_enum v0.9.7. +- Updated to magic_enum v0.9.7. ### Added -- Added tests for encoding options. +- Added tests for encoding options. ## [0.4.0](https://github.com/LebJe/toml.lua/releases/tag/0.4.0) - 2024-01-02 ### Added -- `toml.Int` for formatted integers. +- `toml.Int` for formatted integers. ```lua local formattedIntegers = { @@ -41,39 +41,39 @@ int3 = 0x169F --]] ``` -- `formattedIntsAsUserdata` can be passed to the options table of `toml.decode` (see "Decoding Options" in the README). -- Updated to toml++ v3.4.0. -- Updated to MagicEnum v0.9.5. -- toml.lua compiles with MSVC. +- `formattedIntsAsUserdata` can be passed to the options table of `toml.decode` (see "Decoding Options" in the README). +- Updated to toml++ v3.4.0. +- Updated to MagicEnum v0.9.5. +- toml.lua compiles with MSVC. ## [0.3.0](https://github.com/LebJe/toml.lua/releases/tag/0.3.0) - 2023-02-19 ### Added -- `toml.decodeFromFile(filePath: string)`: - - Decodes a TOML document at `filePath`. Throws the same errors as `toml.decode`. -- `toml.encodeToFile(data: table, fileOrOptions: string|table)`: - - Encodes `data` to the file specified in `fileOrOptions`. the file will be created if it doesn't exist. - - When `fileOrOptions` is a string, it simply is the file path. - - When `fileOrOptions` is a table, it should have`file`, and optionally, `overwrite` as keys. `file` is the file path, and `overwrite` should be `true` when `file` should be overwritten with `data`, and `false` when `data` should be appended to `file`. -- Added tests that cover: - - The property accessors of `toml.Date`, `toml.Time`, `toml.DateTime`, and `toml.TimeOffset`. - - `toml.toJSON` and `toml.toYAML`. +- `toml.decodeFromFile(filePath: string)`: + - Decodes a TOML document at `filePath`. Throws the same errors as `toml.decode`. +- `toml.encodeToFile(data: table, fileOrOptions: string|table)`: + - Encodes `data` to the file specified in `fileOrOptions`. the file will be created if it doesn't exist. + - When `fileOrOptions` is a string, it simply is the file path. + - When `fileOrOptions` is a table, it should have`file`, and optionally, `overwrite` as keys. `file` is the file path, and `overwrite` should be `true` when `file` should be overwritten with `data`, and `false` when `data` should be appended to `file`. +- Added tests that cover: + - The property accessors of `toml.Date`, `toml.Time`, `toml.DateTime`, and `toml.TimeOffset`. + - `toml.toJSON` and `toml.toYAML`. ### Changed -- `toml.tomlToJSON` and `toml.tomlToYAML` have been renamed to `toml.toJSON` and `toml.toYAML`. - - They have been renamed because they now have two functions: converting a TOML string to JSON/YAML (as before), or converting a table into JSON/YAML. - - The first parameter can be a string containing TOML (as before), or a table. +- `toml.tomlToJSON` and `toml.tomlToYAML` have been renamed to `toml.toJSON` and `toml.toYAML`. + - They have been renamed because they now have two functions: converting a TOML string to JSON/YAML (as before), or converting a table into JSON/YAML. + - The first parameter can be a string containing TOML (as before), or a table. ## [0.2.0](https://github.com/LebJe/toml.lua/releases/tag/0.2.0) - 2023-02-12 ### Added -- Updated to toml++ v3.3.0 -- Added `terseKeyValuePairs` to the list of formatting options for `toml.encode` -- Tables can be made inline. -- `toml.decode` can decode date, time and date-time into userdata (as before) or plain tables: +- Updated to toml++ v3.3.0 +- Added `terseKeyValuePairs` to the list of formatting options for `toml.encode` +- Tables can be made inline. +- `toml.decode` can decode date, time and date-time into userdata (as before) or plain tables: ```lua local tomlStr = [[ @@ -126,63 +126,63 @@ int3 = 0x169F --]] ``` -- Test suite now runs on Windows +- Test suite now runs on Windows ### Changed -- Use [luaunit](https://github.com/bluebird75/luaunit) instead of [busted](https://github.com/lunarmodules/busted) for testing -- `quoteDatesAndTimes` now defaults to `false`. +- Use [luaunit](https://github.com/bluebird75/luaunit) instead of [busted](https://github.com/lunarmodules/busted) for testing +- `quoteDatesAndTimes` now defaults to `false`. ### Fixed -- Boolean values are decoded as booleans instead of integers. (#6) +- Boolean values are decoded as booleans instead of integers. (#6) ## [0.1.1](https://github.com/LebJe/toml.lua/releases/tag/0.1.1) - 2022-06-14 ### Added -- Windows support. +- Windows support. ## [0.1.0](https://github.com/LebJe/toml.lua/releases/tag/0.1.0) - 2022-04-08 ### Added -- Upgrade to [toml++ 3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1) -- TOML documents can be converted to JSON or YAML. -- Formatting options can be passed to the `encode`, `tomlToJSON`, and `tomlToYAML` functions. +- Upgrade to [toml++ 3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1) +- TOML documents can be converted to JSON or YAML. +- Formatting options can be passed to the `encode`, `tomlToJSON`, and `tomlToYAML` functions. ### Removed -- Removed `formattedReason` from decoding error messages. +- Removed `formattedReason` from decoding error messages. ## [0.0.4](https://github.com/LebJe/toml.lua/releases/tag/0.0.4) - 2021-11-24 ### Added -- toml.lua is now tested with `g++` and `clang++` with Lua 5.3, 5.2, 5.1 and LuaJIT. +- toml.lua is now tested with `g++` and `clang++` with Lua 5.3, 5.2, 5.1 and LuaJIT. ### Changed -- toml.lua now depends on Lua 5.1, instead of Lua 5.3. +- toml.lua now depends on Lua 5.1, instead of Lua 5.3. ## [0.0.3](https://github.com/LebJe/toml.lua/releases/tag/0.0.3) - 2021-11-08 ### Added -- Date, time, and date-time types. +- Date, time, and date-time types. ### Fixed -- Integers are now inserted into TOML documents as integers, not floating-point numbers. +- Integers are now inserted into TOML documents as integers, not floating-point numbers. ## [0.0.2](https://github.com/LebJe/toml.lua/releases/tag/0.0.2) - 2021-10-29 ### Added -- The `decode` and `tomlToJSON` functions now return a table containing error details instead of a string if parsing a TOML document fails. +- The `decode` and `tomlToJSON` functions now return a table containing error details instead of a string if parsing a TOML document fails. ## [0.0.1](https://github.com/LebJe/toml.lua/releases/tag/0.0.1) - 2021-10-27 ### Added -- Initial Release. +- Initial Release. diff --git a/README.md b/README.md index 313401c..3386920 100644 --- a/README.md +++ b/README.md @@ -13,39 +13,39 @@ toml.lua is a [Lua](https://www.lua.org) wrapper around [toml++](https://github. -- [toml.lua](#tomllua) - - [Table of Contents](#table-of-contents) - - [Installation](#installation) - - [Requirements](#requirements) - - [LuaRocks](#luarocks) - - [MacOS and Linux](#macos-and-linux) - - [Windows](#windows) - - [LLVM](#llvm) - - [MinGW](#mingw) - - [Manual Compilation](#manual-compilation) - - [MacOS and Linux](#macos-and-linux-1) - - [Windows](#windows-1) - - [Build with MinGW](#build-with-mingw) - - [Build with LLVM](#build-with-llvm) - - [Install LuaJIT](#install-luajit) - - [Usage](#usage) - - [Decoding](#decoding) - - [Decoding Options](#decoding-options) - - [temporalTypesAsUserData](#temporaltypesasuserdata) - - [formattedIntsAsUserData](#formattedintsasuserdata) - - [Encoding](#encoding) - - [Error Handling](#error-handling) - - [Inline Tables](#inline-tables) - - [TOML Conversion](#toml-conversion) - - [JSON](#json) - - [YAML](#yaml) - - [Output Formatting](#output-formatting) - - [Formatting Integers](#formatting-integers) - - [Formatting TOML, JSON, or YAML](#formatting-toml-json-or-yaml) - - [Date and Time](#date-and-time) - - [Dependencies](#dependencies) - - [Licenses](#licenses) - - [Contributing](#contributing) +- [toml.lua](#tomllua) + - [Table of Contents](#table-of-contents) + - [Installation](#installation) + - [Requirements](#requirements) + - [LuaRocks](#luarocks) + - [MacOS and Linux](#macos-and-linux) + - [Windows](#windows) + - [LLVM](#llvm) + - [MinGW](#mingw) + - [Manual Compilation](#manual-compilation) + - [MacOS and Linux](#macos-and-linux-1) + - [Windows](#windows-1) + - [Build with MinGW](#build-with-mingw) + - [Build with LLVM](#build-with-llvm) + - [Install LuaJIT](#install-luajit) + - [Usage](#usage) + - [Decoding](#decoding) + - [Decoding Options](#decoding-options) + - [temporalTypesAsUserData](#temporaltypesasuserdata) + - [formattedIntsAsUserData](#formattedintsasuserdata) + - [Encoding](#encoding) + - [Error Handling](#error-handling) + - [Inline Tables](#inline-tables) + - [TOML Conversion](#toml-conversion) + - [JSON](#json) + - [YAML](#yaml) + - [Output Formatting](#output-formatting) + - [Formatting Integers](#formatting-integers) + - [Formatting TOML, JSON, or YAML](#formatting-toml-json-or-yaml) + - [Date and Time](#date-and-time) + - [Dependencies](#dependencies) + - [Licenses](#licenses) + - [Contributing](#contributing) @@ -58,11 +58,11 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) ### Requirements -- A C++ 17 compiler (Clang, GCC, MinGW) -- [CMake](https://cmake.org) -- Lua C headers (`lua.h`, `lualib.h`, and `lauxlib.h`) -- Lua library (e.g. `liblua51.`) -- Lua >= 5.1 or LuaJIT +- A C++ 17 compiler (Clang, GCC, MinGW) +- [CMake](https://cmake.org) +- Lua C headers (`lua.h`, `lualib.h`, and `lauxlib.h`) +- Lua library (e.g. `liblua51.`) +- Lua >= 5.1 or LuaJIT ### LuaRocks @@ -204,16 +204,16 @@ end ##### `temporalTypesAsUserData` -- `temporalTypesAsUserData = true`: The userdata types `toml.Date`, `toml.Time`, and `toml.DateTime` are used to represent TOML date and time types. +- `temporalTypesAsUserData = true`: The userdata types `toml.Date`, `toml.Time`, and `toml.DateTime` are used to represent TOML date and time types. -- `temporalTypesAsUserData = false`: Lua tables are used to represent TOML date and time types. +- `temporalTypesAsUserData = false`: Lua tables are used to represent TOML date and time types. > The default value is `true` ##### `formattedIntsAsUserData` -- `formattedIntsAsUserData = true`: The userdata type `toml.Int` is used to represent integers in octal, binary, or hexadecimal format. -- `formattedIntsAsUserData = false`: Integers in octal, binary, or hexadecimal format will be represented in decimal. +- `formattedIntsAsUserData = true`: The userdata type `toml.Int` is used to represent integers in octal, binary, or hexadecimal format. +- `formattedIntsAsUserData = false`: Integers in octal, binary, or hexadecimal format will be represented in decimal. > The default value is `false` @@ -581,9 +581,9 @@ Passing an empty table removes all options, while not providing a table will use ## Dependencies -- [toml++](https://github.com/marzer/tomlplusplus/) -- [sol2](https://github.com/ThePhD/sol2) -- [magic_enum](https://github.com/Neargye/magic_enum) +- [toml++](https://github.com/marzer/tomlplusplus/) +- [sol2](https://github.com/ThePhD/sol2) +- [magic_enum](https://github.com/Neargye/magic_enum) ## Licenses diff --git a/src/toml.cpp b/src/toml.cpp index 7d1678e..157b744 100644 --- a/src/toml.cpp +++ b/src/toml.cpp @@ -33,8 +33,9 @@ template inline int tomlTo(sol::state_view state, toml::format_flags f return luaL_argerror( L, 1, std::string( - std::string("A string containing a TOML document, or a table with strings as keys " - "should be the first argument, not") + + std::string( + "A string containing a TOML document, or a table with strings as keys " + "should be the first argument, not") + solLuaDataTypeToString(sol::type_of(L, 1))) .c_str()); } @@ -103,8 +104,9 @@ extern "C" { return luaL_argerror( L, 2, std::string( - std::string("A file path (string), or a table should be the second " - "argument, not ") + + std::string( + "A file path (string), or a table should be the second " + "argument, not ") + solLuaDataTypeToString(sol::type_of(L, 2))) .c_str()); } From 97c4892e3c6d2d52ebfdc15e85b4d4b467ddd9e3 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 15:52:07 -0500 Subject: [PATCH 02/30] Add FreeBSD CI --- .github/workflows/buildAndTest-FreeBSD.yml | 46 ++++++++++++++++++++++ .github/workflows/pre-commit.yml | 15 ------- scripts/buildLuaRocks.sh | 13 +++++- scripts/compilerName.sh | 13 +++++- 4 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/buildAndTest-FreeBSD.yml delete mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml new file mode 100644 index 0000000..ca0ef9d --- /dev/null +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -0,0 +1,46 @@ +name: "Build and Test on FreeBSD" +on: + push: + branches: + - "main" + pull_request: + +jobs: + RunTestsOnFreeBSD: + name: "FreeBSD 15" + runs-on: "ubuntu-latest" + strategy: + matrix: + compiler: ["gcc", "clang"] + lua: ["luajit", "lua54", "lua53", "lua52", "lua51"] + steps: + - uses: "actions/checkout@v6" + - name: "Setup FreeBSD VM" + uses: vmactions/freebsd-vm@v1.3.0 + id: vm + with: + usesh: true + - name: "Add Dependencies" + shell: freebsd {0} + run: | + cd $GITHUB_WORKSPACE; + export COMPILER=${{ matrix.compiler }} + source scripts/compilerName.sh + sudo pkg update + sudo pkg install -y ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" + ./scripts/buildLuaRocks.sh + sudo luarocks install luaunit + - name: "Build Project" + shell: freebsd {0} + run: | + cd $GITHUB_WORKSPACE; + export COMPILER=${{ matrix.compiler }} + source scripts/compilerName.sh + sudo luarocks config "variables.CMAKE_C_COMPILER" "$C_COMPILER" + sudo luarocks config "variables.CMAKE_CXX_COMPILER" "$CXX_COMPILER" + sudo CXX="$CXX_COMPILER" CC="$C_COMPILER" luarocks make + - name: "Test Project" + shell: freebsd {0} + run: | + cd $GITHUB_WORKSPACE; + ${{ matrix.lua }} tests/tests.lua diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 640dd1d..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "Run Pre-Commit" - -on: - push: - branches: - - "main" - -jobs: - PreCommit: - runs-on: "macos-latest" - steps: - - uses: "actions/checkout@v4" - - name: "Install Dependencies" - run: "brew bundle" - - uses: "LebJe/pre-commit-composite-action@0.0.1" diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index 70d4573..b709a6e 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -1,6 +1,15 @@ #!/bin/bash -sudo apt install build-essential libreadline-dev unzip wget make -yq + +case $(uname -v) in + *FreeBSD*) + sudo pkg install -y unzip wget gmake readline curl + ;; + *) + sudo apt install build-essential libreadline-dev unzip wget make -yq + ;; + esac + wget "https://luarocks.org/releases/luarocks-3.12.2.tar.gz" tar -zxpf luarocks-3.12.2.tar.gz rm luarocks-3.12.2.tar.gz @@ -8,4 +17,4 @@ cd luarocks-3.12.2 ./configure make sudo make install - mkdir ~/.luarocks +mkdir ~/.luarocks diff --git a/scripts/compilerName.sh b/scripts/compilerName.sh index 7b65431..3ed494f 100755 --- a/scripts/compilerName.sh +++ b/scripts/compilerName.sh @@ -9,8 +9,17 @@ if [[ $COMPILER = "gcc" ]]; then export C_COMPILER="/usr/bin/gcc" export CXX_COMPILER="/usr/bin/g++" elif [[ $COMPILER = "clang" ]]; then - export C_COMPILER_PACKAGE="clang" - export CXX_COMPILER_PACKAGE="" + case $(uname -v) in + *FreeBSD*) + export C_COMPILER_PACKAGE="llvm" + export CXX_COMPILER_PACKAGE="" + ;; + *) + export C_COMPILER_PACKAGE="clang" + export CXX_COMPILER_PACKAGE="" + ;; + esac + export C_COMPILER="/usr/bin/clang" export CXX_COMPILER="/usr/bin/clang++" fi From d043ac6dc158c97ca083ecf4a5fd4127e27268c2 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 16:10:36 -0500 Subject: [PATCH 03/30] Install sudo --- .github/workflows/buildAndTest-FreeBSD.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index ca0ef9d..72f3c2f 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -25,10 +25,12 @@ jobs: run: | cd $GITHUB_WORKSPACE; export COMPILER=${{ matrix.compiler }} - source scripts/compilerName.sh - sudo pkg update + ./scripts/compilerName.sh + pkg update + pkg install sudo sudo pkg install -y ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" ./scripts/buildLuaRocks.sh + sudo luarocks sudo luarocks install luaunit - name: "Build Project" shell: freebsd {0} From 9f115ceb57397493c20c2b71c6a0a04133163a19 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 16:17:33 -0500 Subject: [PATCH 04/30] install bash --- .github/workflows/buildAndTest-FreeBSD.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 72f3c2f..220ba04 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -23,11 +23,14 @@ jobs: - name: "Add Dependencies" shell: freebsd {0} run: | + pkg update + pkg install bash sudo -y + bash cd $GITHUB_WORKSPACE; export COMPILER=${{ matrix.compiler }} ./scripts/compilerName.sh pkg update - pkg install sudo + pkg install sudo -y sudo pkg install -y ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" ./scripts/buildLuaRocks.sh sudo luarocks @@ -35,6 +38,7 @@ jobs: - name: "Build Project" shell: freebsd {0} run: | + bash cd $GITHUB_WORKSPACE; export COMPILER=${{ matrix.compiler }} source scripts/compilerName.sh @@ -44,5 +48,6 @@ jobs: - name: "Test Project" shell: freebsd {0} run: | + bash cd $GITHUB_WORKSPACE; ${{ matrix.lua }} tests/tests.lua From a9c1cb2467062b74fb16a5aa3946d73a301b0ea4 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 16:23:05 -0500 Subject: [PATCH 05/30] Fix install command --- .github/workflows/buildAndTest-FreeBSD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 220ba04..af61a26 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -24,7 +24,7 @@ jobs: shell: freebsd {0} run: | pkg update - pkg install bash sudo -y + pkg install -y bash sudo bash cd $GITHUB_WORKSPACE; export COMPILER=${{ matrix.compiler }} From 2edefa9c5d509ca5f256367e7256bea95949d20e Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 16:31:07 -0500 Subject: [PATCH 06/30] remove unnecessary install command --- .github/workflows/buildAndTest-FreeBSD.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index af61a26..a3bd532 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -26,12 +26,10 @@ jobs: pkg update pkg install -y bash sudo bash - cd $GITHUB_WORKSPACE; + cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} - ./scripts/compilerName.sh - pkg update - pkg install sudo -y - sudo pkg install -y ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" + source ./scripts/compilerName.sh + sudo pkg install -y ${{ matrix.lua }} $C_COMPILER_PACKAGE $CXX_COMPILER_PACKAGE ./scripts/buildLuaRocks.sh sudo luarocks sudo luarocks install luaunit From 6230856dc2f89c92efda5ead8004fdb68a444332 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 17:17:59 -0500 Subject: [PATCH 07/30] set bash as default shell --- .github/workflows/buildAndTest-FreeBSD.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index a3bd532..73cb2e1 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -20,12 +20,13 @@ jobs: id: vm with: usesh: true + prepare: | + pkg update + pkg install -y sudo bash + chsh -s /usr/bin/bash - name: "Add Dependencies" shell: freebsd {0} run: | - pkg update - pkg install -y bash sudo - bash cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} source ./scripts/compilerName.sh From ef7fa2f145fac900df98b1b125af693859dfe974 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 17:27:50 -0500 Subject: [PATCH 08/30] use correct shell path --- .github/workflows/buildAndTest-FreeBSD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 73cb2e1..f426f24 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -23,7 +23,7 @@ jobs: prepare: | pkg update pkg install -y sudo bash - chsh -s /usr/bin/bash + chsh -s /usr/local/bin/bash - name: "Add Dependencies" shell: freebsd {0} run: | From 591ee594620f38ae3382963cf394ef03c135f054 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Wed, 24 Dec 2025 17:43:45 -0500 Subject: [PATCH 09/30] try disabling usesh --- .github/workflows/buildAndTest-FreeBSD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index f426f24..2d86329 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -19,7 +19,7 @@ jobs: uses: vmactions/freebsd-vm@v1.3.0 id: vm with: - usesh: true + #usesh: true prepare: | pkg update pkg install -y sudo bash From e00c1a5b113aa8b27c37f6d2fcdf361fc20d4d54 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 12:33:39 -0500 Subject: [PATCH 10/30] Run scripts with bash --- .github/workflows/buildAndTest-FreeBSD.yml | 39 ++++++++++++---------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 2d86329..b2e3c27 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -23,30 +23,33 @@ jobs: prepare: | pkg update pkg install -y sudo bash - chsh -s /usr/local/bin/bash - name: "Add Dependencies" shell: freebsd {0} run: | - cd $GITHUB_WORKSPACE - export COMPILER=${{ matrix.compiler }} - source ./scripts/compilerName.sh - sudo pkg install -y ${{ matrix.lua }} $C_COMPILER_PACKAGE $CXX_COMPILER_PACKAGE - ./scripts/buildLuaRocks.sh - sudo luarocks - sudo luarocks install luaunit + bash -xc " + cd $GITHUB_WORKSPACE + export COMPILER=${{ matrix.compiler }} + source ./scripts/compilerName.sh + sudo pkg install -y ${{ matrix.lua }} $C_COMPILER_PACKAGE $CXX_COMPILER_PACKAGE + ./scripts/buildLuaRocks.sh + sudo luarocks + sudo luarocks install luaunit + " - name: "Build Project" shell: freebsd {0} run: | - bash - cd $GITHUB_WORKSPACE; - export COMPILER=${{ matrix.compiler }} - source scripts/compilerName.sh - sudo luarocks config "variables.CMAKE_C_COMPILER" "$C_COMPILER" - sudo luarocks config "variables.CMAKE_CXX_COMPILER" "$CXX_COMPILER" - sudo CXX="$CXX_COMPILER" CC="$C_COMPILER" luarocks make + bash -xc " + cd $GITHUB_WORKSPACE + export COMPILER=${{ matrix.compiler }} + source scripts/compilerName.sh + sudo luarocks config \"variables.CMAKE_C_COMPILER\" \"$C_COMPILER\" + sudo luarocks config \"variables.CMAKE_CXX_COMPILER\" \"$CXX_COMPILER\" + sudo CXX=\"$CXX_COMPILER\" CC=\"$C_COMPILER\" luarocks make + " - name: "Test Project" shell: freebsd {0} run: | - bash - cd $GITHUB_WORKSPACE; - ${{ matrix.lua }} tests/tests.lua + bash -xc "" + cd $GITHUB_WORKSPACE + ${{ matrix.lua }} tests/tests.lua + " From 958a9829e2a9462c46206527a70da4c2373b6550 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:01:02 -0500 Subject: [PATCH 11/30] Use single quotes --- .github/workflows/buildAndTest-FreeBSD.yml | 16 ++++++++-------- .github/workflows/buildAndTest-Linux.yml | 2 +- scripts/buildLuaRocks.sh | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index b2e3c27..1c4e57e 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -26,30 +26,30 @@ jobs: - name: "Add Dependencies" shell: freebsd {0} run: | - bash -xc " + bash -xc ' cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} source ./scripts/compilerName.sh - sudo pkg install -y ${{ matrix.lua }} $C_COMPILER_PACKAGE $CXX_COMPILER_PACKAGE - ./scripts/buildLuaRocks.sh + sudo pkg install -y cmake ${{ matrix.lua }} \"$C_COMPILER_PACKAGE\" \"$CXX_COMPILER_PACKAGE\" + bash scripts/buildLuaRocks.sh sudo luarocks sudo luarocks install luaunit - " + ' - name: "Build Project" shell: freebsd {0} run: | - bash -xc " + bash -xc ' cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} source scripts/compilerName.sh sudo luarocks config \"variables.CMAKE_C_COMPILER\" \"$C_COMPILER\" sudo luarocks config \"variables.CMAKE_CXX_COMPILER\" \"$CXX_COMPILER\" sudo CXX=\"$CXX_COMPILER\" CC=\"$C_COMPILER\" luarocks make - " + ' - name: "Test Project" shell: freebsd {0} run: | - bash -xc "" + bash -xc ' cd $GITHUB_WORKSPACE ${{ matrix.lua }} tests/tests.lua - " + ' diff --git a/.github/workflows/buildAndTest-Linux.yml b/.github/workflows/buildAndTest-Linux.yml index 9b04899..d3bc602 100644 --- a/.github/workflows/buildAndTest-Linux.yml +++ b/.github/workflows/buildAndTest-Linux.yml @@ -28,7 +28,7 @@ jobs: source scripts/compilerName.sh sudo apt update sudo apt install -yq ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" - ./scripts/buildLuaRocks.sh + bash scripts/buildLuaRocks.sh sudo luarocks install luaunit - name: "Build Project" run: | diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index b709a6e..b22285d 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -1,5 +1,3 @@ -#!/bin/bash - case $(uname -v) in *FreeBSD*) From 13d62be0cdaa00c39146cfbef4ec97c4dba1386e Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:05:59 -0500 Subject: [PATCH 12/30] Remove unnecessary escaping --- .github/workflows/buildAndTest-FreeBSD.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 1c4e57e..45400ce 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -30,7 +30,7 @@ jobs: cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} source ./scripts/compilerName.sh - sudo pkg install -y cmake ${{ matrix.lua }} \"$C_COMPILER_PACKAGE\" \"$CXX_COMPILER_PACKAGE\" + sudo pkg install -y cmake ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" bash scripts/buildLuaRocks.sh sudo luarocks sudo luarocks install luaunit @@ -42,9 +42,9 @@ jobs: cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} source scripts/compilerName.sh - sudo luarocks config \"variables.CMAKE_C_COMPILER\" \"$C_COMPILER\" - sudo luarocks config \"variables.CMAKE_CXX_COMPILER\" \"$CXX_COMPILER\" - sudo CXX=\"$CXX_COMPILER\" CC=\"$C_COMPILER\" luarocks make + sudo luarocks config "variables.CMAKE_CXX_COMPILER" "$CXX_COMPILER" + sudo luarocks config "variables.CMAKE_C_COMPILER" "$C_COMPILER" + sudo CXX="$CXX_COMPILER" CC="$C_COMPILER" luarocks make ' - name: "Test Project" shell: freebsd {0} From 54be3ba476b8d2b63f1491048c085c69899d44a1 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:10:43 -0500 Subject: [PATCH 13/30] specify path to LUA_BIN_DIR --- scripts/buildLuaRocks.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index b22285d..e352c7b 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -1,6 +1,7 @@ case $(uname -v) in *FreeBSD*) + LUA_BIN_PATH=/usr/local/bin/ sudo pkg install -y unzip wget gmake readline curl ;; *) @@ -12,7 +13,15 @@ wget "https://luarocks.org/releases/luarocks-3.12.2.tar.gz" tar -zxpf luarocks-3.12.2.tar.gz rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 -./configure +case $(uname -v) in + *FreeBSD*) + ./configure --with-lua-bin $LUA_BIN_DIR + ;; + *) + ./configure + ;; + esac + make sudo make install mkdir ~/.luarocks From b3311c7c5b101ad288b794f94349385520d2ca1c Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:16:35 -0500 Subject: [PATCH 14/30] make var visible outside scope --- scripts/buildLuaRocks.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index e352c7b..4c0f7cb 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -1,7 +1,7 @@ case $(uname -v) in *FreeBSD*) - LUA_BIN_PATH=/usr/local/bin/ + export LUA_BIN_PATH=/usr/local/bin/ sudo pkg install -y unzip wget gmake readline curl ;; *) @@ -15,7 +15,7 @@ rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 case $(uname -v) in *FreeBSD*) - ./configure --with-lua-bin $LUA_BIN_DIR + ./configure --with-lua-bin $LUA_BIN_PATH ;; *) ./configure From cdf4b8350c0fd310166b0783cae186ab26ad8c2b Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:21:28 -0500 Subject: [PATCH 15/30] insert path directly --- .github/workflows/buildAndTest-FreeBSD.yml | 2 +- scripts/buildLuaRocks.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 45400ce..e48bcaf 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -31,7 +31,7 @@ jobs: export COMPILER=${{ matrix.compiler }} source ./scripts/compilerName.sh sudo pkg install -y cmake ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" - bash scripts/buildLuaRocks.sh + bash -x scripts/buildLuaRocks.sh sudo luarocks sudo luarocks install luaunit ' diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index 4c0f7cb..e1d76b2 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -1,7 +1,6 @@ case $(uname -v) in *FreeBSD*) - export LUA_BIN_PATH=/usr/local/bin/ sudo pkg install -y unzip wget gmake readline curl ;; *) @@ -15,7 +14,7 @@ rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 case $(uname -v) in *FreeBSD*) - ./configure --with-lua-bin $LUA_BIN_PATH + ./configure --with-lua-bin "usr/local/bin" ;; *) ./configure From 08b15467e2b383422f4c4bdadc6795620231da7f Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:25:49 -0500 Subject: [PATCH 16/30] use "=" in parameter --- scripts/buildLuaRocks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index e1d76b2..51feb4d 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -14,7 +14,7 @@ rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 case $(uname -v) in *FreeBSD*) - ./configure --with-lua-bin "usr/local/bin" + ./configure --with-lua-bin="usr/local/bin" ;; *) ./configure From 30aa5229ec69cac0d589784b020a8782e92bbbad Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:29:06 -0500 Subject: [PATCH 17/30] / --- scripts/buildLuaRocks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index 51feb4d..c663768 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -14,7 +14,7 @@ rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 case $(uname -v) in *FreeBSD*) - ./configure --with-lua-bin="usr/local/bin" + ./configure --with-lua-bin="/usr/local/bin" ;; *) ./configure From 1922efaaf7890c158bc858dd214419c1607a43e8 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:39:36 -0500 Subject: [PATCH 18/30] Use Lua binary name from CI matrix --- .github/workflows/buildAndTest-FreeBSD.yml | 1 + scripts/buildLuaRocks.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index e48bcaf..c7fb91e 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -31,6 +31,7 @@ jobs: export COMPILER=${{ matrix.compiler }} source ./scripts/compilerName.sh sudo pkg install -y cmake ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" + export LUA_BIN_NAME=${{ matrix.lua }} bash -x scripts/buildLuaRocks.sh sudo luarocks sudo luarocks install luaunit diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index c663768..7c22258 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -14,7 +14,7 @@ rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 case $(uname -v) in *FreeBSD*) - ./configure --with-lua-bin="/usr/local/bin" + ./configure --with-lua-bin="/usr/local/bin/$($LUA_BIN_NAME)" ;; *) ./configure From 3d042e229857fe7eb005fae372a509b976b510f4 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:44:00 -0500 Subject: [PATCH 19/30] fix env var --- scripts/buildLuaRocks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index 7c22258..973be36 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -14,7 +14,7 @@ rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 case $(uname -v) in *FreeBSD*) - ./configure --with-lua-bin="/usr/local/bin/$($LUA_BIN_NAME)" + ./configure --with-lua-bin="/usr/local/bin/$LUA_BIN_NAME" ;; *) ./configure From 985385a9b338558b7c989b42d9c607660f96dff3 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:50:44 -0500 Subject: [PATCH 20/30] g++ is not a FreBSD package --- scripts/buildLuaRocks.sh | 2 +- scripts/compilerName.sh | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index 973be36..482bfe9 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -14,7 +14,7 @@ rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 case $(uname -v) in *FreeBSD*) - ./configure --with-lua-bin="/usr/local/bin/$LUA_BIN_NAME" + ./configure --with-lua-bin="/usr/local/bin/" ;; *) ./configure diff --git a/scripts/compilerName.sh b/scripts/compilerName.sh index 3ed494f..ed9dcba 100755 --- a/scripts/compilerName.sh +++ b/scripts/compilerName.sh @@ -5,7 +5,15 @@ export CXX_COMPILER="" if [[ $COMPILER = "gcc" ]]; then export C_COMPILER_PACKAGE="gcc" - export CXX_COMPILER_PACKAGE="g++" + case $(uname -v) in + *FreeBSD*) + export CXX_COMPILER_PACKAGE="" + ;; + *) + export CXX_COMPILER_PACKAGE="g++" + ;; + esac + export C_COMPILER="/usr/bin/gcc" export CXX_COMPILER="/usr/bin/g++" elif [[ $COMPILER = "clang" ]]; then From 848f92e0b12337438dc84cb54bc3c7fb6af0412b Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:53:47 -0500 Subject: [PATCH 21/30] Don't try installing CXX_COMPILER_PACKAGE --- .github/workflows/buildAndTest-FreeBSD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index c7fb91e..8b51208 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -30,7 +30,7 @@ jobs: cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} source ./scripts/compilerName.sh - sudo pkg install -y cmake ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE" + sudo pkg install -y cmake ${{ matrix.lua }} "$C_COMPILER_PACKAGE" export LUA_BIN_NAME=${{ matrix.lua }} bash -x scripts/buildLuaRocks.sh sudo luarocks From f04d6f42acb0842ec752bf12d83eb11d3faacfbf Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 13:59:26 -0500 Subject: [PATCH 22/30] Don't assume compiler paths --- scripts/compilerName.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/compilerName.sh b/scripts/compilerName.sh index ed9dcba..e3206c5 100755 --- a/scripts/compilerName.sh +++ b/scripts/compilerName.sh @@ -14,8 +14,8 @@ if [[ $COMPILER = "gcc" ]]; then ;; esac - export C_COMPILER="/usr/bin/gcc" - export CXX_COMPILER="/usr/bin/g++" + export C_COMPILER="$(which gcc)" + export CXX_COMPILER="$(which g++)" elif [[ $COMPILER = "clang" ]]; then case $(uname -v) in *FreeBSD*) @@ -28,6 +28,6 @@ elif [[ $COMPILER = "clang" ]]; then ;; esac - export C_COMPILER="/usr/bin/clang" - export CXX_COMPILER="/usr/bin/clang++" + export C_COMPILER="$(which clang)" + export CXX_COMPILER="$(which clang++)" fi From 780fbbd971e15cfc9accdd4854a3b37f104d7bb8 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Thu, 25 Dec 2025 14:05:31 -0500 Subject: [PATCH 23/30] Install Git --- .github/workflows/buildAndTest-FreeBSD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 8b51208..c37256e 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -30,7 +30,7 @@ jobs: cd $GITHUB_WORKSPACE export COMPILER=${{ matrix.compiler }} source ./scripts/compilerName.sh - sudo pkg install -y cmake ${{ matrix.lua }} "$C_COMPILER_PACKAGE" + sudo pkg install -y cmake git ${{ matrix.lua }} "$C_COMPILER_PACKAGE" export LUA_BIN_NAME=${{ matrix.lua }} bash -x scripts/buildLuaRocks.sh sudo luarocks From e496d9e7ea9cbf7bf18262469ddfc7d23813321e Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Fri, 26 Dec 2025 15:32:09 -0500 Subject: [PATCH 24/30] Ensure luarocks uses the correct lua version --- .github/workflows/buildAndTest-FreeBSD.yml | 20 ++++++++++++++-- scripts/buildLuaRocks.sh | 27 ++++++++++++++++++---- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index c37256e..4be66ce 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: "actions/checkout@v6" - name: "Setup FreeBSD VM" - uses: vmactions/freebsd-vm@v1.3.0 + uses: vmactions/freebsd-vm@v1 id: vm with: #usesh: true @@ -32,7 +32,23 @@ jobs: source ./scripts/compilerName.sh sudo pkg install -y cmake git ${{ matrix.lua }} "$C_COMPILER_PACKAGE" export LUA_BIN_NAME=${{ matrix.lua }} - bash -x scripts/buildLuaRocks.sh + case ${{ matrix.lua }} in + *lua54*) + bash -x scripts/buildLuaRocks.sh "5.4" + ;; + *lua53*) + bash -x scripts/buildLuaRocks.sh "5.3" + ;; + *lua52*) + bash -x scripts/buildLuaRocks.sh "5.2" + ;; + *lua51*) + bash -x scripts/buildLuaRocks.sh "5.1" + ;; + *) + bash -x scripts/buildLuaRocks.sh + ;; + esac sudo luarocks sudo luarocks install luaunit ' diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index 482bfe9..b734572 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -1,3 +1,4 @@ +# First arg is lua version: 5.4, 5.3, 5.2, 5.1 case $(uname -v) in *FreeBSD*) @@ -12,14 +13,32 @@ wget "https://luarocks.org/releases/luarocks-3.12.2.tar.gz" tar -zxpf luarocks-3.12.2.tar.gz rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 -case $(uname -v) in - *FreeBSD*) - ./configure --with-lua-bin="/usr/local/bin/" +# case $(uname -v) in +# *FreeBSD*) +# ./configure --with-lua-bin="/usr/local/bin/" +# ;; +# *) +# ./configure +# ;; +# esac + +case $1 in + *5.4*) + ./configure --lua-version="5.4" + ;; + *5.3*) + ./configure --lua-version="5.3" + ;; + *5.2*) + ./configure --lua-version="5.2" + ;; + *5.1*) + ./configure --lua-version="5.1" ;; *) ./configure ;; - esac +esac make sudo make install From d23728ac033e20a32f03d114c2d45d858d43104b Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Fri, 26 Dec 2025 15:42:38 -0500 Subject: [PATCH 25/30] Make sure luarocks uses luajit --- .github/workflows/buildAndTest-FreeBSD.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/buildAndTest-FreeBSD.yml b/.github/workflows/buildAndTest-FreeBSD.yml index 4be66ce..8266ca1 100644 --- a/.github/workflows/buildAndTest-FreeBSD.yml +++ b/.github/workflows/buildAndTest-FreeBSD.yml @@ -45,6 +45,9 @@ jobs: *lua51*) bash -x scripts/buildLuaRocks.sh "5.1" ;; + *luajit*) + bash -x scripts/buildLuaRocks.sh "5.1" + ;; *) bash -x scripts/buildLuaRocks.sh ;; From d68182a8eea65f5361f0739dc1aaef8017f0fba7 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Fri, 26 Dec 2025 17:48:19 -0500 Subject: [PATCH 26/30] Add pr-commit workflow --- .github/workflows/pre-commit.yml | 33 ++++++++++++++++++++++++++++++++ README.md | 1 + scripts/buildLuaRocks.sh | 10 +--------- 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..f0400b5 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,33 @@ +name: "Run pre-commit" +on: + push: + branches: + - "main" + pull_request: + +jobs: + PreCommit: + permissions: + contents: "write" + runs-on: "macos-latest" + steps: + - uses: "actions/checkout@v6" + with: + ref: ${{ github.head_ref }} + - name: "Install Dependencies" + run: "brew bundle" + - name: "Run Pre-Commit" + id: "run-pre-commit" + run: | + EXIT_CODE=0 + pre-commit run --all --color=always --show-diff-on-failure || EXIT_CODE=$? + if [[ $EXIT_CODE -ne 0 ]]; then + echo "SHOULD_COMMIT=true" >> "$GITHUB_OUTPUT" + else + echo "SHOULD_COMMIT=false" >> "$GITHUB_OUTPUT" + fi; + - uses: stefanzweifel/git-auto-commit-action@v7 + if: contains(steps.run-pre-commit.outputs.SHOULD_COMMIT, 'true') + with: + commit_message: "Run pre-commit hooks." + \ No newline at end of file diff --git a/README.md b/README.md index 3386920..b918452 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Build and Test on MacOS](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-MacOS.yml/badge.svg)](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-MacOS.yml) [![Build and Test on Linux](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-Linux.yml/badge.svg)](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-Linux.yml) +[![Build and Test on FreeBSD](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-FreeBSD.yml/badge.svg)](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-FreeBSD.yml) [![Build and Test on Windows](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-Windows.yml/badge.svg)](https://github.com/LebJe/toml.lua/actions/workflows/buildAndTest-Windows.yml) [![LuaRocks](https://img.shields.io/luarocks/v/LebJe/toml?color=blue&label=LuaRocks&logo=Lua)](https://luarocks.org/modules/LebJe/toml) diff --git a/scripts/buildLuaRocks.sh b/scripts/buildLuaRocks.sh index b734572..d8ae004 100755 --- a/scripts/buildLuaRocks.sh +++ b/scripts/buildLuaRocks.sh @@ -1,4 +1,4 @@ -# First arg is lua version: 5.4, 5.3, 5.2, 5.1 +# First argument is the Lua version Luarocks should use: 5.4, 5.3, 5.2, 5.1 case $(uname -v) in *FreeBSD*) @@ -13,14 +13,6 @@ wget "https://luarocks.org/releases/luarocks-3.12.2.tar.gz" tar -zxpf luarocks-3.12.2.tar.gz rm luarocks-3.12.2.tar.gz cd luarocks-3.12.2 -# case $(uname -v) in -# *FreeBSD*) -# ./configure --with-lua-bin="/usr/local/bin/" -# ;; -# *) -# ./configure -# ;; -# esac case $1 in *5.4*) From dcf87699c3571e7e6eeda214fb02aa12076092a5 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Fri, 26 Dec 2025 17:58:42 -0500 Subject: [PATCH 27/30] exclude workflow files --- .github/workflows/pre-commit.yml | 1 + CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index f0400b5..1580433 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -30,4 +30,5 @@ jobs: if: contains(steps.run-pre-commit.outputs.SHOULD_COMMIT, 'true') with: commit_message: "Run pre-commit hooks." + file_pattern: ":exclude(.github/workflows/*)" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fe19daa..7fa2790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - The formatting options that were passed as a parameter to `toml.encode`, `toml.encodeToFile`, `toml.toJSON`, and `toml.toYAML` previously had no effect when overriding values. -- Resolved CMake `FetchContent_Populate` warning. +- Resolved CMake `FetchContent_Populate` warning. ### Changed From 8338c022062abb07ecc51d3a2ce8229657b2ee10 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Fri, 26 Dec 2025 18:02:32 -0500 Subject: [PATCH 28/30] Add all other files --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 1580433..f4298ed 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -30,5 +30,5 @@ jobs: if: contains(steps.run-pre-commit.outputs.SHOULD_COMMIT, 'true') with: commit_message: "Run pre-commit hooks." - file_pattern: ":exclude(.github/workflows/*)" + file_pattern: ". :exclude(.github/workflows/*)" \ No newline at end of file From 8d90011970c13f233355808e5747d0862faa281d Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Fri, 26 Dec 2025 18:05:46 -0500 Subject: [PATCH 29/30] fix exclude expression --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index f4298ed..3268d65 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -30,5 +30,5 @@ jobs: if: contains(steps.run-pre-commit.outputs.SHOULD_COMMIT, 'true') with: commit_message: "Run pre-commit hooks." - file_pattern: ". :exclude(.github/workflows/*)" + file_pattern: ". :(exclude).github/workflows/*" \ No newline at end of file From 60687fef6c2102062ce9c5ffadeb39b7d42cf076 Mon Sep 17 00:00:00 2001 From: LebJe <51171427+LebJe@users.noreply.github.com> Date: Fri, 26 Dec 2025 23:06:29 +0000 Subject: [PATCH 30/30] Run pre-commit hooks. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa2790..fe19daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - The formatting options that were passed as a parameter to `toml.encode`, `toml.encodeToFile`, `toml.toJSON`, and `toml.toYAML` previously had no effect when overriding values. -- Resolved CMake `FetchContent_Populate` warning. +- Resolved CMake `FetchContent_Populate` warning. ### Changed