Install toml-test in GitHub actions.
This only installs the toml-test binary; you still need to run toml-test to actually test stuff.
Example usage:
steps:
- uses: 'actions/checkout@v4'
- uses: 'toml-lang/setup-toml-test@v1'
- run: './toml-test my-decoder'
Options, with their default values:
- uses: 'toml-lang/setup-toml-test@v1'
with:
# Select toml-test version; one of:
#
# - specific tag name (e.g. "v1.6.0");
# - "latest" for # the latest tagged version, or
# - "main" for the latest main branch.
#
# It will download a pre-compiled binary, but with "main" it will need
# to compile from source, which requires Go to be installed (e.g. add
# uses: 'actions/setup-go')
version: 'latest'
# Location to store the binary.
bin: './toml-test'
In the simplest case, just -run: 'toml-test my-decoder'
is enough.
However, many implementations don't pass all the tests, because there are "known
bugs" or by choice (especially for "invalid" tests as some are a tad pedantic).
You can use -skip
to skip these tests. You can use toml-test -script
to
generate a shell script which skips all currently failing tests. Abridged, it
looks something like:
% toml-test -script my-decoder
#!/usr/bin/env bash
failing=(
-skip invalid/array/extending-table
)
toml-test ${failing[@]} -skip-must-error "$@" -- my-decoder
The -skip-must-error
flag causes toml-test to fail if a skipped test doesn't
cause an error.
The rationale for doing it like this is that people can easily run this on their local machines, which wouldn't be so easy if all of this was in the GitHub actions YAML.