-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from squirrelchat/setup-ci
ci: configure build and test
- Loading branch information
Showing
5 changed files
with
125 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- mistress | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: pnpm | ||
- run: pnpm install | ||
- run: pnpm run build | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
vitest: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
node: [18, 20, 22] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: pnpm | ||
- run: pnpm install | ||
- run: pnpm run test | ||
|
||
toml-test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
node: [18, 20, 22] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.22.3' | ||
- run: go install github.com/toml-lang/toml-test/cmd/toml-test@master | ||
|
||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- run: ./run-toml-test.bash |
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 |
---|---|---|
@@ -1,20 +1,60 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Requires toml-test from https://github.com/toml-lang/toml-test, commit 78f8c61 | ||
# or newer (Oct 2023). | ||
# Requires toml-test from https://github.com/toml-lang/toml-test, commit 78f8c61 or newer (Oct 2023). | ||
|
||
skip=( | ||
skip_decode=( | ||
# Invalid UTF-8 strings are not rejected | ||
-skip='invalid/encoding/bad-utf8-*' | ||
|
||
# Certain invalid UTF-8 codepoints are not rejected | ||
-skip='invalid/encoding/bad-codepoint' | ||
-skip='invalid/string/bad-uni-esc-6' | ||
|
||
# JS uses floats for numbers | ||
# JS* doesn't reject invalid dates, but interprets extra days such as "Feb 30 2023" as "Feb 28 2023 +2d" gracefully. | ||
# | ||
# *This is true for V8, SpiderMonkey, and JavaScriptCore. Note that this behavior is implementation specific and | ||
# certain flavors of engines may behave differently. | ||
# | ||
# While smol-toml could implement additional checks, this has not been done for performance reasons | ||
-skip='invalid/local-date/feb-29' | ||
-skip='invalid/local-datetime/feb-29' | ||
-skip='invalid/datetime/feb-29' | ||
-skip='invalid/local-date/feb-30' | ||
-skip='invalid/local-datetime/feb-30' | ||
-skip='invalid/datetime/feb-30' | ||
|
||
# smol-toml does not support the entire 64-bit integer range | ||
# This is not required by the specification, and smol-toml throws an appropriate error | ||
# https://github.com/toml-lang/toml-test/issues/154 | ||
-skip='valid/integer/long' | ||
) | ||
|
||
skip_encode=( | ||
# smol-toml does not support sub-millisecond time precision | ||
# This is not required by the specification, and smol-toml performs appropriate *truncation*, not rounding | ||
# https://github.com/toml-lang/toml-test/issues/155 | ||
-skip='valid/spec/offset-date-time-0' | ||
-skip='valid/spec/local-date-time-0' | ||
-skip='valid/spec/local-time-0' | ||
|
||
# Some more Float <> Integer shenanigans | ||
# -int-as-float can't help us here, so we have to skip these :( | ||
-skip='valid/inline-table/spaces' | ||
-skip='valid/float/zero' | ||
-skip='valid/float/underscore' | ||
-skip='valid/float/exponent' | ||
-skip='valid/comment/tricky' | ||
-skip='valid/spec/float-0' | ||
|
||
# smol-toml does not support the entire 64-bit integer range | ||
# This is not required by the specification, and smol-toml throws an appropriate error | ||
# https://github.com/toml-lang/toml-test/issues/154 | ||
-skip='valid/integer/long' | ||
) | ||
|
||
e=0 | ||
toml-test -int-as-float ${skip[@]} ./toml-test-parse.mjs || e=1 | ||
toml-test -int-as-float -encoder ${skip[@]} ./toml-test-encode.mjs || e=1 | ||
# -int-as-float as there is no way to distinguish between them at this time. | ||
# For the encoder, distinction is made between floats and integers using JS bigint, however | ||
# due to the lack of option to always serialize plain numbers as floats, some tests fail (and are therefore skipped) | ||
toml-test -int-as-float ${skip_decode[@]} ./toml-test-parse.mjs || e=1 | ||
toml-test -encoder ${skip_encode[@]} ./toml-test-encode.mjs || e=1 | ||
exit $e |
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