Skip to content

Commit 1b6c85c

Browse files
authored
Add FreeBSD CI (#17)
* Add FreeBSD CI * Add pre-commit workflow * Run pre-commit hooks.
1 parent c2c5a74 commit 1b6c85c

File tree

10 files changed

+252
-112
lines changed

10 files changed

+252
-112
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ A clear and concise description of what the bug is.
1212

1313
## Version and Installation Info
1414

15-
- toml.lua version:
16-
- Operating system:
17-
- Installation method: (Manual compilation or `luarocks install toml`)
18-
- Compilation log, or Luarocks installation log:
15+
- toml.lua version:
16+
- Operating system:
17+
- Installation method: (Manual compilation or `luarocks install toml`)
18+
- Compilation log, or Luarocks installation log:
1919

2020
```shell
2121
# Paste installation or compilation log here
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: "Build and Test on FreeBSD"
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
8+
jobs:
9+
RunTestsOnFreeBSD:
10+
name: "FreeBSD 15"
11+
runs-on: "ubuntu-latest"
12+
strategy:
13+
matrix:
14+
compiler: ["gcc", "clang"]
15+
lua: ["luajit", "lua54", "lua53", "lua52", "lua51"]
16+
steps:
17+
- uses: "actions/checkout@v6"
18+
- name: "Setup FreeBSD VM"
19+
uses: vmactions/freebsd-vm@v1
20+
id: vm
21+
with:
22+
#usesh: true
23+
prepare: |
24+
pkg update
25+
pkg install -y sudo bash
26+
- name: "Add Dependencies"
27+
shell: freebsd {0}
28+
run: |
29+
bash -xc '
30+
cd $GITHUB_WORKSPACE
31+
export COMPILER=${{ matrix.compiler }}
32+
source ./scripts/compilerName.sh
33+
sudo pkg install -y cmake git ${{ matrix.lua }} "$C_COMPILER_PACKAGE"
34+
export LUA_BIN_NAME=${{ matrix.lua }}
35+
case ${{ matrix.lua }} in
36+
*lua54*)
37+
bash -x scripts/buildLuaRocks.sh "5.4"
38+
;;
39+
*lua53*)
40+
bash -x scripts/buildLuaRocks.sh "5.3"
41+
;;
42+
*lua52*)
43+
bash -x scripts/buildLuaRocks.sh "5.2"
44+
;;
45+
*lua51*)
46+
bash -x scripts/buildLuaRocks.sh "5.1"
47+
;;
48+
*luajit*)
49+
bash -x scripts/buildLuaRocks.sh "5.1"
50+
;;
51+
*)
52+
bash -x scripts/buildLuaRocks.sh
53+
;;
54+
esac
55+
sudo luarocks
56+
sudo luarocks install luaunit
57+
'
58+
- name: "Build Project"
59+
shell: freebsd {0}
60+
run: |
61+
bash -xc '
62+
cd $GITHUB_WORKSPACE
63+
export COMPILER=${{ matrix.compiler }}
64+
source scripts/compilerName.sh
65+
sudo luarocks config "variables.CMAKE_CXX_COMPILER" "$CXX_COMPILER"
66+
sudo luarocks config "variables.CMAKE_C_COMPILER" "$C_COMPILER"
67+
sudo CXX="$CXX_COMPILER" CC="$C_COMPILER" luarocks make
68+
'
69+
- name: "Test Project"
70+
shell: freebsd {0}
71+
run: |
72+
bash -xc '
73+
cd $GITHUB_WORKSPACE
74+
${{ matrix.lua }} tests/tests.lua
75+
'

.github/workflows/buildAndTest-Linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
source scripts/compilerName.sh
2929
sudo apt update
3030
sudo apt install -yq ${{ matrix.lua }} "$C_COMPILER_PACKAGE" "$CXX_COMPILER_PACKAGE"
31-
./scripts/buildLuaRocks.sh
31+
bash scripts/buildLuaRocks.sh
3232
sudo luarocks install luaunit
3333
- name: "Build Project"
3434
run: |

.github/workflows/pre-commit.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
1-
name: "Run Pre-Commit"
2-
1+
name: "Run pre-commit"
32
on:
43
push:
54
branches:
65
- "main"
7-
6+
pull_request:
7+
88
jobs:
99
PreCommit:
10+
permissions:
11+
contents: "write"
1012
runs-on: "macos-latest"
1113
steps:
12-
- uses: "actions/checkout@v4"
14+
- uses: "actions/checkout@v6"
15+
with:
16+
ref: ${{ github.head_ref }}
1317
- name: "Install Dependencies"
1418
run: "brew bundle"
15-
- uses: "LebJe/[email protected]"
19+
- name: "Run Pre-Commit"
20+
id: "run-pre-commit"
21+
run: |
22+
EXIT_CODE=0
23+
pre-commit run --all --color=always --show-diff-on-failure || EXIT_CODE=$?
24+
if [[ $EXIT_CODE -ne 0 ]]; then
25+
echo "SHOULD_COMMIT=true" >> "$GITHUB_OUTPUT"
26+
else
27+
echo "SHOULD_COMMIT=false" >> "$GITHUB_OUTPUT"
28+
fi;
29+
- uses: stefanzweifel/git-auto-commit-action@v7
30+
if: contains(steps.run-pre-commit.outputs.SHOULD_COMMIT, 'true')
31+
with:
32+
commit_message: "Run pre-commit hooks."
33+
file_pattern: ". :(exclude).github/workflows/*"
34+

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: "https://github.com/pre-commit/mirrors-prettier.git"
5-
rev: "v4.0.0-alpha.8"
4+
- repo: "https://github.com/rbubley/mirrors-prettier.git"
5+
rev: "v3.7.4"
66
hooks:
77
- id: "prettier"
88
name: "Format YAML & Markdown"

CHANGELOG.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12-
- 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.
13-
- Resolved CMake `FetchContent_Populate` warning.
12+
- 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.
13+
- Resolved CMake `FetchContent_Populate` warning.
1414

1515
### Changed
1616

17-
- Updated to magic_enum v0.9.7.
17+
- Updated to magic_enum v0.9.7.
1818

1919
### Added
2020

21-
- Added tests for encoding options.
21+
- Added tests for encoding options.
2222

2323
## [0.4.0](https://github.com/LebJe/toml.lua/releases/tag/0.4.0) - 2024-01-02
2424

2525
### Added
2626

27-
- `toml.Int` for formatted integers.
27+
- `toml.Int` for formatted integers.
2828

2929
```lua
3030
local formattedIntegers = {
@@ -41,39 +41,39 @@ int3 = 0x169F
4141
--]]
4242
```
4343

44-
- `formattedIntsAsUserdata` can be passed to the options table of `toml.decode` (see "Decoding Options" in the README).
45-
- Updated to toml++ v3.4.0.
46-
- Updated to MagicEnum v0.9.5.
47-
- toml.lua compiles with MSVC.
44+
- `formattedIntsAsUserdata` can be passed to the options table of `toml.decode` (see "Decoding Options" in the README).
45+
- Updated to toml++ v3.4.0.
46+
- Updated to MagicEnum v0.9.5.
47+
- toml.lua compiles with MSVC.
4848

4949
## [0.3.0](https://github.com/LebJe/toml.lua/releases/tag/0.3.0) - 2023-02-19
5050

5151
### Added
5252

53-
- `toml.decodeFromFile(filePath: string)`:
54-
- Decodes a TOML document at `filePath`. Throws the same errors as `toml.decode`.
55-
- `toml.encodeToFile(data: table, fileOrOptions: string|table)`:
56-
- Encodes `data` to the file specified in `fileOrOptions`. the file will be created if it doesn't exist.
57-
- When `fileOrOptions` is a string, it simply is the file path.
58-
- 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`.
59-
- Added tests that cover:
60-
- The property accessors of `toml.Date`, `toml.Time`, `toml.DateTime`, and `toml.TimeOffset`.
61-
- `toml.toJSON` and `toml.toYAML`.
53+
- `toml.decodeFromFile(filePath: string)`:
54+
- Decodes a TOML document at `filePath`. Throws the same errors as `toml.decode`.
55+
- `toml.encodeToFile(data: table, fileOrOptions: string|table)`:
56+
- Encodes `data` to the file specified in `fileOrOptions`. the file will be created if it doesn't exist.
57+
- When `fileOrOptions` is a string, it simply is the file path.
58+
- 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`.
59+
- Added tests that cover:
60+
- The property accessors of `toml.Date`, `toml.Time`, `toml.DateTime`, and `toml.TimeOffset`.
61+
- `toml.toJSON` and `toml.toYAML`.
6262

6363
### Changed
6464

65-
- `toml.tomlToJSON` and `toml.tomlToYAML` have been renamed to `toml.toJSON` and `toml.toYAML`.
66-
- 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.
67-
- The first parameter can be a string containing TOML (as before), or a table.
65+
- `toml.tomlToJSON` and `toml.tomlToYAML` have been renamed to `toml.toJSON` and `toml.toYAML`.
66+
- 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.
67+
- The first parameter can be a string containing TOML (as before), or a table.
6868

6969
## [0.2.0](https://github.com/LebJe/toml.lua/releases/tag/0.2.0) - 2023-02-12
7070

7171
### Added
7272

73-
- Updated to toml++ v3.3.0
74-
- Added `terseKeyValuePairs` to the list of formatting options for `toml.encode`
75-
- Tables can be made inline.
76-
- `toml.decode` can decode date, time and date-time into userdata (as before) or plain tables:
73+
- Updated to toml++ v3.3.0
74+
- Added `terseKeyValuePairs` to the list of formatting options for `toml.encode`
75+
- Tables can be made inline.
76+
- `toml.decode` can decode date, time and date-time into userdata (as before) or plain tables:
7777

7878
```lua
7979
local tomlStr = [[
@@ -126,63 +126,63 @@ int3 = 0x169F
126126
--]]
127127
```
128128

129-
- Test suite now runs on Windows
129+
- Test suite now runs on Windows
130130

131131
### Changed
132132

133-
- Use [luaunit](https://github.com/bluebird75/luaunit) instead of [busted](https://github.com/lunarmodules/busted) for testing
134-
- `quoteDatesAndTimes` now defaults to `false`.
133+
- Use [luaunit](https://github.com/bluebird75/luaunit) instead of [busted](https://github.com/lunarmodules/busted) for testing
134+
- `quoteDatesAndTimes` now defaults to `false`.
135135

136136
### Fixed
137137

138-
- Boolean values are decoded as booleans instead of integers. (#6)
138+
- Boolean values are decoded as booleans instead of integers. (#6)
139139

140140
## [0.1.1](https://github.com/LebJe/toml.lua/releases/tag/0.1.1) - 2022-06-14
141141

142142
### Added
143143

144-
- Windows support.
144+
- Windows support.
145145

146146
## [0.1.0](https://github.com/LebJe/toml.lua/releases/tag/0.1.0) - 2022-04-08
147147

148148
### Added
149149

150-
- Upgrade to [toml++ 3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1)
151-
- TOML documents can be converted to JSON or YAML.
152-
- Formatting options can be passed to the `encode`, `tomlToJSON`, and `tomlToYAML` functions.
150+
- Upgrade to [toml++ 3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1)
151+
- TOML documents can be converted to JSON or YAML.
152+
- Formatting options can be passed to the `encode`, `tomlToJSON`, and `tomlToYAML` functions.
153153

154154
### Removed
155155

156-
- Removed `formattedReason` from decoding error messages.
156+
- Removed `formattedReason` from decoding error messages.
157157

158158
## [0.0.4](https://github.com/LebJe/toml.lua/releases/tag/0.0.4) - 2021-11-24
159159

160160
### Added
161161

162-
- toml.lua is now tested with `g++` and `clang++` with Lua 5.3, 5.2, 5.1 and LuaJIT.
162+
- toml.lua is now tested with `g++` and `clang++` with Lua 5.3, 5.2, 5.1 and LuaJIT.
163163

164164
### Changed
165165

166-
- toml.lua now depends on Lua 5.1, instead of Lua 5.3.
166+
- toml.lua now depends on Lua 5.1, instead of Lua 5.3.
167167

168168
## [0.0.3](https://github.com/LebJe/toml.lua/releases/tag/0.0.3) - 2021-11-08
169169

170170
### Added
171171

172-
- Date, time, and date-time types.
172+
- Date, time, and date-time types.
173173

174174
### Fixed
175175

176-
- Integers are now inserted into TOML documents as integers, not floating-point numbers.
176+
- Integers are now inserted into TOML documents as integers, not floating-point numbers.
177177

178178
## [0.0.2](https://github.com/LebJe/toml.lua/releases/tag/0.0.2) - 2021-10-29
179179

180180
### Added
181181

182-
- The `decode` and `tomlToJSON` functions now return a table containing error details instead of a string if parsing a TOML document fails.
182+
- The `decode` and `tomlToJSON` functions now return a table containing error details instead of a string if parsing a TOML document fails.
183183

184184
## [0.0.1](https://github.com/LebJe/toml.lua/releases/tag/0.0.1) - 2021-10-27
185185

186186
### Added
187187

188-
- Initial Release.
188+
- Initial Release.

0 commit comments

Comments
 (0)