-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change(default): no longer set a default random generator
rewritten entire logic and skip setting a default. several new rng source implementations included
- Loading branch information
Showing
24 changed files
with
2,361 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
return { | ||
default = { | ||
verbose = true, | ||
coverage = false, | ||
coverage = true, | ||
output = "gtest", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Lint | ||
|
||
concurrency: | ||
# for PR's cancel the running task, if another commit is pushed | ||
group: ${{ github.workflow }} ${{ github.ref }} | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
||
on: | ||
# build on PR and push-to-main. This works for short-lived branches, and saves | ||
# CPU cycles on duplicated tests. | ||
# For long-lived branches that diverge, you'll want to run on all pushes, not | ||
# just on push-to-main. | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: leafo/gh-actions-lua@v10 | ||
with: | ||
luaVersion: "5.4" | ||
|
||
- uses: leafo/gh-actions-luarocks@v4 | ||
|
||
- name: dependencies | ||
run: | | ||
make dev | ||
- name: lint | ||
run: | | ||
make lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: "Unix build" | ||
|
||
concurrency: | ||
# for PR's cancel the running task, if another commit is pushed | ||
group: ${{ github.workflow }} ${{ github.ref }} | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
||
on: | ||
# build on PR and push-to-main. This works for short-lived branches, and saves | ||
# CPU cycles on duplicated tests. | ||
# For long-lived branches that diverge, you'll want to run on all pushes, not | ||
# just on push-to-main. | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
luaVersion: ["5.1", "5.2", "5.3", "5.4", "luajit-2.1.0-beta3", "luajit-openresty"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: leafo/gh-actions-lua@v10 | ||
with: | ||
luaVersion: ${{ matrix.luaVersion }} | ||
|
||
- uses: leafo/gh-actions-luarocks@v4 | ||
|
||
- name: dependencies | ||
run: | | ||
make dev | ||
luarocks install luacov-coveralls | ||
- name: test | ||
run: | | ||
make testinst BUSTED='--coverage --Xoutput "--color"' | ||
- name: Report test coverage | ||
if: success() | ||
continue-on-error: true | ||
run: luacov-coveralls | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,45 @@ | ||
# Compiled Lua sources | ||
luac.out | ||
|
||
# LuaCov files | ||
*.report.out | ||
*.stats.out | ||
|
||
# luarocks build files | ||
*.rock | ||
*.zip | ||
*.tar.gz | ||
|
||
# Object files | ||
*.o | ||
*.os | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
*.def | ||
*.exp | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
std = "ngx_lua" | ||
unused_args = false | ||
redefined = false | ||
max_line_length = false | ||
|
||
|
||
globals = { | ||
-- "ngx", | ||
} | ||
|
||
|
||
not_globals = { | ||
-- deprecated Lua 5.0 functions | ||
"string.len", | ||
"table.getn", | ||
} | ||
|
||
|
||
ignore = { | ||
--"6.", -- ignore whitespace warnings | ||
include_files = { | ||
"**/*.lua", | ||
"**/*.rockspec", | ||
".busted", | ||
".luacheckrc", | ||
} | ||
|
||
files["spec/**/*.lua"] = { | ||
std = "+busted", | ||
} | ||
|
||
exclude_files = { | ||
--"spec/fixtures/invalid-module.lua", | ||
--"spec-old-api/fixtures/invalid-module.lua", | ||
-- The Github Actions Lua Environment | ||
".lua", | ||
".luarocks", | ||
".install", | ||
} | ||
|
||
|
||
files["spec/**/*.lua"] = { | ||
std = "ngx_lua+busted", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
modules = { | ||
["uuid.*"] = "src" | ||
} | ||
|
||
runreport = true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# CHANGELOG | ||
|
||
## Versioning | ||
|
||
This library is versioned based on Semantic Versioning ([SemVer](https://semver.org/)). | ||
|
||
#### Version scoping | ||
|
||
The scope of what is covered by the version number excludes: | ||
|
||
- error messages; the text of the messages can change, unless specifically documented. | ||
|
||
#### Releasing new versions | ||
|
||
- create a release branch | ||
- update the changelog below | ||
- update version and copyright-years in `./LICENSE.md` (bottom) and `./src/uuid.lua` (in | ||
doc-comments header) | ||
- create a new rockspec and update the version inside the new rockspec:<br/> | ||
`cp uuid-dev-1.rockspec ./rockspecs/uuid-X.Y.Z-1.rockspec` | ||
- test: run `make test` and `make lint` | ||
- clean and render the docs: run `make clean` and `make docs` | ||
- commit the changes as `release X.Y.Z` | ||
- push the commit, and create a release PR | ||
- after merging tag the release commit with `X.Y.Z` | ||
- upload to LuaRocks:<br/> | ||
`luarocks upload ./rockspecs/uuid-X.Y.Z-1.rockspec --api-key=ABCDEFGH` | ||
- test the newly created rock:<br/> | ||
`luarocks install uuid` | ||
|
||
## Version history | ||
|
||
### Version 1.0.0, unreleased | ||
|
||
- BREAKING: no default rng will be picked anymore, one must be set explicitly, see `set_rng` | ||
- BREAKING: calling on the module table `uuid()` will now call `v4()` instead of `new()` | ||
which means it no longer supports the `hwaddr` parameter | ||
- Change: `new` function with the `hwaddr` parameter is deprecated, will be removed later | ||
- Change: `randomseed` has moved to `rng.math_randomseed`, alias will be removed later | ||
- Change: `seed` has moved to `rng.seed`, alias will be removed later | ||
- Feat: new `rng` module with multiple `rng`s available | ||
- Feat: new `set_rng` function to set the `rng` to use | ||
- Feat: the `rng.seed` function has a new parameter `userinput` that allows the user to specify | ||
additional input for seeding the Lua rng (eg. pass in a mac address). | ||
- Feat: new `rng.luasystem` rng that uses LuaSystem for random number generation (Posix + Windows) | ||
- Feat: new `rng.urandom` rng that uses /dev/urandom for random number generation (Posix, no Windows) | ||
- Feat: new `rng.math_random` rng that replaces the old rng used, based on Lua's `math.random` function. | ||
- Feat: improved seeding, using LuaSystem, or /dev/urandom if available. If not, the fallback now uses | ||
more inputs (including a user provided one, eg. a mac address) and calculates a SHA1 used as seed. | ||
Also support for the Lua 5.4 | ||
|
||
### Version 0.3, released 11-Jul-2021 | ||
|
||
- Fix: set proper type for UUIDv4 type | ||
- Feat: improve seeding for OpenResty | ||
- Doc: fix link in readme | ||
|
||
### Version 0.2, released 09-May-2013 | ||
|
||
- Bugfix; 0-hex was displayed as "" instead of "00", making some uuids too short | ||
- Bugfix; math.randomseed() overflow caused bad seeding | ||
|
||
### Version 0.1, released 28-Apr-2013 | ||
|
||
- initial version |
Oops, something went wrong.